Merge the different makefile header generation functions

This commit is contained in:
Jason Perkins 2012-09-27 10:16:42 -04:00
parent 1207bbd3ac
commit a7ec374f0c
4 changed files with 31 additions and 29 deletions

View File

@ -60,7 +60,7 @@
--
function make.defaultconfig(target)
-- find the configuration iterator function
-- find the right configuration iterator function for this object
local eachconfig = iif(target.project, project.eachconfig, solution.eachconfig)
local iter = eachconfig(target)
@ -131,6 +131,29 @@
end
--
-- Output a makefile header.
--
-- @param target
-- The solution or project object for which the makefile is being generated.
--
function make.header(target)
-- find the right configuration iterator function for this object
local kind = iif(target.project, "project", "solution")
_p('# %s %s makefile autogenerated by Premake', premake.action.current().shortname, kind)
_p('')
make.defaultconfig(target)
_p('ifndef verbose')
_p(' SILENT = @')
_p('endif')
_p('')
end
--
-- Rules for file ops based on the shell type. Can't use defines and $@ because
-- it screws up the escaping of spaces and parethesis (anyone know a solution?)

View File

@ -4,7 +4,7 @@
-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
--
premake.make.cpp = { }
premake.make.cpp = {}
local make = premake.make
local cpp = premake.make.cpp
local project = premake5.project
@ -16,7 +16,7 @@
--
function make.cpp.generate(prj)
cpp.header(prj)
make.header(prj)
-- main build rule(s)
_p('.PHONY: clean prebuild prelink')
@ -84,24 +84,6 @@
end
--
-- Write out the C++ makefile header.
--
function cpp.header(prj)
-- a little help for the uninitiated
_p('# %s C/C++ project makefile autogenerated by Premake', premake.action.current().shortname)
_p('')
make.defaultconfig(prj)
_p('ifndef verbose')
_p(' SILENT = @')
_p('endif')
_p('')
end
--
-- Write out the settings for a particular configuration.
--

View File

@ -4,17 +4,18 @@
-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
--
premake.make.cs = {}
local make = premake.make
local cs = premake.make.cs
--
-- Generate a GNU make C# project makefile, with support for the new platforms API.
--
function make.generate_csharp(prj)
make.header(prj)
print("** Warning: GMake C# projects have not been ported yet")
end

View File

@ -14,12 +14,8 @@
--
function make.generate_solution(sln)
-- a little guidance for the uninitiated
_p('# %s solution makefile autogenerated by Premake', premake.action.current().shortname)
_p('# Type "make help" for usage help')
_p('')
make.header(sln)
make.defaultconfig(sln)
make.configmap(sln)
make.projects(sln)