Commits

Jason McKesson committed 14f76bd Merge

Merge with default

Comments (0)

Files changed (148)

 --------
-  4.5 (in progress)
+  5.0 (in progress)
 --------
 
 * Completely overhauled the platform support; too many changes to list
 * Added NoWarnings flag for Visual Studio (xpol)
 * Added debugcommand for Visual Studio (xpol)
 * Bug 1674173: Allow source files to have the same name
+* Added forceinclude() to specify forced include files
+* Visual Studio C# projects now support architectures
+* Visual Studio C# projects now support pre- and post-build commands
+* Added NoImplicitLink flag to force explicit linking from Visual Studio
+* Decoupled VS2010 smaller type checks (/RTCc) from extra warnings (/W4)
+* Added NoRuntimeChecks flag to disable Visual Studio default checks
+* Generated Visual Studio GUIDs are now deterministic
+* Added support for Visual Studio solution groups
 
 
 -------
 * Patch 3476176: Fix dependencies of precompiled header in makefile (Konstantin Tokarev)
 * Patch 3476176: Remove conditionals from makefile compiler assignments (Konstantin Tokarev)
 * Pull 1: Fixed path to Info.plist in Xcode projects (Adrien Anselme)
+* Patch 3367642: Add support for targetextension property to Xcode
+* Patch 3435716: Fix for PS3 config generation in VS2010 (Jake)
+* Patch 3441850: Use debug.traceback() as error handler (Konstantin Tokarev)
+* Patch 3462994: Make flag values case-insensitive (Konstantin Tokarev)
+* Patch 3466877: Removed -flat_namespace from Mac OS X flags (Konstantin Tokarev)
+* Pull 25: Add Unix support to os.getversion() (wfgleper)
 
 
 -------

scripts/embed.lua

 		-- load the manifest of script files
 		scripts = dofile("src/_manifest.lua")
 		
-		-- main script always goes at the end
-		table.insert(scripts, "_premake_main.lua")
+		-- main script always goes first
+		table.insert(scripts, 1, "_premake_main.lua")
 		
 		-- open scripts.c and write the file header
 		local out = io.open("src/host/scripts.c", "w+b")

src/_manifest.lua

 
 	return
 	{
-		-- core files
+		-- Lua extensions
 		"base/os.lua",
 		"base/path.lua",
 		"base/string.lua",
 		"base/table.lua",
+		
+		-- core files
 		"base/io.lua",
 		"base/globals.lua",
 		"base/action.lua",
+		"base/criteria.lua",
 		"base/option.lua",
 		"base/tree.lua",
 		"base/project.lua",
 		"base/config.lua",
-		"base/bake.lua",
-		"base/api.lua",
-		"base/cmdline.lua",
 		"base/validate.lua",
 		"base/help.lua",
 		"base/premake.lua",
 		
+		-- configuration APIs
+		"base/configset.lua",
+		"base/context.lua",
+		"base/api.lua",
+		"base/detoken.lua",
+		
+		-- runtime environment setup
+		"_premake_init.lua",
+		"base/cmdline.lua",
+		
 		-- project APIs
 		"project/oven.lua",
 		"project/project.lua",
 		"tools/dotnet.lua",
 		"tools/gcc.lua",
 		"tools/msc.lua",
-		"tools/ow.lua",
 		"tools/snc.lua",
 
-		-- CodeBlocks action
-		"actions/codeblocks/_codeblocks.lua",
-		"actions/codeblocks/codeblocks_workspace.lua",
-		"actions/codeblocks/codeblocks_cbp.lua",
-		
-		-- CodeLite action
-		"actions/codelite/_codelite.lua",
-		"actions/codelite/codelite_workspace.lua",
-		"actions/codelite/codelite_project.lua",
-		
 		-- GNU make action
 		"actions/make/_make.lua",
 		"actions/make/make_solution.lua",
 		
 		-- Visual Studio actions
 		"actions/vstudio/_vstudio.lua",
-		"actions/vstudio/vs2002_solution.lua",
-		"actions/vstudio/vs2002_csproj.lua",
-		"actions/vstudio/vs2002_csproj_user.lua",
 		"actions/vstudio/vs200x_vcproj.lua",
 		"actions/vstudio/vs200x_vcproj_user.lua",
-		"actions/vstudio/vs2003_solution.lua",
 		"actions/vstudio/vs2005_solution.lua",
 		"actions/vstudio/vs2005_csproj.lua",
 		"actions/vstudio/vs2005_csproj_user.lua",
 		"actions/vstudio/vs2010_vcxproj.lua",
 		"actions/vstudio/vs2010_vcxproj_user.lua",
 		"actions/vstudio/vs2010_vcxproj_filters.lua",
-	
-		-- Xcode action
-		"actions/xcode/_xcode.lua",
-		"actions/xcode/xcode_common.lua",
-		"actions/xcode/xcode_project.lua",
-		
-		-- Xcode4 action
-		"actions/xcode/xcode4_workspace.lua",
-		
+
 		-- Clean action
 		"actions/clean/_clean.lua",
 	}

src/_premake_init.lua

+--
+-- _premake_init.lua
+--
+-- Prepares the runtime environment for the add-ons and user project scripts.
+--
+-- Copyright (c) 2012 Jason Perkins and the Premake project
+--
+
+
+--
+-- Set up the global environment for the systems I know about. I would like to see
+-- at least some if not all of this moved into add-ons in the future.
+--
+
+--
+-- Use Posix-style target naming by default, since it is the most common.
+--
+
+	configuration { "SharedLib" }
+		targetprefix "lib"
+		targetextension ".so"
+
+	configuration { "StaticLib" }
+		targetprefix "lib"
+		targetextension ".a"
+
+
+--
+-- Add variations for other Posix-like systems.
+--
+
+	configuration { "MacOSX", "SharedLib" }
+		targetextension ".dylib"
+
+	configuration { "PS3", "ConsoleApp" }
+		targetextension ".elf"
+
+
+--
+-- Windows and friends.
+--
+
+	configuration { "Windows or Xbox360 or C#", "ConsoleApp or WindowedApp" }
+		targetextension ".exe"
+
+	configuration { "Windows or Xbox360 or C#", "SharedLib" }
+		targetprefix ""
+		targetextension ".dll"
+		implibextension ".lib"
+
+	configuration { "Windows or Xbox360 or C#", "StaticLib" }
+		targetprefix ""
+		targetextension ".lib"

src/_premake_main.lua

 --
 -- _premake_main.lua
 -- Script-side entry point for the main program logic.
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
 
 
 
 --
--- Inject a new target platform into each solution; called if the --platform
--- argument was specified on the command line.
---
-
-	local function injectplatform(platform)
-		if not platform then return true end
-		platform = premake.checkvalue(platform, premake.fields.platforms.allowed)
-		
-		for sln in premake.solution.each() do
-			local platforms = sln.platforms or { }
-			
-			-- an empty table is equivalent to a native build
-			if #platforms == 0 then
-				table.insert(platforms, "Native")
-			end
-			
-			-- the solution must provide a native build in order to support this feature
-			if not table.contains(platforms, "Native") then
-				return false, sln.name .. " does not target native platform\nNative platform settings are required for the --platform feature."
-			end
-			
-			-- add it to the end of the list, if it isn't in there already
-			if not table.contains(platforms, platform) then
-				table.insert(platforms, platform)
-			end
-			
-			sln.platforms = platforms
-		end
-		
-		return true
-	end
-	
-
---
 -- Script-side program entry point.
 --
 
 		end
 		
 
