Allow command line override of makefile flags (Cameron Hart)

This commit is contained in:
Jason Perkins 2013-01-23 11:50:54 -05:00
parent 24708fcb21
commit b7bc59e105
8 changed files with 101 additions and 86 deletions

View File

@ -99,6 +99,8 @@
* Patch 3462994: Make flag values case-insensitive (Konstantin Tokarev) * Patch 3462994: Make flag values case-insensitive (Konstantin Tokarev)
* Patch 3466877: Removed -flat_namespace from Mac OS X flags (Konstantin Tokarev) * Patch 3466877: Removed -flat_namespace from Mac OS X flags (Konstantin Tokarev)
* Pull 25: Add Unix support to os.getversion() (wfgleper) * Pull 25: Add Unix support to os.getversion() (wfgleper)
* Bug 268: Target extension not set properly for Visual Studio 2010
* Allow command line override of makefile flags (Cameron Hart)
------- -------

View File

@ -197,6 +197,19 @@
end end
--
-- Format a list of values to be safely written as part of a variable assignment.
--
function make.list(value)
if #value > 0 then
return " " .. table.concat(value, " ")
else
return ""
end
end
-- --
-- Write out raw makefile rules for a configuration. -- Write out raw makefile rules for a configuration.
-- --

View File

@ -25,11 +25,11 @@
for cfg in project.eachconfig(prj) do for cfg in project.eachconfig(prj) do
cpp.config(cfg) cpp.config(cfg)
end end
-- list intermediate files -- list intermediate files
cpp.objects(prj) cpp.objects(prj)
make.detectshell() make.detectshell()
-- common build target rules -- common build target rules
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)') _p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
@ -40,7 +40,7 @@
make.mkdirrule("$(TARGETDIR)") make.mkdirrule("$(TARGETDIR)")
make.mkdirrule("$(OBJDIR)") make.mkdirrule("$(OBJDIR)")
-- clean target -- clean target
_p('clean:') _p('clean:')
_p('\t@echo Cleaning %s', prj.name) _p('\t@echo Cleaning %s', prj.name)
@ -67,7 +67,7 @@
-- file building rules -- file building rules
cpp.filerules(prj) cpp.filerules(prj)
-- include the dependencies, built by GCC (with the -MMD flag) -- include the dependencies, built by GCC (with the -MMD flag)
_p('-include $(OBJECTS:%%.o=%%.d)') _p('-include $(OBJECTS:%%.o=%%.d)')
_p('ifneq (,$(PCH))') _p('ifneq (,$(PCH))')
@ -86,7 +86,7 @@
if not toolset then if not toolset then
error("Invalid toolset '" + cfg.toolset + "'") error("Invalid toolset '" + cfg.toolset + "'")
end end
_p('ifeq ($(config),%s)', make.esc(cfg.shortname)) _p('ifeq ($(config),%s)', make.esc(cfg.shortname))
-- write toolset specific configurations -- write toolset specific configurations
@ -94,7 +94,7 @@
-- write target information (target dir, name, obj dir) -- write target information (target dir, name, obj dir)
make.targetconfig(cfg) make.targetconfig(cfg)
-- write flags -- write flags
cpp.flags(cfg, toolset) cpp.flags(cfg, toolset)
@ -104,7 +104,7 @@
-- write the link step -- write the link step
cpp.linkconfig(cfg, toolset) cpp.linkconfig(cfg, toolset)
-- write the custom build commands -- write the custom build commands
_p(' define PREBUILDCMDS') _p(' define PREBUILDCMDS')
if #cfg.prebuildcommands > 0 then if #cfg.prebuildcommands > 0 then
_p('\t@echo Running pre-build commands') _p('\t@echo Running pre-build commands')
@ -126,15 +126,15 @@
end end
_p(' endef') _p(' endef')
_p('') _p('')
-- write the target building rule -- write the target building rule
cpp.targetrules(cfg) cpp.targetrules(cfg)
-- write out config-level makesettings blocks -- write out config-level makesettings blocks
make.settings(cfg, toolset) make.settings(cfg, toolset)
_p('endif') _p('endif')
_p('') _p('')
end end
@ -143,7 +143,7 @@
-- --
function cpp.buildcommand(prj, objext) function cpp.buildcommand(prj, objext)
local flags = iif(prj.language == "C", '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)') local flags = iif(prj.language == "C", '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)')
_p('\t$(SILENT) %s -o "$@" -MF $(@:%%.%s=%%.d) -c "$<"', flags, objext) _p('\t$(SILENT) %s -o "$@" -MF $(@:%%.%s=%%.d) -c "$<"', flags, objext)
end end
@ -185,13 +185,13 @@
_p('$(OBJDIR)/%s.o: %s', make.esc(objectname), make.esc(node.relpath)) _p('$(OBJDIR)/%s.o: %s', make.esc(objectname), make.esc(node.relpath))
_p('\t@echo $(notdir $<)') _p('\t@echo $(notdir $<)')
cpp.buildcommand(prj, "o") cpp.buildcommand(prj, "o")
-- resource file -- resource file
elseif path.isresourcefile(node.abspath) then elseif path.isresourcefile(node.abspath) then
local objectname = project.getfileobject(prj, node.abspath) local objectname = project.getfileobject(prj, node.abspath)
_p('$(OBJDIR)/%s.res: %s', make.esc(objectname), make.esc(node.relpath)) _p('$(OBJDIR)/%s.res: %s', make.esc(objectname), make.esc(node.relpath))
_p('\t@echo $(notdir $<)') _p('\t@echo $(notdir $<)')
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(RESFLAGS)') _p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)')
end end
end end
@ -200,7 +200,7 @@
local filecfg = config.getfileconfig(cfg, node.abspath) local filecfg = config.getfileconfig(cfg, node.abspath)
if filecfg then if filecfg then
local rule = filecfg.buildrule local rule = filecfg.buildrule
_p('ifeq ($(config),%s)', make.esc(cfg.shortname)) _p('ifeq ($(config),%s)', make.esc(cfg.shortname))
_p('%s: %s', make.esc(rule.outputs[1]), make.esc(filecfg.relpath)) _p('%s: %s', make.esc(rule.outputs[1]), make.esc(filecfg.relpath))
_p('\t@echo "%s"', rule.description or ("Building " .. filecfg.relpath)) _p('\t@echo "%s"', rule.description or ("Building " .. filecfg.relpath))
@ -211,25 +211,25 @@
end end
end end
end end
-- --
-- Compile flags -- Compile flags
-- --
function cpp.flags(cfg, toolset) function cpp.flags(cfg, toolset)
_p(' DEFINES += %s', table.concat(toolset.getdefines(cfg.defines), " ")) _p(' DEFINES +=%s', make.list(cfg.defines))
local includes = make.esc(toolset.getincludedirs(cfg, cfg.includedirs)) local includes = make.esc(toolset.getincludedirs(cfg, cfg.includedirs))
_p(' INCLUDES += %s', table.concat(includes, " ")) _p(' INCLUDES +=%s', make.list(includes))
_p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(toolset.getcppflags(cfg), " ")) _p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(toolset.getcppflags(cfg), " "))
_p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), " ")) _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(toolset.getcflags(cfg), cfg.buildoptions)))
_p(' CXXFLAGS += $(CFLAGS) %s', table.concat(toolset.getcxxflags(cfg), " ")) _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(toolset.getcxxflags(cfg)))
_p(' LDFLAGS += %s', table.concat(table.join(toolset.getldflags(cfg), cfg.linkoptions), " ")) _p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(toolset.getldflags(cfg), cfg.linkoptions)))
local resflags = table.join(toolset.getdefines(cfg.resdefines), toolset.getincludedirs(cfg, cfg.resincludedirs), cfg.resoptions) local resflags = table.join(toolset.getdefines(cfg.resdefines), toolset.getincludedirs(cfg, cfg.resincludedirs), cfg.resoptions)
_p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(resflags, " ")) _p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s', make.list(resflags))
end end
@ -239,10 +239,10 @@
function cpp.linkconfig(cfg, toolset) function cpp.linkconfig(cfg, toolset)
local flags = toolset.getlinks(cfg) local flags = toolset.getlinks(cfg)
_p(' LIBS += %s', table.concat(flags, " ")) _p(' LIBS +=%s', make.list(flags))
local deps = config.getlinks(cfg, "siblings", "fullpath") local deps = config.getlinks(cfg, "siblings", "fullpath")
_p(' LDDEPS += %s', table.concat(make.esc(deps), " ")) _p(' LDDEPS +=%s', make.list(make.esc(deps)))
if cfg.kind == premake.STATICLIB then if cfg.kind == premake.STATICLIB then
if cfg.architecture == premake.UNIVERSAL then if cfg.architecture == premake.UNIVERSAL then
@ -255,7 +255,7 @@
-- Had trouble linking to certain static libs, so $(OBJECTS) moved up. -- Had trouble linking to certain static libs, so $(OBJECTS) moved up.
-- $(LDFLAGS) moved: https://sf.net/tracker/?func=detail&aid=3430158&group_id=71616&atid=531880 -- $(LDFLAGS) moved: https://sf.net/tracker/?func=detail&aid=3430158&group_id=71616&atid=531880
local cc = iif(cfg.project.language == "C", "CC", "CXX") local cc = iif(cfg.project.language == "C", "CC", "CXX")
_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)', cc) _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS)', cc)
end end
end end
@ -268,7 +268,7 @@
-- create lists for intermediate files, at the project level and -- create lists for intermediate files, at the project level and
-- for each configuration -- for each configuration
local root = { objects={}, resources={} } local root = { objects={}, resources={} }
local configs = {} local configs = {}
for cfg in project.eachconfig(prj) do for cfg in project.eachconfig(prj) do
configs[cfg] = { objects={}, resources={} } configs[cfg] = { objects={}, resources={} }
end end
@ -300,7 +300,7 @@
elseif path.isresourcefile(node.abspath) then elseif path.isresourcefile(node.abspath) then
kind = "resources" kind = "resources"
end end
-- skip files that aren't compiled -- skip files that aren't compiled
if not custom and not kind then if not custom and not kind then
return return
@ -309,7 +309,7 @@
-- assign a unique object file name to avoid collisions -- assign a unique object file name to avoid collisions
local objectname = project.getfileobject(prj, node.abspath) local objectname = project.getfileobject(prj, node.abspath)
objectname = "$(OBJDIR)/" .. objectname .. iif(kind == "objects", ".o", ".res") objectname = "$(OBJDIR)/" .. objectname .. iif(kind == "objects", ".o", ".res")
-- if this file exists in all configurations, write it to -- if this file exists in all configurations, write it to
-- the project's list of files, else add to specific cfgs -- the project's list of files, else add to specific cfgs
if inall then if inall then
@ -325,7 +325,7 @@
else else
for cfg in project.eachconfig(prj) do for cfg in project.eachconfig(prj) do
local filecfg = incfg[cfg] local filecfg = incfg[cfg]
if filecfg then if filecfg then
-- if the custom build outputs an object file, add it to -- if the custom build outputs an object file, add it to
-- the link step automatically to match Visual Studio -- the link step automatically to match Visual Studio
local output = filecfg.buildrule.outputs[1] local output = filecfg.buildrule.outputs[1]
@ -335,10 +335,10 @@
end end
end end
end end
end end
}) })
-- now I can write out the lists, project level first... -- now I can write out the lists, project level first...
function listobjects(var, list) function listobjects(var, list)
_p('%s \\', var) _p('%s \\', var)
@ -347,10 +347,10 @@
end end
_p('') _p('')
end end
listobjects('OBJECTS :=', root.objects, 'o') listobjects('OBJECTS :=', root.objects, 'o')
listobjects('RESOURCES :=', root.resources, 'res') listobjects('RESOURCES :=', root.resources, 'res')
-- ...then individual configurations, as needed -- ...then individual configurations, as needed
for cfg in project.eachconfig(prj) do for cfg in project.eachconfig(prj) do
local files = configs[cfg] local files = configs[cfg]
@ -390,7 +390,7 @@
local gch = make.esc(path.getname(pchheader)) local gch = make.esc(path.getname(pchheader))
_p(' PCH = %s', make.esc(project.getrelative(cfg.project, pchheader))) _p(' PCH = %s', make.esc(project.getrelative(cfg.project, pchheader)))
_p(' GCH = $(OBJDIR)/%s.gch', gch) _p(' GCH = $(OBJDIR)/%s.gch', gch)
_p(' CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', gch) _p(' ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', gch)
end end
end end
@ -415,14 +415,14 @@
function cpp.targetrules(cfg) function cpp.targetrules(cfg)
local macapp = (cfg.system == premake.MACOSX and cfg.kind == premake.WINDOWEDAPP) local macapp = (cfg.system == premake.MACOSX and cfg.kind == premake.WINDOWEDAPP)
if macapp then if macapp then
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist') _p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
else else
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)') _p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
end end
_p('\t@:') _p('\t@:')
if macapp then if macapp then
_p('') _p('')
_p('$(dir $(TARGETDIR))PkgInfo:') _p('$(dir $(TARGETDIR))PkgInfo:')

