Skip to content

Commit

Permalink
Fix build for mingw32 on windows ($@ in macro)
Browse files Browse the repository at this point in the history
Make using mingw32 on windows does not preserve $@ in macros
when they are modified using this pattern:
target: macro += something

This behaviour results in an error when QEMU_CFLAGS containing
"-MMD -MP -MT $@" is modified for compilation of source files
which use SDL: $@ will expand to nothing, -MT no longer has
the correct argument (it will take the next one from the command
line) and the build will fail or run with a wrong command line.

The problem is fixed by using a new macro QEMU_DGFLAGS
which is not modified by a target rule.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
Stefan Weil authored and Anthony Liguori committed Dec 3, 2009
1 parent b10fec9 commit 7ebf54b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rules.mak
Expand Up @@ -11,16 +11,17 @@ MAKEFLAGS += -rR
%.m:
%.mak:

QEMU_CFLAGS += -MMD -MP -MT $@
# Flags for dependency generation
QEMU_DGFLAGS += -MMD -MP -MT $@

%.o: %.c $(GENERATED_HEADERS)
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")

%.o: %.S
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@")
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@")

%.o: %.m
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")

LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@")

Expand Down

0 comments on commit 7ebf54b

Please sign in to comment.