+		-- Now that the scripts are loaded, I can use path.getabsolute() to properly
+		-- canonicalize the executable path.
+		
+		_PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND)
+
+
+		-- The "next-gen" actions have now replaced their deprecated counterparts. 
+		-- Provide a warning for a little while before I remove them entirely.
+		if _ACTION:endswith("ng") then
+			print(string.format("** Warning: '%s' has been deprecated; use '%s' instead", _ACTION, _ACTION:sub(1, -3)))
+		end
+
 		-- Set up the environment for the chosen action early, so side-effects
 		-- can be picked up by the scripts.
 
 		if (not ok) then error("Error: " .. err, 0) end
 		
 		
-		-- If a platform was specified on the command line, inject it now
+		-- "Bake" the project information, preparing it for use by the action
 
-		ok, err = injectplatform(_OPTIONS["platform"])
-		if (not ok) then error("Error: " .. err, 0) end
+		print("Building configurations...")
+		premake.solution.bakeall()
 
 		
-		-- Quick hack: disable the old configuration baking logic for the new
-		-- next-gen actions; this code will go away when everything has been
-		-- ported to the new API
-		print("Building configurations...")
-		if not action.isnextgen then
-			premake.bake.buildconfigs()		
-			ok, err = premake.checkprojects()
-			if (not ok) then error("Error: " .. err, 0) end
-		else
-			premake.solution.bakeall()
-		end
-			
-		
 		-- Hand over control to the action
 		printf("Running action '%s'...", action.trigger)
 		premake.action.call(action.trigger)

src/actions/clean/_clean.lua

 --
 -- _clean.lua
 -- The "clean" action: removes all generated files.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
-	premake.clean = { }
-
-
---
--- Clean a solution or project specific directory. Uses information in the
--- project object to build the target path.
---
--- @param obj
---    A solution or project object.
--- @param pattern
---    A filename pattern to clean; see premake.project.getfilename() for
---    a description of the format.
---
-
-	function premake.clean.directory(obj, pattern)
-		local fname = premake.project.getfilename(obj, pattern)
-		os.rmdir(fname)
-	end
-
-
---
--- Clean a solution or project specific file. Uses information in the project
--- object to build the target filename.
---
--- @param obj
---    A solution or project object.
--- @param pattern
---    A filename pattern to clean; see premake.project.getfilename() for
---    a description of the format.
---
-
-	function premake.clean.file(obj, pattern)
-		local fname = premake.project.getfilename(obj, pattern)
-		os.remove(fname)
-	end
+	premake.clean = {}
 
 
 --
 		trigger     = "clean",
 		description = "Remove all binaries and generated files",
 
-		onsolution = function(sln)
-			for action in premake.action.each() do
-				if action.oncleansolution then
-					action.oncleansolution(sln)
-				end
-			end
-		end,
-		
-		onproject = function(prj)
-			for action in premake.action.each() do
-				if action.oncleanproject then
-					action.oncleanproject(prj)
-				end
-			end
-
-			if (prj.objectsdir) then
-				premake.clean.directory(prj, prj.objectsdir)
-			end
-
-			-- build a list of supported target platforms that also includes a generic build
-			local platforms = prj.solution.platforms or { }
-			if not table.contains(platforms, "Native") then
-				platforms = table.join(platforms, { "Native" })
-			end
-
-			for _, platform in ipairs(platforms) do
-				for cfg in premake.eachconfig(prj, platform) do
-					premake.clean.directory(prj, cfg.objectsdir)
-
-					-- remove all permutations of the target binary
-					premake.clean.file(prj, premake.gettarget(cfg, "build", "posix", "windows", "windows").fullpath)
-					premake.clean.file(prj, premake.gettarget(cfg, "build", "posix", "posix", "linux").fullpath)
-					premake.clean.file(prj, premake.gettarget(cfg, "build", "posix", "posix", "macosx").fullpath)
-					premake.clean.file(prj, premake.gettarget(cfg, "build", "posix", "PS3", "windows").fullpath)
-					if cfg.kind == "WindowedApp" then
-						premake.clean.directory(prj, premake.gettarget(cfg, "build", "posix", "posix", "linux").fullpath .. ".app")
-					end
-
-					-- if there is an import library, remove that too
-					premake.clean.file(prj, premake.gettarget(cfg, "link", "windows", "windows", "windows").fullpath)
-					premake.clean.file(prj, premake.gettarget(cfg, "link", "posix", "posix", "linux").fullpath)
-
-					-- call action.oncleantarget() with the undecorated target name
-					local target = path.join(premake.project.getfilename(prj, cfg.buildtarget.directory), cfg.buildtarget.basename)
-					for action in premake.action.each() do
-						if action.oncleantarget then
-							action.oncleantarget(target)
-						end
-					end
-				end
-			end
+		execute = function()
+			print("** The clean action has not yet been ported")
 		end
 	}

src/actions/codeblocks/_codeblocks.lua

---
--- _codeblocks.lua
--- Define the Code::Blocks action(s).
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
---
-
-	premake.codeblocks = { }
-
-	newaction {
-		trigger         = "codeblocks",
-		shortname       = "Code::Blocks",
-		description     = "Generate Code::Blocks project files",
-		
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++" },
-		
-		valid_tools     = {
-			cc   = { "gcc", "ow" },
-		},
-		
-		onsolution = function(sln)
-			premake.generate(sln, "%%.workspace", premake.codeblocks.workspace)
-		end,
-		
-		onproject = function(prj)
-			premake.generate(prj, "%%.cbp", premake.codeblocks.cbp)
-		end,
-		
-		oncleansolution = function(sln)
-			premake.clean.file(sln, "%%.workspace")
-		end,
-		
-		oncleanproject = function(prj)
-			premake.clean.file(prj, "%%.cbp")
-			premake.clean.file(prj, "%%.depend")
-			premake.clean.file(prj, "%%.layout")
-		end
-	}

src/actions/codeblocks/codeblocks_cbp.lua