View File

@ -11,15 +11,15 @@
-- --
-- Setup -- Setup
-- --
local sln, prj local sln, prj
function suite.setup() function suite.setup()
sln = test.createsolution() sln = test.createsolution()
end end
local function prepare() local function prepare()
prj = premake.solution.getproject_ng(sln, 1) prj = premake.solution.getproject_ng(sln, 1)
cpp.filerules(prj) cpp.filerules(prj)
@ -36,10 +36,10 @@
test.capture [[ test.capture [[
$(OBJDIR)/hello.o: src/greetings/hello.cpp $(OBJDIR)/hello.o: src/greetings/hello.cpp
@echo $(notdir $<) @echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<" $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
$(OBJDIR)/hello1.o: src/hello.cpp $(OBJDIR)/hello1.o: src/hello.cpp
@echo $(notdir $<) @echo $(notdir $<)
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<" $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.o=%.d) -c "$<"
]] ]]
end end
@ -54,8 +54,8 @@ $(OBJDIR)/hello1.o: src/hello.cpp
configuration "**.x" configuration "**.x"
buildrule { buildrule {
description = "Compiling %{file.name}", description = "Compiling %{file.name}",
commands = { commands = {
'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"', 'cxc -c "%{file.path}" -o "%{cfg.objdir}/%{file.basename}.xo"',
'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"' 'c2o -c "%{cfg.objdir}/%{file.basename}.xo" -o "%{cfg.objdir}/%{file.basename}.obj"'
}, },
outputs = { "%{cfg.objdir}/%{file.basename}.obj" } outputs = { "%{cfg.objdir}/%{file.basename}.obj" }

View File

@ -3,7 +3,7 @@
-- Tests compiler and linker flags for Makefiles. -- Tests compiler and linker flags for Makefiles.
-- Copyright (c) 2012 Jason Perkins and the Premake project -- Copyright (c) 2012 Jason Perkins and the Premake project
-- --
T.make_flags = {} T.make_flags = {}
local suite = T.make_flags local suite = T.make_flags
local make = premake.make local make = premake.make
@ -14,7 +14,7 @@
-- --
-- Setup -- Setup
-- --
local sln, prj, cfg local sln, prj, cfg
function suite.setup() function suite.setup()
@ -26,7 +26,7 @@
cfg = project.getconfig(prj, "Debug") cfg = project.getconfig(prj, "Debug")
cpp.flags(cfg, premake.tools.gcc) cpp.flags(cfg, premake.tools.gcc)
end end
-- --
-- Include directories should be relative and space separated. -- Include directories should be relative and space separated.
@ -36,7 +36,7 @@
includedirs { "src/include", "../include" } includedirs { "src/include", "../include" }
prepare() prepare()
test.capture [[ test.capture [[
DEFINES += DEFINES +=
INCLUDES += -Isrc/include -I../include INCLUDES += -Isrc/include -I../include
]] ]]
end end

View File

@ -7,8 +7,8 @@
T.make_linking = { } T.make_linking = { }
local suite = T.make_linking local suite = T.make_linking
local cpp = premake.make.cpp local cpp = premake.make.cpp
local project = premake5.project local project = premake5.project
-- --
-- Setup and teardown -- Setup and teardown
@ -35,9 +35,9 @@
kind "SharedLib" kind "SharedLib"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += LIBS +=
LDDEPS += LDDEPS +=
LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS) LINKCMD = $(CXX) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS)
]] ]]
end end
@ -51,9 +51,9 @@
kind "SharedLib" kind "SharedLib"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += LIBS +=
LDDEPS += LDDEPS +=
LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS) LINKCMD = $(CC) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(ALL_LDFLAGS)
]] ]]
end end
@ -66,8 +66,8 @@
kind "StaticLib" kind "StaticLib"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += LIBS +=
LDDEPS += LDDEPS +=
LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS) LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)
]] ]]
end end
@ -82,8 +82,8 @@
kind "StaticLib" kind "StaticLib"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += LIBS +=
LDDEPS += LDDEPS +=
LINKCMD = libtool -o $(TARGET) $(OBJECTS) LINKCMD = libtool -o $(TARGET) $(OBJECTS)
]] ]]
end end
@ -95,11 +95,11 @@
function suite.links_onSiblingStaticLib() function suite.links_onSiblingStaticLib()
links "MyProject2" links "MyProject2"
test.createproject(sln) test.createproject(sln)
kind "StaticLib" kind "StaticLib"
location "build" location "build"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += build/libMyProject2.a LIBS += build/libMyProject2.a
@ -114,11 +114,11 @@
function suite.links_onSiblingSharedLib() function suite.links_onSiblingSharedLib()
links "MyProject2" links "MyProject2"
test.createproject(sln) test.createproject(sln)
kind "SharedLib" kind "SharedLib"
location "build" location "build"
prepare() prepare()
test.capture [[ test.capture [[
LIBS += -lMyProject2 LIBS += -lMyProject2

View File

@ -8,8 +8,8 @@
local suite = T.make_pch local suite = T.make_pch
local cpp = premake.make.cpp local cpp = premake.make.cpp
local project = premake5.project local project = premake5.project
-- --
-- Setup and teardown -- Setup and teardown
@ -19,7 +19,7 @@
function suite.setup() function suite.setup()
sln, prj = test.createsolution() sln, prj = test.createsolution()
end end
local function prepare() local function prepare()
cfg = project.getconfig(prj, "Debug") cfg = project.getconfig(prj, "Debug")
end end
@ -28,7 +28,7 @@
-- --
-- If no header has been set, nothing should be output. -- If no header has been set, nothing should be output.
-- --
function suite.noConfig_onNoHeaderSet() function suite.noConfig_onNoHeaderSet()
prepare() prepare()
cpp.pchconfig(cfg) cpp.pchconfig(cfg)
@ -62,7 +62,7 @@
test.capture [[ test.capture [[
PCH = include/myproject.h PCH = include/myproject.h
GCH = $(OBJDIR)/myproject.h.gch GCH = $(OBJDIR)/myproject.h.gch
CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/myproject.h ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/myproject.h
]] ]]
end end
@ -79,12 +79,12 @@
test.capture [[ test.capture [[
PCH = ../src/host/premake.h PCH = ../src/host/premake.h
GCH = $(OBJDIR)/premake.h.gch GCH = $(OBJDIR)/premake.h.gch
CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/premake.h ALL_CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/premake.h
]] ]]
end end
-- --
-- Verify the format of the PCH rules block for a C++ file. -- Verify the format of the PCH rules block for a C++ file.
-- --
@ -101,13 +101,13 @@ ifeq (posix,$(SHELLTYPE))
else else
$(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
endif endif
$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" $(SILENT) $(CXX) $(ALL_CXXFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<"
endif endif
]] ]]
end end
-- --
-- Verify the format of the PCH rules block for a C file. -- Verify the format of the PCH rules block for a C file.
-- --
@ -125,7 +125,7 @@ ifeq (posix,$(SHELLTYPE))
else else
$(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul $(SILENT) xcopy /D /Y /Q "$(subst /,\,$<)" "$(subst /,\,$(OBJDIR))" 1>nul
endif endif
$(SILENT) $(CC) $(CFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<" $(SILENT) $(CC) $(ALL_CFLAGS) -o "$@" -MF $(@:%.gch=%.d) -c "$<"
endif endif
]] ]]
end end

