Message ID | 1258657672-9897-1-git-send-email-weil@mail.berlios.de |
---|---|
State | New |
Headers | show |
Stefan Weil wrote: > 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> Tested-by: Sebastian Herbszt <herbszt@gmx.de>
On Thu, 19 Nov 2009, Stefan Weil wrote: > 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. Why not just stuff `-MMD -MP -MT $@' into the rules? [..snip..]
Stefan Weil wrote: > Make using mingw32 on windows does not preserve $@ in macros > when they are modified using this pattern: > target: macro += something Is it not using GNU Make, or is it some ancient version? ("make --version" shows the version, if it's GNU Make). -- Jamie
malc schrieb: > On Thu, 19 Nov 2009, Stefan Weil wrote: > >> 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. > > Why not just stuff `-MMD -MP -MT $@' into the rules? > > [..snip..] As in most cases, there are many ways to do something... During my test, I had the dependency flags in the rules. I decided to use a macro to allow people running make without dependency generation (make QEMU_DGFLAGS=). Stefan
Jamie Lokier schrieb: > Stefan Weil wrote: > >> Make using mingw32 on windows does not preserve $@ in macros >> when they are modified using this pattern: >> target: macro += something >> > > Is it not using GNU Make, or is it some ancient version? > ("make --version" shows the version, if it's GNU Make). > > -- Jamie > > GNU make 3.79.1 (2004) -- Stefan
Stefan Weil wrote: > Jamie Lokier schrieb: > > Stefan Weil wrote: > > > >> Make using mingw32 on windows does not preserve $@ in macros > >> when they are modified using this pattern: > >> target: macro += something > >> > > > > Is it not using GNU Make, or is it some ancient version? > > ("make --version" shows the version, if it's GNU Make). > > > > -- Jamie > > GNU make 3.79.1 (2004) 3.79.1 is ancient, the GNU version being released in June 2000 :-) The behaviour of target: macro += something appears to be fixed in GNU make 3.80, which was released in October 2002. (I've just tested 3.79.1 and 3.80 from GNU's ftp site). Is there not an update for mingw32 for a more recent make? -- Jamie
Jamie Lokier wrote: > Stefan Weil wrote: >> Make using mingw32 on windows does not preserve $@ in macros >> when they are modified using this pattern: >> target: macro += something > > Is it not using GNU Make, or is it some ancient version? > ("make --version" shows the version, if it's GNU Make). > > -- Jamie $ make --version GNU Make version 3.79.1, by Richard Stallman and Roland McGrath. Built for i686-pc-msys - Sebastian
Jamie Lokier schrieb: > Stefan Weil wrote: >> Jamie Lokier schrieb: >>> Stefan Weil wrote: >>> >>>> Make using mingw32 on windows does not preserve $@ in macros >>>> when they are modified using this pattern: >>>> target: macro += something >>>> >>> Is it not using GNU Make, or is it some ancient version? >>> ("make --version" shows the version, if it's GNU Make). >>> >>> -- Jamie >> GNU make 3.79.1 (2004) > > 3.79.1 is ancient, the GNU version being released in June 2000 :-) > > The behaviour of > > target: macro += something > > appears to be fixed in GNU make 3.80, which was released in October 2002. > (I've just tested 3.79.1 and 3.80 from GNU's ftp site). > > Is there not an update for mingw32 for a more recent make? > > -- Jamie Of course it's ancient, but from the timestamp (if it was correct) I'd estimate that it takes 3 to 4 years to get a GNU release to windows :-) MSYS make 3.81-2 is available (and there is also a MinGW make, a make using MSVCRT). The MinGW update tool does not update MSYS make automatically (at least in my installation), and I rarely compile using mingw32 on windows (cross compilation from linux works better). So keeping MinGW/MSYS up-to-date is a little difficult. -- Stefan
diff --git a/rules.mak b/rules.mak index 77a801b..16713ba 100644 --- a/rules.mak +++ b/rules.mak @@ -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)$@")
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> --- rules.mak | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)