---
--- codeblocks_cbp.lua
--- Generate a Code::Blocks C/C++ project.
--- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
---
-
-	local codeblocks = premake.codeblocks
-
-
---
--- Write out a list of the source code files in the project.
---
-
-	function codeblocks.files(prj)
-		local pchheader
-		if (prj.pchheader) then
-			pchheader = path.getrelative(prj.location, prj.pchheader)
-		end
-		
-		for fcfg in premake.project.eachfile(prj) do
-			_p(2,'<Unit filename="%s">', premake.esc(fcfg.name))
-			if fcfg.name ~= fcfg.vpath then
-				_p(3,'<Option virtualFolder="%s" />', path.getdirectory(fcfg.vpath))
-			end
-			if path.isresourcefile(fcfg.name) then
-				_p(3,'<Option compilerVar="WINDRES" />')
-			elseif path.iscfile(fcfg.name) and prj.language == "C++" then
-				_p(3,'<Option compilerVar="CC" />')
-			end
-			if not prj.flags.NoPCH and fcfg.name == pchheader then
-				_p(3,'<Option compilerVar="%s" />', iif(prj.language == "C", "CC", "CPP"))
-				_p(3,'<Option compile="1" />')
-				_p(3,'<Option weight="0" />')
-				_p(3,'<Add option="-x c++-header" />')
-			end
-			_p(2,'</Unit>')
-		end
-	end
-
-	function premake.codeblocks.debugenvs(cfg)
-		--Assumption: if gcc is being used then so is gdb although this section will be ignored by
-		--other debuggers. If using gcc and not gdb it will silently not pass the
-		--environment arguments to the debugger
-		if premake.gettool(cfg) == premake.gcc then
-			_p(3,'<debugger>')
-				_p(4,'<remote_debugging target="%s">', premake.esc(cfg.longname))
-					local args = ''
-					local sz = #cfg.debugenvs
-					for idx, v in ipairs(cfg.debugenvs) do
-						args = args .. 'set env ' .. v 
-						if sz ~= idx then args = args .. '&#x0A;' end
-					end
-					_p(5,'<options additional_cmds_before="%s" />',args)
-				_p(4,'</remote_debugging>')
-			_p(3,'</debugger>')
-		else
-			 error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')
-		end
-	end
-	
---
--- The main function: write out the project file.
---
-	
-	function premake.codeblocks.cbp(prj)
-		-- alias the C/C++ compiler interface
-		local cc = premake.gettool(prj)
-		
-		_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
-		_p('<CodeBlocks_project_file>')
-		_p(1,'<FileVersion major="1" minor="6" />')
-		
-		-- write project block header
-		_p(1,'<Project>')
-		_p(2,'<Option title="%s" />', premake.esc(prj.name))
-		_p(2,'<Option pch_mode="2" />')
-		_p(2,'<Option compiler="%s" />', _OPTIONS.cc)
-
-		-- build a list of supported target platforms; I don't support cross-compiling yet
-		local platforms = premake.filterplatforms(prj.solution, cc.platforms, "Native")
-		for i = #platforms, 1, -1 do
-			if premake.platforms[platforms[i]].iscrosscompiler then
-				table.remove(platforms, i)
-			end
-		end 
-		
-		-- write configuration blocks
-		_p(2,'<Build>')
-		for _, platform in ipairs(platforms) do		
-			for cfg in premake.eachconfig(prj, platform) do
-				_p(3,'<Target title="%s">', premake.esc(cfg.longname))
-				
-				_p(4,'<Option output="%s" prefix_auto="0" extension_auto="0" />', premake.esc(cfg.buildtarget.fullpath))
-				
-				if cfg.debugdir then
-					_p(4,'<Option working_dir="%s" />', premake.esc(cfg.debugdir))
-				end
-				
-				_p(4,'<Option object_output="%s" />', premake.esc(cfg.objectsdir))
-
-				-- identify the type of binary
-				local types = { WindowedApp = 0, ConsoleApp = 1, StaticLib = 2, SharedLib = 3 }
-				_p(4,'<Option type="%d" />', types[cfg.kind])
-
-				_p(4,'<Option compiler="%s" />', _OPTIONS.cc)
-				
-				if (cfg.kind == "SharedLib") then
-					_p(4,'<Option createDefFile="0" />')
-					_p(4,'<Option createStaticLib="%s" />', iif(cfg.flags.NoImportLib, 0, 1))
-				end
-
-				-- begin compiler block --
-				_p(4,'<Compiler>')
-				for _,flag in ipairs(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getdefines(cfg.defines), cfg.buildoptions)) do
-					_p(5,'<Add option="%s" />', premake.esc(flag))
-				end
-				if not cfg.flags.NoPCH and cfg.pchheader then
-					_p(5,'<Add option="-Winvalid-pch" />')
-					_p(5,'<Add option="-include &quot;%s&quot;" />', premake.esc(cfg.pchheader))
-				end
-				for _,v in ipairs(cfg.includedirs) do
-					_p(5,'<Add directory="%s" />', premake.esc(v))
-				end
-				_p(4,'</Compiler>')
-				-- end compiler block --
-				
-				-- begin linker block --
-				_p(4,'<Linker>')
-				for _,flag in ipairs(table.join(cc.getldflags(cfg), cfg.linkoptions)) do
-					_p(5,'<Add option="%s" />', premake.esc(flag))
-				end
-				for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do
-					_p(5,'<Add directory="%s" />', premake.esc(v))
-				end
-				for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do
-					_p(5,'<Add library="%s" />', premake.esc(v))
-				end
-				_p(4,'</Linker>')
-				-- end linker block --
-				
-				-- begin resource compiler block --
-				if premake.findfile(cfg, ".rc") then
-					_p(4,'<ResourceCompiler>')
-					for _,v in ipairs(cfg.includedirs) do
-						_p(5,'<Add directory="%s" />', premake.esc(v))
-					end
-					for _,v in ipairs(cfg.resincludedirs) do
-						_p(5,'<Add directory="%s" />', premake.esc(v))
-					end
-					_p(4,'</ResourceCompiler>')
-				end
-				-- end resource compiler block --
-				
-				-- begin build steps --
-				if #cfg.prebuildcommands > 0 or #cfg.postbuildcommands > 0 then
-					_p(4,'<ExtraCommands>')
-					for _,v in ipairs(cfg.prebuildcommands) do
-						_p(5,'<Add before="%s" />', premake.esc(v))
-					end
-					for _,v in ipairs(cfg.postbuildcommands) do
-						_p(5,'<Add after="%s" />', premake.esc(v))
-					end
-
-					_p(4,'</ExtraCommands>')
-				end
-				-- end build steps --
-				
-				_p(3,'</Target>')
-			end
-		end
-		_p(2,'</Build>')
-		
-		codeblocks.files(prj)
-		
-		_p(2,'<Extensions>')
-        for _, platform in ipairs(platforms) do
-			for cfg in premake.eachconfig(prj, platform) do
-				if cfg.debugenvs and #cfg.debugenvs > 0 then
-					premake.codeblocks.debugenvs(cfg)
-				end
-			end
-		end
-		_p(2,'</Extensions>')
-
-		_p(1,'</Project>')
-		_p('</CodeBlocks_project_file>')
-		_p('')
-		
-	end

src/actions/codeblocks/codeblocks_workspace.lua