View File

@ -3,7 +3,7 @@
-- Tests for Wii homebrew support in makefiles. -- Tests for Wii homebrew support in makefiles.
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project -- Copyright (c) 2011-2012 Jason Perkins and the Premake project
-- --
T.make_wiidev = {} T.make_wiidev = {}
local suite = T.make_wiidev local suite = T.make_wiidev
local make = premake.make local make = premake.make
@ -14,7 +14,7 @@
-- --
-- Setup -- Setup
-- --
local sln, prj, cfg local sln, prj, cfg
function suite.setup() function suite.setup()
@ -31,13 +31,13 @@
function suite.writesCorrectFlags() function suite.writesCorrectFlags()
cpp.flags(cfg, premake.tools.gcc) cpp.flags(cfg, premake.tools.gcc)
test.capture [[ test.capture [[
DEFINES += DEFINES +=
INCLUDES += INCLUDES +=
CPPFLAGS += -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) $(DEFINES) $(INCLUDES) ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) $(DEFINES) $(INCLUDES)
CFLAGS += $(CPPFLAGS) $(ARCH) ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)
CXXFLAGS += $(CFLAGS) ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)
LDFLAGS += -s -L$(LIBOGC_LIB) $(MACHDEP) ALL_LDFLAGS += $(LDFLAGS) -s -L$(LIBOGC_LIB) $(MACHDEP)
RESFLAGS += $(DEFINES) $(INCLUDES) ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
]] ]]
end end