2009-04-11 11:33:32 +00:00
|
|
|
--
|
|
|
|
-- make_cpp.lua
|
|
|
|
-- Generate a C/C++ project makefile.
|
2011-09-15 20:45:48 +00:00
|
|
|
-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
|
2009-04-11 11:33:32 +00:00
|
|
|
--
|
|
|
|
|
2012-09-27 14:16:42 +00:00
|
|
|
premake.make.cpp = {}
|
2011-09-15 20:45:48 +00:00
|
|
|
local make = premake.make
|
2012-04-30 20:42:03 +00:00
|
|
|
local cpp = premake.make.cpp
|
2012-05-18 00:41:28 +00:00
|
|
|
local project = premake5.project
|
|
|
|
local config = premake5.config
|
2012-04-30 20:42:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Generate a GNU make C++ project makefile, with support for the new platforms API.
|
|
|
|
--
|
|
|
|
|
2012-05-08 22:08:42 +00:00
|
|
|
function make.cpp.generate(prj)
|
2012-09-27 14:16:42 +00:00
|
|
|
make.header(prj)
|
2012-05-08 22:08:42 +00:00
|
|
|
|
2012-06-22 21:15:17 +00:00
|
|
|
-- main build rule(s)
|
|
|
|
_p('.PHONY: clean prebuild prelink')
|
|
|
|
_p('')
|
|
|
|
|
2012-05-18 00:41:28 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
cpp.config(cfg)
|
2012-05-08 22:08:42 +00:00
|
|
|
end
|
2012-05-18 00:41:28 +00:00
|
|
|
|
2012-05-08 22:08:42 +00:00
|
|
|
-- list intermediate files
|
2012-06-15 22:42:10 +00:00
|
|
|
cpp.objects(prj)
|
|
|
|
|
2012-05-08 22:08:42 +00:00
|
|
|
-- identify the shell type
|
|
|
|
_p('SHELLTYPE := msdos')
|
|
|
|
_p('ifeq (,$(ComSpec)$(COMSPEC))')
|
|
|
|
_p(' SHELLTYPE := posix')
|
|
|
|
_p('endif')
|
|
|
|
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
|
|
|
|
_p(' SHELLTYPE := posix')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
|
2012-06-22 21:15:17 +00:00
|
|
|
-- common build target rules
|
2012-05-08 22:08:42 +00:00
|
|
|
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
|
|
|
|
_p('\t@echo Linking %s', prj.name)
|
|
|
|
_p('\t$(SILENT) $(LINKCMD)')
|
|
|
|
_p('\t$(POSTBUILDCMDS)')
|
|
|
|
_p('')
|
|
|
|
|
2012-06-22 21:15:17 +00:00
|
|
|
make.mkdirrule("$(TARGETDIR)")
|
|
|
|
make.mkdirrule("$(OBJDIR)")
|
2012-05-18 00:41:28 +00:00
|
|
|
|
2012-05-08 22:08:42 +00:00
|
|
|
-- clean target
|
|
|
|
_p('clean:')
|
|
|
|
_p('\t@echo Cleaning %s', prj.name)
|
|
|
|
_p('ifeq (posix,$(SHELLTYPE))')
|
|
|
|
_p('\t$(SILENT) rm -f $(TARGET)')
|
|
|
|
_p('\t$(SILENT) rm -rf $(OBJDIR)')
|
|
|
|
_p('else')
|
|
|
|
_p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGET)) del $(subst /,\\\\,$(TARGET))')
|
|
|
|
_p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
|
|
|
|
-- custom build step targets
|
|
|
|
_p('prebuild:')
|
|
|
|
_p('\t$(PREBUILDCMDS)')
|
|
|
|
_p('')
|
|
|
|
|
|
|
|
_p('prelink:')
|
|
|
|
_p('\t$(PRELINKCMDS)')
|
|
|
|
_p('')
|
|
|
|
|
|
|
|
-- precompiler header rule
|
|
|
|
cpp.pchrules(prj)
|
|
|
|
|
2012-06-19 19:58:16 +00:00
|
|
|
-- file building rules
|
|
|
|
cpp.filerules(prj)
|
|
|
|
|
2012-05-08 22:08:42 +00:00
|
|
|
-- include the dependencies, built by GCC (with the -MMD flag)
|
|
|
|
_p('-include $(OBJECTS:%%.o=%%.d)')
|
2012-09-06 22:43:02 +00:00
|
|
|
_p('ifneq (,$(PCH))')
|
|
|
|
_p(' -include $(OBJDIR)/$(notdir $(PCH)).d')
|
|
|
|
_p('endif')
|
2012-04-30 20:42:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-05-18 00:41:28 +00:00
|
|
|
--
|
|
|
|
-- Write out the settings for a particular configuration.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.config(cfg)
|
|
|
|
-- identify the toolset used by this configurations
|
|
|
|
local toolset = premake.tools[cfg.toolset or "gcc"]
|
|
|
|
if not toolset then
|
|
|
|
error("Invalid toolset '" + cfg.toolset + "'")
|
|
|
|
end
|
|
|
|
|
|
|
|
_p('ifeq ($(config),%s)', make.esc(cfg.shortname))
|
2012-06-14 19:55:46 +00:00
|
|
|
|
|
|
|
-- write toolset specific configurations
|
|
|
|
cpp.toolconfig(cfg, toolset)
|
2012-05-18 00:41:28 +00:00
|
|
|
|
2012-06-14 20:30:48 +00:00
|
|
|
-- write target information (target dir, name, obj dir)
|
2012-09-28 14:35:13 +00:00
|
|
|
make.targetconfig(cfg)
|
2012-06-12 19:57:45 +00:00
|
|
|
|
|
|
|
-- write flags
|
2012-06-13 22:29:51 +00:00
|
|
|
cpp.flags(cfg, toolset)
|
2012-05-18 00:41:28 +00:00
|
|
|
|
|
|
|
-- set up precompiled headers
|
|
|
|
cpp.pchconfig(cfg)
|
|
|
|
|
2012-06-13 19:21:22 +00:00
|
|
|
-- write the link step
|
|
|
|
cpp.linkconfig(cfg, toolset)
|
2012-05-18 00:41:28 +00:00
|
|
|
|
2012-06-13 19:21:22 +00:00
|
|
|
-- write the custom build commands
|
2012-05-18 00:41:28 +00:00
|
|
|
_p(' define PREBUILDCMDS')
|
|
|
|
if #cfg.prebuildcommands > 0 then
|
|
|
|
_p('\t@echo Running pre-build commands')
|
|
|
|
_p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
|
|
|
|
|
|
|
_p(' define PRELINKCMDS')
|
|
|
|
if #cfg.prelinkcommands > 0 then
|
|
|
|
_p('\t@echo Running pre-link commands')
|
|
|
|
_p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
|
|
|
|
|
|
|
_p(' define POSTBUILDCMDS')
|
|
|
|
if #cfg.postbuildcommands > 0 then
|
|
|
|
_p('\t@echo Running post-build commands')
|
|
|
|
_p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
2012-06-22 21:15:17 +00:00
|
|
|
_p('')
|
|
|
|
|
|
|
|
-- write the target building rule
|
2012-06-28 18:21:55 +00:00
|
|
|
cpp.targetrules(cfg)
|
2012-06-22 21:15:17 +00:00
|
|
|
|
2012-05-18 00:41:28 +00:00
|
|
|
-- write out config-level makesettings blocks
|
2012-06-13 22:29:51 +00:00
|
|
|
make.settings(cfg, toolset)
|
2012-05-18 00:41:28 +00:00
|
|
|
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-14 19:55:46 +00:00
|
|
|
--
|
|
|
|
-- Build command for a single file.
|
|
|
|
--
|
|
|
|
|
2012-09-05 22:37:53 +00:00
|
|
|
function cpp.buildcommand(prj, objext)
|
2012-06-14 19:55:46 +00:00
|
|
|
local flags = iif(prj.language == "C", '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)')
|
2012-09-05 22:37:53 +00:00
|
|
|
_p('\t$(SILENT) %s -o "$@" -MF $(@:%%.%s=%%.d) -c "$<"', flags, objext)
|
2012-06-14 19:55:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-19 19:58:16 +00:00
|
|
|
--
|
|
|
|
-- Output the list of file building rules.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.filerules(prj)
|
|
|
|
local tr = project.getsourcetree(prj)
|
|
|
|
premake.tree.traverse(tr, {
|
|
|
|
onleaf = function(node, depth)
|
2012-06-29 13:05:20 +00:00
|
|
|
-- check to see if this file has custom rules
|
|
|
|
local rules
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
local filecfg = config.getfileconfig(cfg, node.abspath)
|
|
|
|
if filecfg and filecfg.buildrule then
|
|
|
|
rules = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- if it has custom rules, need to break them out
|
|
|
|
-- into individual configurations
|
|
|
|
if rules then
|
|
|
|
cpp.customfilerules(prj, node)
|
|
|
|
else
|
|
|
|
cpp.standardfilerules(prj, node)
|
2012-06-19 19:58:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
_p('')
|
|
|
|
end
|
|
|
|
|
2012-06-29 13:05:20 +00:00
|
|
|
function cpp.standardfilerules(prj, node)
|
|
|
|
-- C/C++ file
|
|
|
|
if path.iscppfile(node.abspath) then
|
|
|
|
local objectname = project.getfileobject(prj, node.abspath)
|
|
|
|
_p('$(OBJDIR)/%s.o: %s', make.esc(objectname), make.esc(node.relpath))
|
|
|
|
_p('\t@echo $(notdir $<)')
|
2012-09-05 22:37:53 +00:00
|
|
|
cpp.buildcommand(prj, "o")
|
2012-06-29 13:05:20 +00:00
|
|
|
|
|
|
|
-- resource file
|
|
|
|
elseif path.isresourcefile(node.abspath) then
|
|
|
|
local objectname = project.getfileobject(prj, node.abspath)
|
|
|
|
_p('$(OBJDIR)/%s.res: %s', make.esc(objectname), make.esc(node.relpath))
|
|
|
|
_p('\t@echo $(notdir $<)')
|
|
|
|
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(RESFLAGS)')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function cpp.customfilerules(prj, node)
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
local filecfg = config.getfileconfig(cfg, node.abspath)
|
2012-07-04 18:13:01 +00:00
|
|
|
if filecfg then
|
|
|
|
local rule = filecfg.buildrule
|
|
|
|
|
|
|
|
_p('ifeq ($(config),%s)', make.esc(cfg.shortname))
|
|
|
|
_p('%s: %s', make.esc(rule.outputs[1]), make.esc(filecfg.relpath))
|
|
|
|
_p('\t@echo "%s"', rule.description or ("Building " .. filecfg.relpath))
|
|
|
|
for _, cmd in ipairs(rule.commands) do
|
|
|
|
_p('\t$(SILENT) %s', cmd)
|
|
|
|
end
|
|
|
|
_p('endif')
|
2012-06-29 13:05:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-19 19:58:16 +00:00
|
|
|
|
2012-06-13 22:29:51 +00:00
|
|
|
--
|
|
|
|
-- Compile flags
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.flags(cfg, toolset)
|
|
|
|
_p(' DEFINES += %s', table.concat(toolset.getdefines(cfg.defines), " "))
|
2012-09-13 20:36:53 +00:00
|
|
|
|
|
|
|
local includes = make.esc(toolset.getincludedirs(cfg, cfg.includedirs))
|
|
|
|
_p(' INCLUDES += %s', table.concat(includes, " "))
|
|
|
|
|
2012-06-13 22:29:51 +00:00
|
|
|
_p(' CPPFLAGS += %s $(DEFINES) $(INCLUDES)', table.concat(toolset.getcppflags(cfg), " "))
|
|
|
|
_p(' CFLAGS += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), " "))
|
|
|
|
_p(' CXXFLAGS += $(CFLAGS) %s', table.concat(toolset.getcxxflags(cfg), " "))
|
|
|
|
_p(' LDFLAGS += %s', table.concat(table.join(toolset.getldflags(cfg), cfg.linkoptions), " "))
|
|
|
|
|
2012-06-28 18:17:19 +00:00
|
|
|
local resflags = table.join(toolset.getdefines(cfg.resdefines), toolset.getincludedirs(cfg, cfg.resincludedirs), cfg.resoptions)
|
2012-06-13 22:29:51 +00:00
|
|
|
_p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s', table.concat(resflags, " "))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-13 19:21:22 +00:00
|
|
|
--
|
|
|
|
-- Link step
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.linkconfig(cfg, toolset)
|
|
|
|
local flags = toolset.getlinks(cfg)
|
|
|
|
_p(' LIBS += %s', table.concat(flags, " "))
|
|
|
|
|
|
|
|
local deps = config.getlinks(cfg, "siblings", "fullpath")
|
|
|
|
_p(' LDDEPS += %s', table.concat(make.esc(deps), " "))
|
|
|
|
|
|
|
|
if cfg.kind == premake.STATICLIB then
|
|
|
|
if cfg.architecture == premake.UNIVERSAL then
|
|
|
|
_p(' LINKCMD = libtool -o $(TARGET) $(OBJECTS)')
|
|
|
|
else
|
|
|
|
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
|
|
|
|
end
|
|
|
|
else
|
|
|
|
-- This started as: $(TARGET) $(LDFLAGS) $(OBJECTS).
|
|
|
|
-- 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
|
|
|
|
local cc = iif(cfg.project.language == "C", "CC", "CXX")
|
|
|
|
_p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(LIBS) $(LDFLAGS)', cc)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-15 22:42:10 +00:00
|
|
|
--
|
|
|
|
-- List the objects file for the project, and each configuration.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.objects(prj)
|
2012-06-22 13:27:03 +00:00
|
|
|
-- create lists for intermediate files, at the project level and
|
|
|
|
-- for each configuration
|
|
|
|
local root = { objects={}, resources={} }
|
|
|
|
local configs = {}
|
2012-06-15 22:42:10 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
2012-06-22 13:27:03 +00:00
|
|
|
configs[cfg] = { objects={}, resources={} }
|
2012-06-15 22:42:10 +00:00
|
|
|
end
|
2012-06-22 13:27:03 +00:00
|
|
|
|
|
|
|
-- now walk the list of files in the project
|
2012-06-15 22:42:10 +00:00
|
|
|
local tr = project.getsourcetree(prj)
|
|
|
|
premake.tree.traverse(tr, {
|
|
|
|
onleaf = function(node, depth)
|
2012-06-29 13:05:20 +00:00
|
|
|
-- figure out what configurations contain this file, and
|
|
|
|
-- if it uses custom build rules
|
2012-07-04 16:52:25 +00:00
|
|
|
local incfg = {}
|
2012-06-29 13:05:20 +00:00
|
|
|
local inall = true
|
|
|
|
local custom = false
|
2012-06-15 22:42:10 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
local filecfg = config.getfileconfig(cfg, node.abspath)
|
2012-06-29 13:05:20 +00:00
|
|
|
if filecfg then
|
|
|
|
incfg[cfg] = filecfg
|
|
|
|
custom = (filecfg.buildrule ~= nil)
|
|
|
|
else
|
|
|
|
inall = false
|
2012-06-15 22:42:10 +00:00
|
|
|
end
|
|
|
|
end
|
2012-06-22 13:27:03 +00:00
|
|
|
|
2012-06-29 13:05:20 +00:00
|
|
|
if not custom then
|
|
|
|
-- identify the file type
|
|
|
|
local kind
|
|
|
|
if path.iscppfile(node.abspath) then
|
|
|
|
kind = "objects"
|
|
|
|
elseif path.isresourcefile(node.abspath) then
|
|
|
|
kind = "resources"
|
|
|
|
end
|
|
|
|
|
|
|
|
-- skip files that aren't compiled
|
|
|
|
if not custom and not kind then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- assign a unique object file name to avoid collisions
|
|
|
|
local objectname = project.getfileobject(prj, node.abspath)
|
|
|
|
objectname = "$(OBJDIR)/" .. objectname .. iif(kind == "objects", ".o", ".res")
|
|
|
|
|
|
|
|
-- if this file exists in all configurations, write it to
|
|
|
|
-- the project's list of files, else add to specific cfgs
|
|
|
|
if inall then
|
|
|
|
table.insert(root[kind], objectname)
|
|
|
|
else
|
|
|
|
for cfg in project.eachconfig(prj) do
|
|
|
|
if incfg[cfg] then
|
|
|
|
table.insert(configs[cfg][kind], objectname)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-06-15 22:42:10 +00:00
|
|
|
else
|
|
|
|
for cfg in project.eachconfig(prj) do
|
2012-06-29 13:05:20 +00:00
|
|
|
local filecfg = incfg[cfg]
|
|
|
|
if filecfg then
|
|
|
|
-- if the custom build outputs an object file, add it to
|
|
|
|
-- the link step automatically to match Visual Studio
|
|
|
|
local output = filecfg.buildrule.outputs[1]
|
|
|
|
if path.isobjectfile(output) then
|
|
|
|
table.insert(configs[cfg].objects, output)
|
|
|
|
end
|
2012-06-15 22:42:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-06-29 13:05:20 +00:00
|
|
|
|
2012-06-15 22:42:10 +00:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2012-06-22 13:27:03 +00:00
|
|
|
-- now I can write out the lists, project level first...
|
2012-06-29 13:05:20 +00:00
|
|
|
function listobjects(var, list)
|
2012-06-22 13:27:03 +00:00
|
|
|
_p('%s \\', var)
|
|
|
|
for _, objectname in ipairs(list) do
|
2012-06-29 13:05:20 +00:00
|
|
|
_p('\t%s \\', make.esc(objectname))
|
2012-06-22 13:27:03 +00:00
|
|
|
end
|
|
|
|
_p('')
|
|
|
|
end
|
|
|
|
|
|
|
|
listobjects('OBJECTS :=', root.objects, 'o')
|
|
|
|
listobjects('RESOURCES :=', root.resources, 'res')
|
|
|
|
|
|
|
|
-- ...then individual configurations, as needed
|
2012-06-15 22:42:10 +00:00
|
|
|
for cfg in project.eachconfig(prj) do
|
2012-06-22 13:27:03 +00:00
|
|
|
local files = configs[cfg]
|
|
|
|
if #files.objects > 0 or #files.resources > 0 then
|
2012-06-15 22:42:10 +00:00
|
|
|
_p('ifeq ($(config),%s)', make.esc(cfg.shortname))
|
2012-06-22 13:27:03 +00:00
|
|
|
if #files.objects > 0 then
|
2012-06-29 13:05:20 +00:00
|
|
|
listobjects(' OBJECTS +=', files.objects)
|
2012-06-22 13:27:03 +00:00
|
|
|
end
|
|
|
|
if #files.resources > 0 then
|
2012-06-29 13:05:20 +00:00
|
|
|
listobjects(' RESOURCES +=', files.resources)
|
2012-06-15 22:42:10 +00:00
|
|
|
end
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
--
|
|
|
|
-- Precompiled header support
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.pchconfig(cfg)
|
|
|
|
if not cfg.flags.NoPCH and cfg.pchheader then
|
|
|
|
-- Visual Studio needs the PCH path to match the way it appears in
|
|
|
|
-- the project's #include statement. GCC needs the full path. Assume
|
|
|
|
-- the #include path is given, is search the include dirs for it.
|
|
|
|
local pchheader = cfg.pchheader
|
|
|
|
for _, incdir in ipairs(cfg.includedirs) do
|
|
|
|
local testname = path.join(incdir, cfg.pchheader)
|
|
|
|
if os.isfile(testname) then
|
|
|
|
pchheader = testname
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local gch = make.esc(path.getname(pchheader))
|
|
|
|
_p(' PCH = %s', make.esc(project.getrelative(cfg.project, pchheader)))
|
|
|
|
_p(' GCH = $(OBJDIR)/%s.gch', gch)
|
|
|
|
_p(' CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', gch)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function cpp.pchrules(prj)
|
|
|
|
_p('ifneq (,$(PCH))')
|
|
|
|
_p('$(GCH): $(PCH)')
|
|
|
|
_p('\t@echo $(notdir $<)')
|
|
|
|
_p('ifeq (posix,$(SHELLTYPE))')
|
|
|
|
_p('\t-$(SILENT) cp $< $(OBJDIR)')
|
|
|
|
_p('else')
|
|
|
|
_p('\t$(SILENT) xcopy /D /Y /Q "$(subst /,\\,$<)" "$(subst /,\\,$(OBJDIR))" 1>nul')
|
|
|
|
_p('endif')
|
2012-09-05 22:37:53 +00:00
|
|
|
cpp.buildcommand(prj, "gch")
|
2012-06-12 19:57:45 +00:00
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-22 21:15:17 +00:00
|
|
|
--
|
|
|
|
-- The main build target rules.
|
|
|
|
--
|
|
|
|
|
|
|
|
function cpp.targetrules(cfg)
|
|
|
|
local macapp = (cfg.system == premake.MACOSX and cfg.kind == premake.WINDOWEDAPP)
|
|
|
|
|
|
|
|
if macapp then
|
|
|
|
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
|
|
|
|
else
|
|
|
|
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
|
|
|
|
end
|
|
|
|
_p('\t@:')
|
|
|
|
|
|
|
|
if macapp then
|
2012-06-28 18:21:55 +00:00
|
|
|
_p('')
|
2012-06-22 21:15:17 +00:00
|
|
|
_p('$(dir $(TARGETDIR))PkgInfo:')
|
|
|
|
_p('$(dir $(TARGETDIR))Info.plist:')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
--
|
2012-06-14 19:55:46 +00:00
|
|
|
-- System specific toolset configuration.
|
2012-06-12 19:57:45 +00:00
|
|
|
--
|
|
|
|
|
2012-06-14 19:55:46 +00:00
|
|
|
function cpp.toolconfig(cfg, toolset)
|
2012-09-27 16:18:03 +00:00
|
|
|
local tool = toolset.gettoolname(cfg, "cc")
|
|
|
|
if tool then
|
|
|
|
_p(' CC = %s', tool)
|
2012-06-14 19:55:46 +00:00
|
|
|
end
|
2012-09-27 16:18:03 +00:00
|
|
|
|
|
|
|
tool = toolset.gettoolname(cfg, "cxx")
|
|
|
|
if tool then
|
|
|
|
_p(' CXX = %s', tool)
|
2012-06-14 19:55:46 +00:00
|
|
|
end
|
2012-09-27 16:18:03 +00:00
|
|
|
|
|
|
|
tool = toolset.gettoolname(cfg, "ar")
|
|
|
|
if tool then
|
|
|
|
_p(' AR = %s', tool)
|
2012-06-14 19:55:46 +00:00
|
|
|
end
|
2012-06-12 19:57:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-04-30 20:42:03 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
-- Everything below this point is a candidate for deprecation
|
|
|
|
-----------------------------------------------------------------------------
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2010-10-19 11:14:46 +00:00
|
|
|
|
2009-04-11 11:33:32 +00:00
|
|
|
function premake.make_cpp(prj)
|
|
|
|
-- create a shortcut to the compiler interface
|
2009-05-12 22:43:06 +00:00
|
|
|
local cc = premake.gettool(prj)
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-20 19:06:48 +00:00
|
|
|
-- build a list of supported target platforms that also includes a generic build
|
2009-04-21 20:00:17 +00:00
|
|
|
local platforms = premake.filterplatforms(prj.solution, cc.platforms, "Native")
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
premake.gmake_cpp_header(prj, cc, platforms)
|
2009-04-11 11:33:32 +00:00
|
|
|
|
2009-04-14 19:41:30 +00:00
|
|
|
for _, platform in ipairs(platforms) do
|
|
|
|
for cfg in premake.eachconfig(prj, platform) do
|
2009-04-24 14:34:54 +00:00
|
|
|
premake.gmake_cpp_config(cfg, cc)
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:33:32 +00:00
|
|
|
-- list intermediate files
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('OBJECTS := \\')
|
2009-04-11 11:33:32 +00:00
|
|
|
for _, file in ipairs(prj.files) do
|
|
|
|
if path.iscppfile(file) then
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('\t$(OBJDIR)/%s.o \\', _MAKE.esc(path.getbasename(file)))
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
|
|
|
end
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('RESOURCES := \\')
|
2009-04-11 11:33:32 +00:00
|
|
|
for _, file in ipairs(prj.files) do
|
|
|
|
if path.isresourcefile(file) then
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('\t$(OBJDIR)/%s.res \\', _MAKE.esc(path.getbasename(file)))
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
|
|
|
end
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-29 17:45:37 +00:00
|
|
|
-- identify the shell type
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('SHELLTYPE := msdos')
|
|
|
|
_p('ifeq (,$(ComSpec)$(COMSPEC))')
|
|
|
|
_p(' SHELLTYPE := posix')
|
|
|
|
_p('endif')
|
|
|
|
_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
|
|
|
|
_p(' SHELLTYPE := posix')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:33:32 +00:00
|
|
|
-- main build rule(s)
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('.PHONY: clean prebuild prelink')
|
|
|
|
_p('')
|
2009-04-11 11:33:32 +00:00
|
|
|
|
|
|
|
if os.is("MacOSX") and prj.kind == "WindowedApp" then
|
2009-05-22 20:27:05 +00:00
|
|
|
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
|
2009-04-11 11:33:32 +00:00
|
|
|
else
|
2009-05-22 20:27:05 +00:00
|
|
|
_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
2010-05-07 14:58:20 +00:00
|
|
|
_p('\t@:')
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('')
|
2009-05-22 20:27:05 +00:00
|
|
|
|
|
|
|
-- target build rule
|
|
|
|
_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('\t@echo Linking %s', prj.name)
|
2009-05-22 18:38:53 +00:00
|
|
|
_p('\t$(SILENT) $(LINKCMD)')
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('\t$(POSTBUILDCMDS)')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-29 17:45:37 +00:00
|
|
|
-- Create destination directories. Can't use $@ for this because it loses the
|
|
|
|
-- escaping, causing issues with spaces and parenthesis
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('$(TARGETDIR):')
|
2009-05-29 17:45:37 +00:00
|
|
|
premake.make_mkdirrule("$(TARGETDIR)")
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('$(OBJDIR):')
|
2009-05-29 17:45:37 +00:00
|
|
|
premake.make_mkdirrule("$(OBJDIR)")
|
2009-04-11 11:33:32 +00:00
|
|
|
|
|
|
|
-- Mac OS X specific targets
|
|
|
|
if os.is("MacOSX") and prj.kind == "WindowedApp" then
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('$(dir $(TARGETDIR))PkgInfo:')
|
|
|
|
_p('$(dir $(TARGETDIR))Info.plist:')
|
|
|
|
_p('')
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- clean target
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('clean:')
|
|
|
|
_p('\t@echo Cleaning %s', prj.name)
|
|
|
|
_p('ifeq (posix,$(SHELLTYPE))')
|
|
|
|
_p('\t$(SILENT) rm -f $(TARGET)')
|
|
|
|
_p('\t$(SILENT) rm -rf $(OBJDIR)')
|
|
|
|
_p('else')
|
|
|
|
_p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGET)) del $(subst /,\\\\,$(TARGET))')
|
|
|
|
_p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2009-04-11 11:33:32 +00:00
|
|
|
|
|
|
|
-- custom build step targets
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('prebuild:')
|
|
|
|
_p('\t$(PREBUILDCMDS)')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('prelink:')
|
|
|
|
_p('\t$(PRELINKCMDS)')
|
|
|
|
_p('')
|
2009-05-22 20:27:05 +00:00
|
|
|
|
|
|
|
-- precompiler header rule
|
2011-09-15 20:45:48 +00:00
|
|
|
cpp.pchrules(prj)
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:33:32 +00:00
|
|
|
-- per-file rules
|
|
|
|
for _, file in ipairs(prj.files) do
|
|
|
|
if path.iscppfile(file) then
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
|
|
|
|
_p('\t@echo $(notdir $<)')
|
2012-06-12 19:57:45 +00:00
|
|
|
cpp.buildcommand_old(path.iscfile(file))
|
2009-04-11 11:33:32 +00:00
|
|
|
elseif (path.getextension(file) == ".rc") then
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
|
|
|
|
_p('\t@echo $(notdir $<)')
|
2011-12-21 20:52:26 +00:00
|
|
|
_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(RESFLAGS)')
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
|
|
|
end
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-11 11:33:32 +00:00
|
|
|
-- include the dependencies, built by GCC (with the -MMD flag)
|
2009-04-11 11:49:07 +00:00
|
|
|
_p('-include $(OBJECTS:%%.o=%%.d)')
|
2009-04-11 11:33:32 +00:00
|
|
|
end
|
2009-04-23 18:26:31 +00:00
|
|
|
|
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Write the makefile header
|
|
|
|
--
|
|
|
|
|
|
|
|
function premake.gmake_cpp_header(prj, cc, platforms)
|
2009-08-11 00:11:48 +00:00
|
|
|
_p('# %s project makefile autogenerated by Premake', premake.action.current().shortname)
|
2009-05-01 19:50:45 +00:00
|
|
|
|
|
|
|
-- set up the environment
|
|
|
|
_p('ifndef config')
|
|
|
|
_p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
_p('ifndef verbose')
|
|
|
|
_p(' SILENT = @')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
_p('ifndef CC')
|
|
|
|
_p(' CC = %s', cc.cc)
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
_p('ifndef CXX')
|
|
|
|
_p(' CXX = %s', cc.cxx)
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-01 19:50:45 +00:00
|
|
|
_p('ifndef AR')
|
|
|
|
_p(' AR = %s', cc.ar)
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2011-12-21 20:52:26 +00:00
|
|
|
|
|
|
|
_p('ifndef RESCOMP')
|
|
|
|
_p(' ifdef WINDRES')
|
|
|
|
_p(' RESCOMP = $(WINDRES)')
|
|
|
|
_p(' else')
|
|
|
|
_p(' RESCOMP = windres')
|
|
|
|
_p(' endif')
|
|
|
|
_p('endif')
|
|
|
|
_p('')
|
2009-05-01 19:50:45 +00:00
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-23 18:26:31 +00:00
|
|
|
--
|
|
|
|
-- Write a block of configuration settings.
|
|
|
|
--
|
|
|
|
|
2009-04-24 14:34:54 +00:00
|
|
|
function premake.gmake_cpp_config(cfg, cc)
|
2009-04-23 18:26:31 +00:00
|
|
|
|
2009-04-24 14:34:54 +00:00
|
|
|
_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2011-09-15 20:45:48 +00:00
|
|
|
-- if this platform requires a special compiler or linker, list it here
|
2012-05-18 00:41:28 +00:00
|
|
|
cpp.platformtools_old(cfg, cc)
|
2009-05-22 20:27:05 +00:00
|
|
|
|
2011-12-08 21:25:50 +00:00
|
|
|
_p(' OBJDIR = %s', _MAKE.esc(cfg.objectsdir))
|
2009-05-12 22:11:24 +00:00
|
|
|
_p(' TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory))
|
2009-04-23 18:26:31 +00:00
|
|
|
_p(' TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name))
|
|
|
|
_p(' DEFINES += %s', table.concat(cc.getdefines(cfg.defines), " "))
|
|
|
|
_p(' INCLUDES += %s', table.concat(cc.getincludedirs(cfg.includedirs), " "))
|
2011-09-15 20:45:48 +00:00
|
|
|
|
2011-12-08 21:25:50 +00:00
|
|
|
-- CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, and RESFLAGS
|
2012-06-13 22:29:51 +00:00
|
|
|
cpp.flags_old(cfg, cc)
|
2009-05-22 20:27:05 +00:00
|
|
|
|
|
|
|
-- set up precompiled headers
|
2012-06-12 19:57:45 +00:00
|
|
|
cpp.pchconfig_old(cfg)
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-05-22 18:38:53 +00:00
|
|
|
_p(' LIBS += %s', table.concat(cc.getlinkflags(cfg), " "))
|
2009-04-23 18:26:31 +00:00
|
|
|
_p(' LDDEPS += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath")), " "))
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-23 18:26:31 +00:00
|
|
|
if cfg.kind == "StaticLib" then
|
2009-07-13 18:34:26 +00:00
|
|
|
if cfg.platform:startswith("Universal") then
|
|
|
|
_p(' LINKCMD = libtool -o $(TARGET) $(OBJECTS)')
|
|
|
|
else
|
|
|
|
_p(' LINKCMD = $(AR) -rcs $(TARGET) $(OBJECTS)')
|
|
|
|
end
|
2009-04-23 18:26:31 +00:00
|
|
|
else
|
2011-12-08 21:25:50 +00:00
|
|
|
-- this was $(TARGET) $(LDFLAGS) $(OBJECTS)
|
|
|
|
-- 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"))
|
2009-04-23 18:26:31 +00:00
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-23 18:26:31 +00:00
|
|
|
_p(' define PREBUILDCMDS')
|
|
|
|
if #cfg.prebuildcommands > 0 then
|
|
|
|
_p('\t@echo Running pre-build commands')
|
|
|
|
_p('\t%s', table.implode(cfg.prebuildcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
|
|
|
|
|
|
|
_p(' define PRELINKCMDS')
|
|
|
|
if #cfg.prelinkcommands > 0 then
|
|
|
|
_p('\t@echo Running pre-link commands')
|
|
|
|
_p('\t%s', table.implode(cfg.prelinkcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
|
|
|
|
|
|
|
_p(' define POSTBUILDCMDS')
|
|
|
|
if #cfg.postbuildcommands > 0 then
|
|
|
|
_p('\t@echo Running post-build commands')
|
|
|
|
_p('\t%s', table.implode(cfg.postbuildcommands, "", "", "\n\t"))
|
|
|
|
end
|
|
|
|
_p(' endef')
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2011-09-15 20:45:48 +00:00
|
|
|
-- write out config-level makesettings blocks
|
2012-06-13 22:29:51 +00:00
|
|
|
make.settings_old(cfg, cc)
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2009-04-23 18:26:31 +00:00
|
|
|
_p('endif')
|
|
|
|
_p('')
|
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
|
|
|
|
2011-09-15 20:45:48 +00:00
|
|
|
--
|
|
|
|
-- Platform support
|
|
|
|
--
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2012-05-18 00:41:28 +00:00
|
|
|
function cpp.platformtools_old(cfg, cc)
|
2011-09-15 20:45:48 +00:00
|
|
|
local platform = cc.platforms[cfg.platform]
|
|
|
|
if platform.cc then
|
|
|
|
_p(' CC = %s', platform.cc)
|
|
|
|
end
|
|
|
|
if platform.cxx then
|
|
|
|
_p(' CXX = %s', platform.cxx)
|
|
|
|
end
|
|
|
|
if platform.ar then
|
|
|
|
_p(' AR = %s', platform.ar)
|
|
|
|
end
|
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
|
|
|
|
2011-09-15 20:45:48 +00:00
|
|
|
--
|
|
|
|
-- Configurations
|
|
|
|
--
|
|
|
|
|
2012-06-13 22:29:51 +00:00
|
|
|
function cpp.flags_old(cfg, cc)
|
2011-09-15 20:45:48 +00:00
|
|
|
_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), " "))
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2011-10-26 19:54:52 +00:00
|
|
|
-- Patch #3401184 changed the order
|
|
|
|
_p(' LDFLAGS += %s', table.concat(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions), " "))
|
2011-12-08 21:25:50 +00:00
|
|
|
|
|
|
|
_p(' RESFLAGS += $(DEFINES) $(INCLUDES) %s',
|
2011-09-15 20:45:48 +00:00
|
|
|
table.concat(table.join(cc.getdefines(cfg.resdefines),
|
|
|
|
cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
|
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
|
|
|
|
2010-10-19 11:14:46 +00:00
|
|
|
--
|
|
|
|
-- Precompiled header support
|
|
|
|
--
|
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
function cpp.pchconfig_old(cfg)
|
2011-10-25 22:06:53 +00:00
|
|
|
-- GCC needs the full path to the PCH, while Visual Studio needs
|
|
|
|
-- only the name (or rather, the name as specified in the #include
|
|
|
|
-- statement). Try to locate the PCH in the project.
|
|
|
|
local pchheader = cfg.pchheader
|
|
|
|
for _, incdir in ipairs(cfg.includedirs) do
|
|
|
|
local testname = path.join(incdir, cfg.pchheader)
|
|
|
|
if os.isfile(testname) then
|
|
|
|
pchheader = testname
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-10-19 11:14:46 +00:00
|
|
|
if not cfg.flags.NoPCH and cfg.pchheader then
|
|
|
|
_p(' PCH = %s', _MAKE.esc(path.getrelative(cfg.location, cfg.pchheader)))
|
2011-12-08 21:25:50 +00:00
|
|
|
_p(' GCH = $(OBJDIR)/%s.gch', _MAKE.esc(path.getname(cfg.pchheader)))
|
2010-10-19 11:14:46 +00:00
|
|
|
_p(' CPPFLAGS += -I$(OBJDIR) -include $(OBJDIR)/%s', _MAKE.esc(path.getname(cfg.pchheader)))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-09-19 20:45:49 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Build command for a single file.
|
|
|
|
--
|
|
|
|
|
2012-06-12 19:57:45 +00:00
|
|
|
function cpp.buildcommand_old(iscfile)
|
2011-09-19 20:45:49 +00:00
|
|
|
local flags = iif(iscfile, '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)')
|
|
|
|
_p('\t$(SILENT) %s -o "$@" -MF $(@:%%.o=%%.d) -c "$<"', flags)
|
|
|
|
end
|
2011-12-08 21:25:50 +00:00
|
|
|
|
2011-09-19 20:45:49 +00:00
|
|
|
|