---
--- codeblocks_workspace.lua
--- Generate a Code::Blocks workspace.
--- Copyright (c) 2009 Jason Perkins and the Premake project
---
-
-	function premake.codeblocks.workspace(sln)
-		_p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>')
-		_p('<CodeBlocks_workspace_file>')
-		_p(1,'<Workspace title="%s">', sln.name)
-		
-		for prj in premake.solution.eachproject(sln) do
-			local fname = path.join(path.getrelative(sln.location, prj.location), prj.name)
-			local active = iif(prj.project == sln.projects[1], ' active="1"', '')
-			
-			_p(2,'<Project filename="%s.cbp"%s>', fname, active)
-			for _,dep in ipairs(premake.getdependencies(prj)) do
-				_p(3,'<Depends filename="%s.cbp" />', path.join(path.getrelative(sln.location, dep.location), dep.name))
-			end
-		
-			_p(2,'</Project>')
-		end
-		
-		_p(1,'</Workspace>')
-		_p('</CodeBlocks_workspace_file>')
-	end
-

src/actions/codelite/_codelite.lua

---
--- _codelite.lua
--- Define the CodeLite action(s).
--- Copyright (c) 2008-2009 Jason Perkins and the Premake project
---
-
-	premake.codelite = { }
-
-	newaction {
-		trigger         = "codelite",
-		shortname       = "CodeLite",
-		description     = "Generate CodeLite project files",
-	
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++" },
-		
-		valid_tools     = {
-			cc   = { "gcc" },
-		},
-		
-		onsolution = function(sln)
-			premake.generate(sln, "%%.workspace", premake.codelite.workspace)
-		end,
-		
-		onproject = function(prj)
-			premake.generate(prj, "%%.project", premake.codelite.project)
-		end,
-		
-		oncleansolution = function(sln)
-			premake.clean.file(sln, "%%.workspace")
-			premake.clean.file(sln, "%%_wsp.mk")
-			premake.clean.file(sln, "%%.tags")
-		end,
-		
-		oncleanproject = function(prj)
-			premake.clean.file(prj, "%%.project")
-			premake.clean.file(prj, "%%.mk")
-			premake.clean.file(prj, "%%.list")
-			premake.clean.file(prj, "%%.out")
-		end
-	}

src/actions/codelite/codelite_project.lua

---
--- codelite_project.lua
--- Generate a CodeLite C/C++ project file.
--- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
---
-
-	local codelite = premake.codelite
-	local tree = premake.tree
-
-
---
--- Write out a list of the source code files in the project.
---
-
-	function codelite.files(prj)
-		local tr = premake.project.buildsourcetree(prj)
-		tree.traverse(tr, {
-			
-			-- folders are handled at the internal nodes
-			onbranchenter = function(node, depth)
-				_p(depth, '<VirtualDirectory Name="%s">', node.name)
-			end,
-
-			onbranchexit = function(node, depth)
-				_p(depth, '</VirtualDirectory>')
-			end,
-
-			-- source files are handled at the leaves
-			onleaf = function(node, depth)
-				_p(depth, '<File Name="%s"/>', node.cfg.name)
-			end,
-			
-		}, false, 1)
-	end
-	
-
---
--- The main function: write out the project file.
---
-
-	function premake.codelite.project(prj)
-		io.indent = "  "
-		
-		_p('<?xml version="1.0" encoding="utf-8"?>')
-		_p('<CodeLite_Project Name="%s">', premake.esc(prj.name))
-
-		-- Write out the list of source code files in the project
-		codelite.files(prj)
-
-		local types = { 
-			ConsoleApp  = "Executable", 
-			WindowedApp = "Executable", 
-			StaticLib   = "Static Library",
-			SharedLib   = "Dynamic Library",
-		}
-		_p('  <Settings Type="%s">', types[prj.kind])
-		
-		-- build a list of supported target platforms; I don't support cross-compiling yet
-		local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, "Native")
-		for i = #platforms, 1, -1 do
-			if premake.platforms[platforms[i]].iscrosscompiler then
-				table.remove(platforms, i)
-			end
-		end 
-
-		for _, platform in ipairs(platforms) do
-			for cfg in premake.eachconfig(prj, platform) do
-				local name = premake.esc(cfg.longname)
-				local compiler = iif(cfg.language == "C", "gcc", "g++")
-				_p('    <Configuration Name="%s" CompilerType="gnu %s" DebuggerType="GNU gdb debugger" Type="%s">', name, compiler, types[cfg.kind])
-			
-				local fname  = premake.esc(cfg.buildtarget.fullpath)
-				local objdir = premake.esc(cfg.objectsdir)
-				local runcmd = cfg.buildtarget.name
-				local rundir = cfg.debugdir or cfg.buildtarget.directory
-				local runargs = table.concat(cfg.debugargs, " ")
-				local pause  = iif(cfg.kind == "WindowedApp", "no", "yes")
-				_p('      <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="%s" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, runargs, rundir, pause)
-				
-				-- begin compiler block --
-				local flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions))
-				_p('      <Compiler Required="yes" Options="%s">', table.concat(flags, ";"))
-				for _,v in ipairs(cfg.includedirs) do
-					_p('        <IncludePath Value="%s"/>', premake.esc(v))
-				end
-				for _,v in ipairs(cfg.defines) do
-					_p('        <Preprocessor Value="%s"/>', premake.esc(v))
-				end
-				_p('      </Compiler>')
-				-- end compiler block --
-				
-				-- begin linker block --
-				flags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions))
-				_p('      <Linker Required="yes" Options="%s">', table.concat(flags, ";"))
-				for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do
-					_p('        <LibraryPath Value="%s" />', premake.esc(v))
-				end
-				for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do
-					_p('        <Library Value="%s" />', premake.esc(v))
-				end
-				_p('      </Linker>')
-				-- end linker block --
-				
-				-- begin resource compiler block --
-				if premake.findfile(cfg, ".rc") then
-					local defines = table.implode(table.join(cfg.defines, cfg.resdefines), "-D", ";", "")
-					local options = table.concat(cfg.resoptions, ";")
-					_p('      <ResourceCompiler Required="yes" Options="%s%s">', defines, options)
-					for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do
-						_p('        <IncludePath Value="%s"/>', premake.esc(v))
-					end
-					_p('      </ResourceCompiler>')
-				else
-					_p('      <ResourceCompiler Required="no" Options=""/>')
-				end
-				-- end resource compiler block --
-				
-				-- begin build steps --
-				if #cfg.prebuildcommands > 0 then
-					_p('      <PreBuild>')
-					for _,v in ipairs(cfg.prebuildcommands) do
-						_p('        <Command Enabled="yes">%s</Command>', premake.esc(v))
-					end
-					_p('      </PreBuild>')
-				end
-				if #cfg.postbuildcommands > 0 then
-					_p('      <PostBuild>')
-					for _,v in ipairs(cfg.postbuildcommands) do
-						_p('        <Command Enabled="yes">%s</Command>', premake.esc(v))
-					end
-					_p('      </PostBuild>')
-				end
-				-- end build steps --
-				
-				_p('      <CustomBuild Enabled="no">')
-				_p('        <CleanCommand></CleanCommand>')
-				_p('        <BuildCommand></BuildCommand>')
-				_p('        <SingleFileCommand></SingleFileCommand>')
-				_p('        <MakefileGenerationCommand></MakefileGenerationCommand>')
-				_p('        <ThirdPartyToolName>None</ThirdPartyToolName>')
-				_p('        <WorkingDirectory></WorkingDirectory>')
-				_p('      </CustomBuild>')
-				_p('      <AdditionalRules>')
-				_p('        <CustomPostBuild></CustomPostBuild>')
-				_p('        <CustomPreBuild></CustomPreBuild>')
-				_p('      </AdditionalRules>')
-				_p('    </Configuration>')
-			end
-		end
-		_p('  </Settings>')
-
-		for _, platform in ipairs(platforms) do
-			for cfg in premake.eachconfig(prj, platform) do
-				_p('  <Dependencies name="%s">', cfg.longname)
-				for _,dep in ipairs(premake.getdependencies(prj)) do
-					_p('    <Project Name="%s"/>', dep.name)
-				end
-				_p('  </Dependencies>')
-			end
-		end
-		
-		_p('</CodeLite_Project>')
-	end

