diff options
author | Jason Perkins <starkos@industriousone.com> | 2013-01-23 20:20:02 +0400 |
---|---|---|
committer | Jason Perkins <starkos@industriousone.com> | 2013-01-23 20:20:02 +0400 |
commit | a3829657a1d29e7f863f8618414cf898cebf52a5 (patch) | |
tree | b494da6a094be0fcd7f962d9bfd4330bd868185a | |
parent | bc38d316887263a1a53783efb73968e69acadfcd (diff) | |
parent | c4f25fcad40f33d9a9a11168d9f6bbc20111e5f9 (diff) |
Merged in bitshifter/premake-stable-env-flags-makefile-fix (pull request #4)
Use ALL_CPPFLAGS, ALL_CFLAGS, ALL_CXXFLAGS and ALL_LDFLAGS internally so CFLAGS etc can be overridden on the command line.
-rw-r--r-- | src/actions/make/make_cpp.lua | 14 | ||||
-rw-r--r-- | tests/actions/make/test_make_pch.lua | 6 | ||||
-rw-r--r-- | tests/actions/make/test_wiidev.lua | 8 | ||||
-rw-r--r-- | tests/test_gmake_cpp.lua | 38 |
4 files changed, 33 insertions, 33 deletions
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua index 4130683..7f9f6b2 100644 --- a/src/actions/make/make_cpp.lua +++ b/src/actions/make/make_cpp.lua @@ -202,7 +202,7 @@ -- but had trouble linking to certain static libs so $(OBJECTS) moved up -- then $(LDFLAGS) moved to end -- https://sourceforge.net/tracker/?func=detail&aid=3430158&group_id=71616&atid=531880 - _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)', iif(cfg.language == "C", "CC", "CXX")) + _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS)', iif(cfg.language == "C", "CC", "CXX")) end _p(' define PREBUILDCMDS') @@ -257,12 +257,12 @@ -- function cpp.flags(cfg, cc) - _p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " ")) - _p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " ")) - _p(' CXXFLAGS += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " ")) + _p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " ")) + _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " ")) + _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " ")) -- Patch #3401184 changed the order - _p(' LDFLAGS += %s', table.concat(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions), " ")) + _p(' ALL_LDFLAGS += $(LDFLAGS) %s', table.concat(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions), " ")) _p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), @@ -290,7 +290,7 @@ if not cfg.flags.NoPCH and cfg.pchheader then _p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader))) _p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader))) - _p(' CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader))) + _p(' ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader))) end end @@ -314,6 +314,6 @@ -- function cpp.buildcommand(iscfile, objext) - local flags = iif(iscfile, '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)') + local flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)') _p('\t$(SILENT) %s -o "$@" -MF $(@:%%.%s=%%.d) -c "$<"', flags, objext) end diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua index ee48a1b..c471e09 100644 --- a/tests/actions/make/test_make_pch.lua +++ b/tests/actions/make/test_make_pch.lua @@ -51,7 +51,7 @@ test.capture [[ PCH = include/myproject.h GCH = $(OBJDIR)/myproject.h.gch - CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/myproject.h + ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/myproject.h ]] end @@ -73,7 +73,7 @@ ifeq (posix,$(SHELLTYPE)) else $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul endif - $(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" + $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" endif ]] end @@ -92,7 +92,7 @@ ifeq (posix,$(SHELLTYPE)) else $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul endif - $(SILENT) $(CC) $(CFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" + $(SILENT) $(CC) $(ALL_CFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" endif ]] end diff --git a/tests/actions/make/test_wiidev.lua b/tests/actions/make/test_wiidev.lua index fd0bfdd..4561b0c 100644 --- a/tests/actions/make/test_wiidev.lua +++ b/tests/actions/make/test_wiidev.lua @@ -32,10 +32,10 @@ function suite.writesCorrectFlags() cpp.flags(cfg, premake.gcc) test.capture [[ - CPPFLAGS += -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES) - CFLAGS += $(CPPFLAGS) $(ARCH) - CXXFLAGS += $(CFLAGS) - LDFLAGS += -s -L$(LIBOGC_LIB) $(MACHDEP) + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) -s -L$(LIBOGC_LIB) $(MACHDEP) RESFLAGS += $(DEFINES) $(INCLUDES) ]] end diff --git a/tests/test_gmake_cpp.lua b/tests/test_gmake_cpp.lua index 3ccd8d1..d87a1bf 100644 --- a/tests/test_gmake_cpp.lua +++ b/tests/test_gmake_cpp.lua @@ -78,14 +78,14 @@ ifeq ($(config),debug) TARGET = $(TARGETDIR)/MyProject DEFINES += INCLUDES += - CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES) - CFLAGS += $(CPPFLAGS) $(ARCH) - CXXFLAGS += $(CFLAGS) - LDFLAGS += -s + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) -s RESFLAGS += $(DEFINES) $(INCLUDES) LIBS += LDDEPS += - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS) define PREBUILDCMDS endef define PRELINKCMDS @@ -112,14 +112,14 @@ ifeq ($(config),debugps3) TARGET = $(TARGETDIR)/MyProject.elf DEFINES += INCLUDES += - CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES) - CFLAGS += $(CPPFLAGS) $(ARCH) - CXXFLAGS += $(CFLAGS) - LDFLAGS += -s + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) -s RESFLAGS += $(DEFINES) $(INCLUDES) LIBS += LDDEPS += - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS) define PREBUILDCMDS endef define PRELINKCMDS @@ -143,14 +143,14 @@ ifeq ($(config),debug64) TARGET = $(TARGETDIR)/MyProject DEFINES += INCLUDES += - CPPFLAGS += -MMD -MP $(DEFINES) $(INCLUDES) - CFLAGS += $(CPPFLAGS) $(ARCH) -m64 - CXXFLAGS += $(CFLAGS) - LDFLAGS += -s -m64 -L/usr/lib64 + ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -m64 + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) -s -m64 -L/usr/lib64 RESFLAGS += $(DEFINES) $(INCLUDES) LIBS += LDDEPS += - LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS) + LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS) define PREBUILDCMDS endef define PRELINKCMDS @@ -175,10 +175,10 @@ ifeq ($(config),debuguniv32) TARGET = $(TARGETDIR)/libMyProject.a DEFINES += INCLUDES += - CPPFLAGS += $(DEFINES) $(INCLUDES) - CFLAGS += $(CPPFLAGS) $(ARCH) -arch i386 -arch ppc - CXXFLAGS += $(CFLAGS) - LDFLAGS += -s -arch i386 -arch ppc + ALL_CPPFLAGS += $(CPPFLAGS) $(DEFINES) $(INCLUDES) + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH) -arch i386 -arch ppc + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += $(LDFLAGS) -s -arch i386 -arch ppc RESFLAGS += $(DEFINES) $(INCLUDES) LIBS += LDDEPS += |