src/actions/codelite/codelite_workspace.lua

---
--- codelite_workspace.lua
--- Generate a CodeLite workspace file.
--- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
---
-
-	function premake.codelite.workspace(sln)
-		_p('<?xml version="1.0" encoding="utf-8"?>')
-		_p('<CodeLite_Workspace Name="%s" Database="./%s.tags">', premake.esc(sln.name), premake.esc(sln.name))
-		
-		for i,prj in ipairs(sln.projects) do
-			local name = premake.esc(prj.name)
-			local fname = path.join(path.getrelative(sln.location, prj.location), prj.name)
-			local active = iif(i==1, "Yes", "No")
-			_p('  <Project Name="%s" Path="%s.project" Active="%s" />', name, fname, active)
-		end
-		
-		-- build a list of supported target platforms; I don't support cross-compiling yet
-		local platforms = premake.filterplatforms(sln, premake[_OPTIONS.cc].platforms, "Native")
-		for i = #platforms, 1, -1 do
-			if premake.platforms[platforms[i]].iscrosscompiler then
-				table.remove(platforms, i)
-			end
-		end 
-
-		_p('  <BuildMatrix>')
-		for _, platform in ipairs(platforms) do
-			for _, cfgname in ipairs(sln.configurations) do
-				local name = premake.getconfigname(cfgname, platform)
-				_p('    <WorkspaceConfiguration Name="%s" Selected="yes">', name)
-				for _,prj in ipairs(sln.projects) do
-					_p('      <Project Name="%s" ConfigName="%s"/>', prj.name, name)
-				end
-				_p('    </WorkspaceConfiguration>')
-			end
-		end
-		_p('  </BuildMatrix>')
-		_p('</CodeLite_Workspace>')
-	end
-

src/actions/example/_example.lua

--- Define a namespace for my new action. The second line defines an alias that I
--- can use in this file, saving myself some typing. It will not be visible outside
--- of this file (though I can always define it again).
-
-	premake.example = { }
-	local example = premake.example
-
-	
--- The description of the action. Note that only the first three fields are required;
--- you can remove any of the additional fields that are not required by your action.
-
-	newaction 
-	{
-		-- The trigger is what needs to be typed on the command line to cause 
-		-- this action this run (premake4 example)
-		trigger = "example",
-		
-		-- The short name is used when this toolset name needs to be shown to
-		-- the user, such as in status or error messages
-		shortname = "Super Studio 3000",
-		
-		-- The description is shown in the help text (premake4 /help)
-		description = "An example action that prints simple text files",
-
-		-- Some actions imply a particular operating system: Visual Studio only
-		-- runs on Windows, and Xcode only on Mac OS X. If this is the case,
-		-- uncomment this line and set it to one of "windows", "linux" or "macosx".
-		-- Otherwise, this action will target the current operating system.
-		-- os = "macosx",
-
-		-- Which kinds of targets this action supports; remove those you don't.
-		valid_kinds = { "ConsoleApp", "WindowedApp", "SharedLib", "StaticLib" },
-
-		-- Which programming languages this actions supports; remove those you don't.
-		valid_languages = { "C", "C++", "C#" },
-
-		-- Which compiler sets this action supports; remove those you don't. The set
-		-- is specified with the /cc and /dotnet command-line options. You can find
-		-- the tool interfaces at src/tools.
-		valid_tools     = {
-			cc     = { "msc", "gcc", "ow" },
-			dotnet = { "mono", "msnet", "pnet" },
-		},
-
-		
-		-- This function is called during state validation. If your action has some
-		-- special requirements you can check them here and error if necessary.
-		
-		
-		oncheckproject = function(prj)
-			-- if this_project_is_no_good(prj) then
-			--    error("Project " .. prj.name .. " is no good", 0)
-			-- end
-		end,
-		
-
-		-- These functions will get called for each solution and project. The function
-		-- premake.generate() creates a file for you in the correct place, taking into
-		-- account any location information specified in the script. The sequence "%%"
-		-- will be replaced by the solution/project name. The last parameter is the 
-		-- function that will actually do the work of generating the file contents.
-
-		onsolution = function(sln)
-			premake.generate(sln, "%%.sln.txt", premake.example.solution)
-		end,
-
-		onproject = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.generate(prj, "%%.csprj.txt", premake.example.project)
-			else
-				premake.generate(prj, "%%.cprj.txt", premake.example.project)
-			end
-		end,
-
-
-		-- These functions are called for each solution, project, and target as part
-		-- of the "clean" action. They should remove any files generated by the tools.
-		-- premake.clean.file() and premake.clean.directory() are convenience functions
-		-- that use the same pattern matching as premake.generate() above.
-
-		oncleansolution = function(sln)
-			premake.clean.file(sln, "%%.sln.txt")
-		end,
-		
-		oncleanproject  = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.clean.file(prj, "%%.csprj.txt")
-			else
-				premake.clean.file(prj, "%%.cprj.txt")
-			end
-		end,
-		
-		oncleantarget   = function(trg)
-			-- 'trg' is the path and base name of the target being cleaned,
-			-- like 'bin/debug/MyApplication'. So you might do something like:
-			-- os.remove(trg .. ".exe")
-		end,
-	}
-

src/actions/example/example_project.lua

--- An example project generator; see _example.lua for action description
-
--- 
--- The project generation function, attached to the action in _example.lua.
--- By now, premake.generate() has created the project file using the name
--- provided in _example.lua, and redirected input to this new file.
---
-
-	function premake.example.project(prj)
-		-- If necessary, set an explicit line ending sequence
-		-- io.eol = '\r\n'
-	
-		-- Let's start with a header
-		_p('-- Example project file version 1.0')
-		_p('Name: %s', prj.name)
-		_p('Kind: %s', prj.kind)
-		_p('Language: %s', prj.language)
-		_p('ID: {%s}', prj.uuid)
-		_p('')
-
-		
-		-- List the build configurations, and the settings for each
-		for cfg in premake.eachconfig(prj) do
-			_p('Configuration %s:', cfg.name)
-			_p(1, 'Objects directory: %s', cfg.objectsdir)
-
-			_p(1, 'Build target:')
-			_p(2, 'Full path: %s', cfg.buildtarget.fullpath)
-			_p(2, 'Directory: %s', cfg.buildtarget.directory)
-			_p(2, 'Name: %s', cfg.buildtarget.name)
-			_p(2, 'Base name: %s', cfg.buildtarget.basename)
-			_p(2, 'Prefix: %s', cfg.buildtarget.prefix)
-			_p(2, 'Suffix: %s', cfg.buildtarget.suffix)
-			_p('')
-
-			_p(1, 'Compiling:')
-			_p(2, 'Defines: %s', table.concat(cfg.defines, ";"))
-			_p(2, 'Include paths: %s', table.concat(cfg.includedirs, ";"))
-			_p(2, 'Flags: %s', table.concat(cfg.flags, ", "))
-			if not cfg.flags.NoPCH and cfg.pchheader then
-				_p(2, 'Precompiled header: %s (%s)', cfg.pchheader, cfg.pchsource)
-			end
-			_p(2, 'Options: %s', table.concat(cfg.buildoptions, " "))
-			_p('')
-			
-			_p(1, 'Linking:')
-			_p(2, 'Library paths: %s', table.concat(cfg.libdirs, ";"))
-			_p(2, 'Options: %s', table.concat(cfg.linkoptions, " "))
-			_p(2, 'Libraries: %s', table.concat(premake.getlinks(cfg, "all", "fullpath")))
-			_p('')
-			
-			if #cfg.prebuildcommands > 0 then
-				_p(1, 'Prebuild commands:')
-				for _, cmd in ipairs(cfg.prebuildcommands) do
-					_p(2, cmd)
-				end
-				_p('')
-			end
-			
-			if #cfg.prelinkcommands > 0 then
-				_p(1, 'Prelink commands:')
-				for _, cmd in ipairs(cfg.prelinkcommands) do
-					_p(2, cmd)
-				end
-				_p('')
-			end
-			
-			if #cfg.postbuildcommands > 0 then
-				_p(1, 'Postbuild commands:')
-				for _, cmd in ipairs(cfg.postbuildcommands) do
-					_p(2, cmd)
-				end
-				_p('')
-			end
-		end
-
-		
-		-- List out the folders and files that make up the build
-		local tr = premake.project.buildsourcetree(prj)
-		premake.tree.sort(tr)
-		premake.tree.traverse(tr, {
-			onbranch = function(node, depth)
-				_p(depth, path.getname(node.name) .. "/")
-			end,
-			
-			onleaf = function(node, depth)
-				_p(depth, path.getname(node.name))
-			end
-		})
-		
-	end

src/actions/example/example_solution.lua

--- An example solution generator; see _example.lua for action description
-
--- 
--- The solution generation function, attached to the action in _example.lua.
--- By now, premake.generate() has created the solution file using the name
--- provided in _example.lua, and redirected input to this new file.
---
-
-	function premake.example.solution(sln)
-		-- If necessary, set an explicit line ending sequence
-		-- io.eol = '\r\n'
-	
-		-- Let's start with a header
-		_p('-- Example solution file version 1.0')
-		_p('Name: %s', sln.name)
-		_p('')
-		
-
-		-- List the build configurations
-		for _, cfgname in ipairs(sln.configurations) do
-			_p('Config: %s', cfgname)
-		end
-		_p('')
-
-		
-		-- List the projects contained by the solution, with some info on each
-		for prj in premake.solution.eachproject(sln) do
-			_p('Project: %s', prj.name)
-			_p(1, 'Kind: %s', prj.kind)
-			_p(1, 'Language: %s', prj.language)
-			_p(1, 'ID: {%s}', prj.uuid)
-			_p(1, 'Relative path: %s', path.getrelative(sln.location, prj.location))
-			
-			-- List dependencies, if there are any
-			local deps = premake.getdependencies(prj)
-			if #deps > 0 then
-				_p(1, 'Dependencies:')
-				for _, depprj in ipairs(deps) do
-					_p(2, '%s {%s}', depprj.name, depprj.uuid)
-				end
-			end
-
-			_p('')
-		end
-		
-	end

src/actions/make/_make.lua

 -- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
-	premake.make = { }
+	premake.make = {}
 	local make = premake.make
 	local solution = premake.solution
 	local project = premake5.project
 --
 
 	newaction {
-		trigger         = "gmakeng",
-		shortname       = "GNU Make Next-gen",
-		description     = "Experimental GNU makefiles for POSIX, MinGW, and Cygwin",
+		trigger         = "gmake",
+		shortname       = "GNU Make",
+		description     = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
 
 		-- temporary, until I can phase out the legacy implementations
 		isnextgen = true,
 --
 
 	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)
 		
 
 
 --
+-- Output logic to detect the shell type at runtime.
+--
+
+	function make.detectshell()
+		_p('SHELLTYPE := msdos')
+		_p('ifeq (,$(ComSpec)$(COMSPEC))')
+		_p('  SHELLTYPE := posix')
+		_p('endif')
+		_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
+		_p('  SHELLTYPE := posix')
+		_p('endif')
+		_p('')
+	end
+
+
+--
 -- Escape a string so it can be written to a makefile.
 --
 
 		if (type(value) == "table") then
 			result = { }
 			for _,v in ipairs(value) do
-				table.insert(result, _MAKE.esc(v))
+				table.insert(result, make.esc(v))
 			end
 			return result
 		else
 
 
 --
+-- 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?)
 --
 				_p(value)
 			end
 		end
-		
-		local sysflags = toolset.sysflags[cfg.architecture] or toolset.sysflags[cfg.system] or {}
-		if sysflags.cfgsettings then
-			_p(sysflags.cfgsettings)
+
+		local value = toolset.getmakesettings(cfg)
+		if value then
+			_p(value)
 		end
 	end
 
 
 --
+-- Output the main target variables: target directory, target name,
+-- and objects (or intermediate files) directory. These values are
+-- common across both C++ and C# projects.
+--
+
+	function make.targetconfig(cfg)
+		local targetdir = 
+		_p('  TARGETDIR  = %s', make.esc(project.getrelative(cfg.project, cfg.buildtarget.directory)))
+		_p('  TARGET     = $(TARGETDIR)/%s', make.esc(cfg.buildtarget.name))
+		_p('  OBJDIR     = %s', make.esc(project.getrelative(cfg.project, cfg.objdir)))
+	end
+
+
+--
 -- Convert an arbitrary string (project name) to a make variable name.
 --
 

src/actions/make/make_cpp.lua

 --
 -- make_cpp.lua
 -- Generate a C/C++ project makefile.
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 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
 --
 
 	function make.cpp.generate(prj)
-		cpp.header(prj)
+		make.header(prj)
 
 		-- main build rule(s)
 		_p('.PHONY: clean prebuild prelink')
 		
 		-- list intermediate files
 		cpp.objects(prj)
-		
-		-- 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('')
+
+		make.detectshell()		
 
 		-- common build target rules
 		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
 
 
 --
--- 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.
 --
 
 		cpp.toolconfig(cfg, toolset)
 
 		-- write target information (target dir, name, obj dir)
-		cpp.targetconfig(cfg)
+		make.targetconfig(cfg)
 		
 		-- write flags
 		cpp.flags(cfg, toolset)
 
 
 --
--- Target (name, dir) configuration.
---
-
-	function cpp.targetconfig(cfg)		
-		_p('  OBJDIR     = %s', make.esc(project.getrelative(cfg.project, cfg.objdir)))
-		_p('  TARGETDIR  = %s', make.esc(cfg.buildtarget.directory))
-		_p('  TARGET     = $(TARGETDIR)/%s', make.esc(cfg.buildtarget.name))
-	end
-
-
---
 -- The main build target rules.
 --
 
 --
 
 	function cpp.toolconfig(cfg, toolset)
-		local sysflags = toolset.sysflags[cfg.architecture] or toolset.sysflags[cfg.system] or {}
-		if sysflags.cc then
-			_p('  CC         = %s', sysflags.cc)
+		local tool = toolset.gettoolname(cfg, "cc")
+		if tool then
+			_p('  CC         = %s', tool)
 		end
-		if sysflags.cxx then
-			_p('  CXX        = %s', sysflags.cxx)
+
+		tool = toolset.gettoolname(cfg, "cxx")
+		if tool then
+			_p('  CXX        = %s', tool)
 		end
-		if sysflags.ar then
-			_p('  AR         = %s', sysflags.ar)
+
+		tool = toolset.gettoolname(cfg, "ar")
+		if tool then
+			_p('  AR         = %s', tool)
 		end
 	end
-
-
------------------------------------------------------------------------------
--- Everything below this point is a candidate for deprecation
------------------------------------------------------------------------------
-
-
-	function premake.make_cpp(prj)
-		-- create a shortcut to the compiler interface
-		local cc = premake.gettool(prj)
-
-		-- build a list of supported target platforms that also includes a generic build
-		local platforms = premake.filterplatforms(prj.solution, cc.platforms, "Native")
-
-		premake.gmake_cpp_header(prj, cc, platforms)
-
-		for _, platform in ipairs(platforms) do
-			for cfg in premake.eachconfig(prj, platform) do
-				premake.gmake_cpp_config(cfg, cc)
-			end
-		end
-
-		-- list intermediate files
-		_p('OBJECTS := \\')
-		for _, file in ipairs(prj.files) do
-			if path.iscppfile(file) then
-				_p('\t$(OBJDIR)/%s.o \\', _MAKE.esc(path.getbasename(file)))
-			end
-		end
-		_p('')
-
-		_p('RESOURCES := \\')
-		for _, file in ipairs(prj.files) do
-			if path.isresourcefile(file) then
-				_p('\t$(OBJDIR)/%s.res \\', _MAKE.esc(path.getbasename(file)))
-			end
-		end
-		_p('')
-
-		-- 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('')
-
-		-- main build rule(s)
-		_p('.PHONY: clean prebuild prelink')
-		_p('')
-
-		if os.is("MacOSX") and prj.kind == "WindowedApp" 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@:')
-		_p('')
-
-		-- target build rule
-		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
-		_p('\t@echo Linking %s', prj.name)
-		_p('\t$(SILENT) $(LINKCMD)')
-		_p('\t$(POSTBUILDCMDS)')
-		_p('')
-
-		-- Create destination directories. Can't use $@ for this because it loses the
-		-- escaping, causing issues with spaces and parenthesis
-		_p('$(TARGETDIR):')
-		premake.make_mkdirrule("$(TARGETDIR)")
-
-		_p('$(OBJDIR):')
-		premake.make_mkdirrule("$(OBJDIR)")
-
-		-- Mac OS X specific targets
-		if os.is("MacOSX") and prj.kind == "WindowedApp" then
-			_p('$(dir $(TARGETDIR))PkgInfo:')
-			_p('$(dir $(TARGETDIR))Info.plist:')
-			_p('')
-		end
-
-		-- 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)
-
-		-- per-file rules
-		for _, file in ipairs(prj.files) do
-			if path.iscppfile(file) then
-				_p('$(OBJDIR)/%s.o: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
-				_p('\t@echo $(notdir $<)')
-				cpp.buildcommand_old(path.iscfile(file))
-			elseif (path.getextension(file) == ".rc") then
-				_p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file))
-				_p('\t@echo $(notdir $<)')
-				_p('\t$(SILENT) $(RESCOMP) $< -O coff -o "$@" $(RESFLAGS)')
-			end
-		end
-		_p('')
-
-		-- include the dependencies, built by GCC (with the -MMD flag)
-		_p('-include $(OBJECTS:%%.o=%%.d)')
-	end
-
-
-
---
--- Write the makefile header
---
-
-	function premake.gmake_cpp_header(prj, cc, platforms)
-		_p('# %s project makefile autogenerated by Premake', premake.action.current().shortname)
-
-		-- set up the environment
-		_p('ifndef config')
-		_p('  config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true)))
-		_p('endif')
-		_p('')
-
-		_p('ifndef verbose')
-		_p('  SILENT = @')
-		_p('endif')
-		_p('')
-
-		_p('ifndef CC')
-		_p('  CC = %s', cc.cc)
-		_p('endif')
-		_p('')
-
-		_p('ifndef CXX')
-		_p('  CXX = %s', cc.cxx)
-		_p('endif')
-		_p('')
-
-		_p('ifndef AR')
-		_p('  AR = %s', cc.ar)
-		_p('endif')
-		_p('')
-		
-		_p('ifndef RESCOMP')
-		_p('  ifdef WINDRES')
-		_p('    RESCOMP = $(WINDRES)')
-		_p('  else')
-		_p('    RESCOMP = windres')
-		_p('  endif')
-		_p('endif')
-		_p('')	
-	end
-
---
--- Write a block of configuration settings.
---
-
-	function premake.gmake_cpp_config(cfg, cc)
-
-		_p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname))
-
-		-- if this platform requires a special compiler or linker, list it here
-		cpp.platformtools_old(cfg, cc)
-
-		_p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))
-		_p('  TARGETDIR  = %s', _MAKE.esc(cfg.buildtarget.directory))
-		_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), " "))
-
-		-- CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, and RESFLAGS
-		cpp.flags_old(cfg, cc)
-
-		-- set up precompiled headers
-		cpp.pchconfig_old(cfg)
-
-		_p('  LIBS      += %s', table.concat(cc.getlinkflags(cfg), " "))
-		_p('  LDDEPS    += %s', table.concat(_MAKE.esc(premake.getlinks(cfg, "siblings", "fullpath")), " "))
-
-		if cfg.kind == "StaticLib" then
-			if cfg.platform:startswith("Universal") then
-				_p('  LINKCMD    = libtool -o $(TARGET) $(OBJECTS)')
-			else
-				_p('  LINKCMD    = $(AR) -rcs $(TARGET) $(OBJECTS)')
-			end
-		else
-			-- 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"))
-		end
-
-		_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')
-
-		-- write out config-level makesettings blocks
-		make.settings_old(cfg, cc)
-
-		_p('endif')
-		_p('')
-	end
-
-
---
--- Platform support
---
-
-	function cpp.platformtools_old(cfg, cc)
-		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
-
-
---
--- Configurations
---
-
-	function cpp.flags_old(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), " "))
-
-		-- Patch #3401184 changed the order
-		_p('  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),
-		                                cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
-	end
-
-
---
--- Precompiled header support
---
-
-	function cpp.pchconfig_old(cfg)
-		-- 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
-
-		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)))
-		end
-	end
-
-
---
--- Build command for a single file.
---
-
-	function cpp.buildcommand_old(iscfile)
-		local flags = iif(iscfile, '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)')
-		_p('\t$(SILENT) %s -o "$@" -MF $(@:%%.o=%%.d) -c "$<"', flags)
-	end
-
-

src/actions/make/make_csharp.lua

 -- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
+	premake.make.cs = {}
 	local make = premake.make
+	local cs = premake.make.cs
+	local project = premake5.project
+	local config = premake5.config
 
 
 --
-
 -- Generate a GNU make C# project makefile, with support for the new platforms API.
-
 --
 
+	function make.generate_csharp(prj)
+		-- I've only got one .NET toolset right now
+		local toolset = premake.tools.dotnet		
+		
+		make.header(prj)
 
-	function make.generate_csharp(prj)
-		print("** Warning: GMake C# projects have not been ported yet")
-	end
+		-- main build rule(s)
+		_p('.PHONY: clean prebuild prelink')
+		_p('')
 
-
-
------------------------------------------------------------------------------
--- Everything below this point is a candidate for deprecation
------------------------------------------------------------------------------
-
-
---
--- Given a .resx resource file, builds the path to corresponding .resource
--- file, matching the behavior and naming of Visual Studio.
---
-		
-	local function getresourcefilename(cfg, fname)
-		if path.getextension(fname) == ".resx" then
-		    local name = cfg.buildtarget.basename .. "."
-		    local dir = path.getdirectory(fname)
-		    if dir ~= "." then 
-				name = name .. path.translate(dir, ".") .. "."
-			end
-			return "$(OBJDIR)/" .. _MAKE.esc(name .. path.getbasename(fname)) .. ".resources"
-		else
-			return fname
-		end
-	end
-
-
-
---
--- Main function
---
-	
-	function premake.make_csharp(prj)
-		local csc = premake.dotnet
-
-		-- Do some processing up front: build a list of configuration-dependent libraries.
-		-- Libraries that are built to a location other than $(TARGETDIR) will need to
-		-- be copied so they can be found at runtime.
-		local cfglibs = { }
-		local cfgpairs = { }
-		local anycfg
-		for cfg in premake.eachconfig(prj) do
-			anycfg = cfg
-			cfglibs[cfg] = premake.getlinks(cfg, "siblings", "fullpath")
-			cfgpairs[cfg] = { }
-			for _, fname in ipairs(cfglibs[cfg]) do
-				if path.getdirectory(fname) ~= cfg.buildtarget.directory then
-					cfgpairs[cfg]["$(TARGETDIR)/" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname)
-				end
-			end
-		end
-		
-		-- sort the files into categories, based on their build action
-		local sources = {}
-		local embedded = { }
-		local copypairs = { }
-		
-		for fcfg in premake.project.eachfile(prj) do
-			local action = csc.getbuildaction(fcfg)
-			if action == "Compile" then
-				table.insert(sources, fcfg.name)
-			elseif action == "EmbeddedResource" then
-				table.insert(embedded, fcfg.name)
-			elseif action == "Content" then
-				copypairs["$(TARGETDIR)/" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name)
-			elseif path.getname(fcfg.name):lower() == "app.config" then
-				copypairs["$(TARGET).config"] = _MAKE.esc(fcfg.name)
-			end
+		for cfg in project.eachconfig(prj) do
+			cs.config(cfg, toolset)
 		end
 
-		-- Any assemblies that are on the library search paths should be copied
-		-- to $(TARGETDIR) so they can be found at runtime
-		local paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end)
-		paths = table.join({prj.basedir}, paths)
-		for _, libname in ipairs(premake.getlinks(prj, "system", "fullpath")) do
-			local libdir = os.pathsearch(libname..".dll", unpack(paths))
-			if (libdir) then
-				local target = "$(TARGETDIR)/" .. _MAKE.esc(path.getname(libname))
-				local source = path.getrelative(prj.basedir, path.join(libdir, libname))..".dll"
-				copypairs[target] = _MAKE.esc(source)
+		local firstcfg = project.getfirstconfig(prj)
+		cs.prj_config(firstcfg, toolset)
+
+		-- list source files
+		_p('SOURCES += \\')
+		cs.listsources(prj, function(node)
+			if toolset.getbuildaction(node) == "Compile" then
+				return node.relpath
 			end
-		end
-		
-		-- end of preprocessing --
-
-
-		-- set up the environment
-		_p('# %s project makefile autogenerated by Premake', premake.action.current().shortname)
-		_p('')
-		
-		_p('ifndef config')
-		_p('  config=%s', _MAKE.esc(prj.configurations[1]:lower()))
-		_p('endif')
-		_p('')
-		
-		_p('ifndef verbose')
-		_p('  SILENT = @')
-		_p('endif')
-		_p('')
-		
-		_p('ifndef CSC')
-		_p('  CSC=%s', csc.getcompilervar(prj))
-		_p('endif')
-		_p('')
-		
-		_p('ifndef RESGEN')
-		_p('  RESGEN=resgen')
-		_p('endif')
+		end)
 		_p('')
 
-		-- Platforms aren't support for .NET projects, but I need the ability to match
-		-- the buildcfg:platform identifiers with a block of settings. So enumerate the
-		-- pairs the same way I do for C/C++ projects, but always use the generic settings
-		local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms)
-		table.insert(platforms, 1, "")
-
-		-- write the configuration blocks
-		for cfg in premake.eachconfig(prj) do
-			premake.gmake_cs_config(cfg, csc, cfglibs)
-		end
-
-		-- set project level values
-		_p('# To maintain compatibility with VS.NET, these values must be set at the project level')
-		_p('TARGET     := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name))
-		_p('FLAGS      += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), "/lib:", "", " "))
-		_p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, "system", "basename")), "/r:", ".dll", " "))
-		_p('')
-		
-		-- list source files
-		_p('SOURCES := \\')
-		for _, fname in ipairs(sources) do
-			_p('\t%s \\', _MAKE.esc(path.translate(fname)))
-		end
-		_p('')
-		
-		_p('EMBEDFILES := \\')
-		for _, fname in ipairs(embedded) do
-			_p('\t%s \\', getresourcefilename(prj, fname))
-		end
+		_p('EMBEDFILES += \\')
+		cs.listsources(prj, function(node)
+			if toolset.getbuildaction(node) == "EmbeddedResource" then
+				return cs.getresourcefilename(firstcfg, node.relpath)
+			end
+		end)
 		_p('')
 
+		--[[
 		_p('COPYFILES += \\')
 		for target, source in pairs(cfgpairs[anycfg]) do
 			_p('\t%s \\', target)
 			_p('\t%s \\', target)
 		end
 		_p('')
-
-		-- 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('')
-
-		-- main build rule(s)
-		_p('.PHONY: clean prebuild prelink')
-		_p('')
+		--]]
+		
+		make.detectshell()
 		
 		_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')