Commits

Andrew Gough committed 77bf7a9 Merge

Rebased to upstream premake/premake-dev

Comments (0)

Files changed (168)

+syntax: glob
+
+.DS_Store
+
+*.orig
+*~
+
+build
+bin
+obj
+release
+ipch
+src/host/scripts.c
+
+Makefile
+*.make
+*.xcodeproj
+*.swp
+*.sdf
+*.sln
+*.suo
+*.ncb
+*.vcproj*
+*.vcxproj*
+*.opensdf
+*.workspace
+*.project
+*.tags
+
+*.bbprojectsettings
+Scratchpad.txt
+Unix Worksheet.worksheet
+project.bbprojectdata
+Premake4.tmproj
 
 .DS_Store
 
-*.orig
-
 build
 bin
 obj
 Scratchpad.txt
 Unix Worksheet.worksheet
 project.bbprojectdata
-Premake4.tmproj
+Premake4.tmproj
+--------
+  4.5 (in progress)
+--------
+
+* Completely overhauled the platform support; too many changes to list
+* Enabled per-project configurations and platforms
+* Enabled per-configuration file lists
+* Enabled per-configuration toolset selection
+* Added custom build rules
+* Added external() to reference non-Premake generated projects
+* Added remove...() API to remove values from list fields
+* Folders containing single sub-folder now trimmed from top of source tree
+* Added debugformat with C7 support for Visual Studio
+* The error message for invalid flags now includes the offending value
+* The include() function will now include each file only once
+* The include() function can now include specific files
+* path.translate() now defaults to Windows-style backslashes
+* Added NoWarnings flag for Visual Studio (xpol)
+* Added debugcommand for Visual Studio (xpol)
+* Bug 1674173: Allow source files to have the same name
+
+
 -------
   4.4  (in progress)
 -------
 * Patch 3429777: Support for DragonFly BSD (Joachim de Groot)
 * Patch 3445049: Build fix for FreeBSD (Konstantin Tokarev)
 * Bug 3121217: Test suite fails on Linux x86_64: os.findlib broken
+* Patch 3428348: Add .gitignore file (Konstantin Tokarev)
+* Patch 3430158: Reorder LINKCMD for Gmake (rjmyst3)
+* Patch 3451212: Fix Visual Studio MFC with StaticRuntime
+* Patch 3463020: Add windres environment variable for makefiles (icebreaker)
+* Bug 3413866: Incorrect VS200x .csproj relative source paths
+* Patch 3111264: Allow path.join() to accept any number of args
+* Patch 3353975: Support usage of premake as a library (Konstantin Tokarev)
+* Patch 3505903: Fix VC2010 project reference paths (Pavel Czerný)
+* Patch 3305599: Add -Wextra to ExtraWarnings (ergosys)
 
 
 -------
-Copyright (c) 2003-2011 Jason Perkins and individual contributors.
+Copyright (c) 2003-2012 Jason Perkins and individual contributors.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification,
 PREMAKE
 A build configuration tool
 
- Copyright (C) 2002-2011 by Jason Perkins
+ Copyright (C) 2002-2012 by Jason Perkins
  Distributed under the terms of the BSD License, see LICENSE.txt
 
  The Lua language and runtime library is (C) TeCGraf, PUC-Rio.
 
 		excludes
 		{
-			"src/premake.lua",
 			"src/host/lua-5.1.4/src/lua.c",
 			"src/host/lua-5.1.4/src/luac.c",
 			"src/host/lua-5.1.4/src/print.c",
 		configuration "vs2005"
 			defines	{"_CRT_SECURE_NO_DEPRECATE" }
 
+		configuration "windows"
+			links { "ole32" }
+
 		configuration "linux"
 			defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
 			links       { "m", "dl" } 

samples/complex_platforms/premake4.lua

+solution "MySolution"
+
+	configurations { 
+		"Debug", 
+		"Deployment", 
+		"Profiling", 
+		"Release" 
+	}
+
+	platforms {
+		"Win32 Static SCRT",
+		"Win32 Static DCRT",
+		"Win32 DLL",
+		"Win64 Static SCRT",
+		"Win64 Static DCRT",
+		"Win64 DLL",
+		"PS3 PPU GCC",
+		"PS3 PPU SN",
+		"PS3 SPU GCC",
+		"PS3 SPU SN"
+	}
+
+
+--
+-- Map the platforms to their underlying architectures.
+--
+	
+	configuration { "Win32 *" }
+		architecture "x32"
+		os "windows"
+		
+ 	configuration { "Win64 *" }
+		architecture "x64"
+		os "windows"
+
+	configuration { "* PPU *" }
+		architecture "ps3ppu"
+		
+	configuration { "* SPU *" }
+		architecture "ps3spu"
+	
+	configuration { "* GCC" }
+		compiler "gcc"
+		
+	configuration { "* SN" }
+		compiler "sn"

samples/vs2008/CppConsoleApp/CppConsoleApp.cpp

+// CppConsoleApp.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+	return 0;
+}
+

samples/vs2008/CppConsoleApp/ReadMe.txt

+========================================================================
+    CONSOLE APPLICATION : CppConsoleApp Project Overview
+========================================================================
+
+AppWizard has created this CppConsoleApp application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your CppConsoleApp application.
+
+
+CppConsoleApp.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard.
+    It contains information about the version of Visual C++ that generated the file, and
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+CppConsoleApp.cpp
+    This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named CppConsoleApp.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////

samples/vs2008/CppConsoleApp/stdafx.cpp

+// stdafx.cpp : source file that includes just the standard includes
+// CppConsoleApp.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file

samples/vs2008/CppConsoleApp/stdafx.h

+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include <stdio.h>
+#include <tchar.h>
+
+
+
+// TODO: reference additional headers your program requires here

samples/vs2008/CppConsoleApp/targetver.h

+#pragma once
+
+// The following macros define the minimum required platform.  The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run 
+// your application.  The macros work by enabling all features available on platform versions up to and 
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
+#endif
+

samples/vs2008/CppExe/CppExe.vcproj

-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="CppExe"
-	ProjectGUID="{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}"
-	RootNamespace="CppExe"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="2"
-				WarningLevel="3"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="1"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="2"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\CppExe.cpp"
-				>
-			</File>
-			<File
-				RelativePath=".\stdafx.cpp"
-				>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						UsePrecompiledHeader="1"
-					/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\stdafx.h"
-				>
-			</File>
-			<File
-				RelativePath=".\targetver.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-		<File
-			RelativePath=".\ReadMe.txt"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

samples/vs2008/MySolution.sln

 
 Microsoft Visual Studio Solution File, Format Version 10.00
 # Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppExe", "CppExe\CppExe.vcproj", "{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppConsoleApp", "CppConsoleApp\CppConsoleApp.vcproj", "{ED6D7B68-0231-4009-817B-AAA66F4F863D}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Debug|Win32.ActiveCfg = Debug|Win32
-		{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Debug|Win32.Build.0 = Debug|Win32
-		{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Release|Win32.ActiveCfg = Release|Win32
-		{790A1FC0-287D-4F4A-8AE8-D0B48406BECF}.Release|Win32.Build.0 = Release|Win32
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Debug|Win32.Build.0 = Debug|Win32
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Debug|x64.ActiveCfg = Debug|x64
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Debug|x64.Build.0 = Debug|x64
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Release|Win32.ActiveCfg = Release|Win32
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Release|Win32.Build.0 = Release|Win32
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Release|x64.ActiveCfg = Release|x64
+		{ED6D7B68-0231-4009-817B-AAA66F4F863D}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

scripts/embed.lua

 		
 		-- strip any CRs
 		s = s:gsub("[\r]", "")
+				
+		-- strip out block comments
+		s = s:gsub("%-%-%[%[.-%-%-%]%]", "")
+
+		-- strip out inline comments
+		s = s:gsub("\n%-%-[^\n]*", "")
 		
-		-- strip out comments
-		s = s:gsub("\n%-%-[^\n]*", "")
-				
 		-- escape backslashes
 		s = s:gsub("\\", "\\\\")
 

src/_manifest.lua

 --
 -- _manifest.lua
 -- Manage the list of built-in Premake scripts.
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
 -- The master list of built-in scripts. Order is important! If you want to
 		"base/action.lua",
 		"base/option.lua",
 		"base/tree.lua",
-		"base/solution.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",
+		
+		-- project APIs
+		"project/oven.lua",
+		"project/project.lua",
+		"project/config.lua",
+		"base/solution.lua",
+
+		-- tool APIs
 		"tools/dotnet.lua",
 		"tools/gcc.lua",
 		"tools/msc.lua",
 		"tools/dmd.lua",
 		"tools/gdc.lua",
 		"tools/ldc.lua",
-		"base/validate.lua",
-		"base/help.lua",
-		"base/premake.lua",
 		
 		-- CodeBlocks action
 		"actions/codeblocks/_codeblocks.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",

src/_premake_main.lua

 		if (not ok) then error("Error: " .. err, 0) end
 
 		
-		-- work-in-progress: build the configurations
+		-- 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...")
-		premake.bake.buildconfigs()
-		
-		ok, err = premake.checkprojects()
-		if (not ok) then error("Error: " .. err, 0) end
-		
+		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)

src/actions/make/_make.lua

 --
 -- _make.lua
 -- Define the makefile action(s).
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
-	_MAKE = { }
 	premake.make = { }
 	local make = premake.make
+	local solution = premake.solution
+	local project = premake5.project
+
+--
+-- The GNU make action, with support for the new platforms API
+--
+
+	newaction {
+		trigger         = "gmakeng",
+		shortname       = "GNU Make Next-gen",
+		description     = "Experimental GNU makefiles for POSIX, MinGW, and Cygwin",
+
+		-- temporary, until I can phase out the legacy implementations
+		isnextgen = true,
+		
+		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
+
+		valid_languages = { "C", "C++", "C#" },
+
+		valid_tools     = {
+			cc     = { "gcc"   },
+			dotnet = { "mono", "msnet", "pnet" }
+		},
+
+		onsolution = function(sln)
+			premake.generate(sln, make.getmakefilename(sln, false), make.generate_solution)
+		end,
+
+		onproject = function(prj)
+			local makefile = make.getmakefilename(prj, true)
+			if premake.isdotnetproject(prj) then
+				premake.generate(prj, makefile, make.generate_csharp)
+			else
+				premake.generate(prj, makefile, make.cpp.generate)
+			end
+		end,
+		
+		oncleansolution = function(sln)
+			premake.clean.file(sln, make.getmakefilename(sln, false))
+		end,
+		
+		oncleanproject = function(prj)
+			premake.clean.file(prj, make.getmakefilename(prj, true))
+		end
+	}
+
+
+--
+-- Write out the default configuration rule for a solution or project.
+-- @param target
+--    The solution or project object for which a makefile is being generated.
+--
+
+	function make.defaultconfig(target)
+		-- find the configuration iterator function
+		local eachconfig = iif(target.project, project.eachconfig, solution.eachconfig)
+		local iter = eachconfig(target)
+		
+		-- grab the first configuration and write the block
+		local cfg = iter()
+		if cfg then
+			_p('ifndef config')
+			_p('  config=%s', make.esc(cfg.shortname))
+			_p('endif')
+			_p('export config')
+			_p('')
+		end
+	end
+
+
+--
+-- Escape a string so it can be written to a makefile.
+--
+
+	function make.esc(value)
+		local result
+		if (type(value) == "table") then
+			result = { }
+			for _,v in ipairs(value) do
+				table.insert(result, _MAKE.esc(v))
+			end
+			return result
+		else
+			-- handle simple replacements
+			result = value:gsub("\\", "\\\\")
+			result = result:gsub(" ", "\\ ")
+			result = result:gsub("%(", "\\%(")
+			result = result:gsub("%)", "\\%)")
+			
+			-- leave $(...) shell replacement sequences alone
+			result = result:gsub("$\\%((.-)\\%)", "$%(%1%)")
+			return result
+		end
+	end
+
+
+--
+-- Get the makefile file name for a solution or a project. If this object is the
+-- only one writing to a location then I can use "Makefile". If more than one object
+-- writes to the same location I use name + ".make" to keep it unique.
+--
+
+	function make.getmakefilename(this, searchprjs)
+		local count = 0
+		for sln in premake.solution.each() do
+			if sln.location == this.location then 
+				count = count + 1 
+			end
+			
+			if searchprjs then
+				for _, prj in ipairs(sln.projects) do
+					if prj.location == this.location then
+						count = count + 1
+					end
+				end
+			end
+		end
+		
+		if count == 1 then
+			return "Makefile"
+		else
+			return this.name .. ".make"
+		end
+	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?)
+--
+
+	function make.copyrule(source, target)
+		_p('%s: %s', target, source)
+		_p('\t@echo Copying $(notdir %s)', target)
+		_p('ifeq (posix,$(SHELLTYPE))')
+		_p('\t$(SILENT) cp -fR %s %s', source, target)
+		_p('else')
+		_p('\t$(SILENT) copy /Y $(subst /,\\\\,%s) $(subst /,\\\\,%s)', source, target)
+		_p('endif')
+	end
+
+	function make.mkdirrule(dirname)
+		_p('%s:', dirname)
+		_p('\t@echo Creating %s', dirname)
+		_p('ifeq (posix,$(SHELLTYPE))')
+		_p('\t$(SILENT) mkdir -p %s', dirname)
+		_p('else')
+		_p('\t$(SILENT) mkdir $(subst /,\\\\,%s)', dirname)
+		_p('endif')
+		_p('')
+	end	
+
+
+--
+-- Write out raw makefile rules for a configuration.
+--
+
+	function make.settings(cfg, toolset)
+		if #cfg.makesettings > 0 then
+			for _, value in ipairs(cfg.makesettings) do
+				_p(value)
+			end
+		end
+		
+		local sysflags = toolset.sysflags[cfg.architecture] or toolset.sysflags[cfg.system] or {}
+		if sysflags.cfgsettings then
+			_p(sysflags.cfgsettings)
+		end
+	end
+
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
+
+	_MAKE = { }
+
 
 --
 -- Escape a string so it can be written to a makefile.
 	
 
 --
--- Get the makefile file name for a solution or a project. If this object is the
--- only one writing to a location then I can use "Makefile". If more than one object
--- writes to the same location I use name + ".make" to keep it unique.
---
-
-	function _MAKE.getmakefilename(this, searchprjs)
-		-- how many projects/solutions use this location?
-		local count = 0
-		for sln in premake.solution.each() do
-			if (sln.location == this.location) then count = count + 1 end
-			if (searchprjs) then
-				for _,prj in ipairs(sln.projects) do
-					if (prj.location == this.location) then count = count + 1 end
-				end
-			end
-		end
-		
-		if (count == 1) then
-			return "Makefile"
-		else
-			return this.name .. ".make"
-		end
-	end
-	
-
---
 -- Returns a list of object names, properly escaped to be included in the makefile.
 --
 
 -- Write out the raw settings blocks.
 --
 
-	function make.settings(cfg, cc)
+	function make.settings_old(cfg, cc)
 		if #cfg.makesettings > 0 then
 			for _, value in ipairs(cfg.makesettings) do
 				_p(value)
 		},
 		
 		onsolution = function(sln)
-			premake.generate(sln, _MAKE.getmakefilename(sln, false), premake.make_solution)
+			premake.generate(sln, make.getmakefilename(sln, false), premake.make_solution)
 		end,
 		
 		onproject = function(prj)
-			local makefile = _MAKE.getmakefilename(prj, true)
+			local makefile = make.getmakefilename(prj, true)
 			if premake.isdotnetproject(prj) then
 				premake.generate(prj, makefile, premake.make_csharp)
 			elseif premake.iscppproject(prj) then
 		end,
 		
 		oncleansolution = function(sln)
-			premake.clean.file(sln, _MAKE.getmakefilename(sln, false))
+			premake.clean.file(sln, make.getmakefilename(sln, false))
 		end,
 		
 		oncleanproject = function(prj)
-			premake.clean.file(prj, _MAKE.getmakefilename(prj, true))
+			premake.clean.file(prj, make.getmakefilename(prj, true))
 		end
 	}

src/actions/make/make_cpp.lua

 --
 
 	premake.make.cpp = { }
+	local make = premake.make
 	local cpp = premake.make.cpp
-	local make = premake.make
-	
+	local project = premake5.project
+	local config = premake5.config
 
-	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
+--
+-- Generate a GNU make C++ project makefile, with support for the new platforms API.
+--
+
+	function make.cpp.generate(prj)
+		cpp.header(prj)
+
+		-- main build rule(s)
+		_p('.PHONY: clean prebuild prelink')
+		_p('')
+
+		for cfg in project.eachconfig(prj) do
+			cpp.config(cfg)
 		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('')
- 
+		cpp.objects(prj)
+		
 		-- identify the shell type
 		_p('SHELLTYPE := msdos')
 		_p('ifeq (,$(ComSpec)$(COMSPEC))')
 		_p('  SHELLTYPE := posix')
 		_p('endif')
 		_p('')
+
+		-- common build target rules
+		_p('all: $(TARGETDIR) $(OBJDIR) prebuild prelink $(TARGET)')
+		_p('\t@:')
+		_p('')
+
+		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
+		_p('\t@echo Linking %s', prj.name)
+		_p('\t$(SILENT) $(LINKCMD)')
+		_p('\t$(POSTBUILDCMDS)')
+		_p('')
+
+		make.mkdirrule("$(TARGETDIR)")
+		make.mkdirrule("$(OBJDIR)")
+	
+		-- 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)
+
+		-- file building rules
+		cpp.filerules(prj)
 		
+		-- include the dependencies, built by GCC (with the -MMD flag)
+		_p('-include $(OBJECTS:%%.o=%%.d)')
+	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.
+--
+
+	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))
+
+		-- write toolset specific configurations
+		cpp.toolconfig(cfg, toolset)
+
+		-- write target information (target dir, name, obj dir)
+		cpp.targetconfig(cfg)
+		
+		-- write flags
+		cpp.flags(cfg, toolset)
+
+		-- set up precompiled headers
+		cpp.pchconfig(cfg)
+
+		-- write the link step
+		cpp.linkconfig(cfg, toolset)
+
+		-- write the custom build commands		
+		_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')
+		_p('')
+		
+		-- write the target building rule
+		-- cpp.targetrules(cfg)
+		
+		-- write out config-level makesettings blocks
+		make.settings(cfg, toolset)
+
+		_p('endif')
+		_p('')	
+	end
+
+
+--
+-- Build command for a single file.
+--
+
+	function cpp.buildcommand(prj)
+		local flags = iif(prj.language == "C", '$(CC) $(CFLAGS)', '$(CXX) $(CXXFLAGS)')
+		_p('\t$(SILENT) %s -o "$@" -MF $(@:%%.o=%%.d) -c "$<"', flags)
+	end
+
+
+--
+-- Output the list of file building rules.
+--
+
+	function cpp.filerules(prj)
+		local tr = project.getsourcetree(prj)
+		premake.tree.traverse(tr, {
+			onleaf = function(node, depth)
+				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 $<)')
+					cpp.buildcommand(prj)
+				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
+		})
+		_p('')
+	end
+
+
+--
+-- Compile flags
+--
+
+	function cpp.flags(cfg, toolset)
+		_p('  DEFINES   += %s', table.concat(toolset.getdefines(cfg.defines), " "))
+		_p('  INCLUDES  += %s', table.concat(make.esc(toolset.getincludedirs(cfg.includedirs), " ")))
+		_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), " "))
+	
+		local resflags = table.join(toolset.getdefines(cfg.resdefines), toolset.getincludedirs(cfg.resincludedirs), cfg.resoptions)
+		_p('  RESFLAGS  += $(DEFINES) $(INCLUDES) %s', table.concat(resflags, " "))
+	end
+
+
+--
+-- 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
+
+
+--
+-- List the objects file for the project, and each configuration.
+--
+
+	function cpp.objects(prj)
+		-- create lists for intermediate files, at the project level and
+		-- for each configuration
+		local root = { objects={}, resources={} }
+		local configs = {}		
+		for cfg in project.eachconfig(prj) do
+			configs[cfg] = { objects={}, resources={} }
+		end
+
+		-- for each file in the iterator below, keep track of which
+		-- configurations to which it belongs
+		local incfg = {}
+
+		-- now walk the list of files in the project
+		local tr = project.getsourcetree(prj)
+		premake.tree.traverse(tr, {
+			onleaf = function(node, depth)
+				-- 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 kind then
+					return
+				end
+
+				-- assign a unique object file name to avoid collisions from
+				-- files at different folder levels with the same name
+				local objectname = project.getfileobject(prj, node.abspath)
+
+				-- see what set of configurations contains this file
+				local inallcfgs = true
+				for cfg in project.eachconfig(prj) do
+					local filecfg = config.getfileconfig(cfg, node.abspath)
+					incfg[cfg] = (filecfg ~= nil)
+					if not filecfg then
+						inallcfgs = false
+					end
+				end
+
+				-- if this file exists in all configurations, write it to
+				-- the project's list of files, else add to specific cfgs
+				if inallcfgs 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
+				
+			end
+		})
+		
+		-- now I can write out the lists, project level first...
+		function listobjects(var, list, ext)
+			_p('%s \\', var)
+			for _, objectname in ipairs(list) do
+				_p('\t$(OBJDIR)/%s.%s \\', make.esc(objectname), ext)
+			end
+			_p('')
+		end
+		
+		listobjects('OBJECTS :=', root.objects, 'o')
+		listobjects('RESOURCES :=', root.resources, 'res')
+		
+		-- ...then individual configurations, as needed
+		for cfg in project.eachconfig(prj) do
+			local files = configs[cfg]
+			if #files.objects > 0 or #files.resources > 0 then
+				_p('ifeq ($(config),%s)', make.esc(cfg.shortname))
+				if #files.objects > 0 then
+					listobjects('  OBJECTS +=', files.objects, 'o')
+				end
+				if #files.resources > 0 then
+					listobjects('  RESOURCES +=', files.resources, 'res')
+				end
+				_p('endif')
+				_p('')
+			end
+		end
+	end
+
+
+--
+-- 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')
+		cpp.buildcommand(prj)
+		_p('endif')
+		_p('')
+	end
+
+
+--
+-- Target (name, dir) configuration.
+--
+
+	function cpp.targetconfig(cfg)		
+		local targetinfo = config.gettargetinfo(cfg)
+		_p('  OBJDIR     = %s', make.esc(project.getrelative(cfg.project, cfg.objdir)))
+		_p('  TARGETDIR  = %s', make.esc(targetinfo.directory))
+		_p('  TARGET     = $(TARGETDIR)/%s', make.esc(targetinfo.name))
+	end
+
+
+--
+-- 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@:')
+		_p('')
+		
+		if macapp then
+			_p('$(dir $(TARGETDIR))PkgInfo:')
+			_p('$(dir $(TARGETDIR))Info.plist:')
+			_p('')
+		end
+	end
+
+
+--
+-- System specific toolset configuration.
+--
+
+	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)
+		end
+		if sysflags.cxx then
+			_p('  CXX        = %s', sysflags.cxx)
+		end
+		if sysflags.ar then
+			_p('  AR         = %s', sysflags.ar)
+		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('')
 		_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)")
 
 		_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(path.iscfile(file))
+				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) windres $< -O coff -o "$@" $(RESFLAGS)')
+				_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
 		_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(cfg, cc)
+		cpp.platformtools_old(cfg, cc)
 
-		_p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))		
+		_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(cfg, cc)
+		-- CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, and RESFLAGS
+		cpp.flags_old(cfg, cc)
 
 		-- set up precompiled headers
-		cpp.pchconfig(cfg)
-				
+		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)')
 				_p('  LINKCMD    = $(AR) -rcs $(TARGET) $(OBJECTS)')
 			end
 		else
-			-- this was $(TARGET) $(LDFLAGS) $(OBJECTS) ... but was having trouble linking to certain 
-			-- static libraries so $(OBJECTS) was moved up
-			_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)', iif(cfg.language == "C", "CC", "CXX"))
+			-- 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.postbuildcommands, "", "", "\n\t"))
 		end
 		_p('  endef')
-		
+
 		-- write out config-level makesettings blocks
-		make.settings(cfg, cc)
-		
+		make.settings_old(cfg, cc)
+
 		_p('endif')
 		_p('')
 	end
-	
-	
+
+
 --
 -- Platform support
 --
-	
-	function cpp.platformtools(cfg, cc)
+
+	function cpp.platformtools_old(cfg, cc)
 		local platform = cc.platforms[cfg.platform]
 		if platform.cc then
 			_p('  CC         = %s', platform.cc)
 			_p('  AR         = %s', platform.ar)
 		end
 	end
-	
-	
+
+
 --
 -- Configurations
 --
 
-	function cpp.flags(cfg, cc)
+	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', 
+
+		_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(cfg)
+	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.
 
 		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('  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
 
-	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')
-		cpp.buildcommand(prj.language == "C")
-		_p('endif')
-		_p('')
-	end
-	
 
 --
 -- Build command for a single file.
 --
 
-	function cpp.buildcommand(iscfile)
+	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

 --
 -- make_csharp.lua
 -- Generate a C# project makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
+	local make = premake.make
+
+
+--
+
+-- Generate a GNU make C# project makefile, with support for the new platforms API.
+
+--
+
+
+	function make.generate_csharp(prj)
+		print("** Warning: GMake C# projects have not been ported yet")
+	end
+
+
+
+-----------------------------------------------------------------------------
+-- 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.

src/actions/make/make_solution.lua

 --
 -- make_solution.lua
 -- Generate a solution-level makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
 --
 
+	local make = premake.make
+	local solution = premake.solution
+	local project = premake5.project
+
+
+--
+-- Generate a GNU make "solution" makefile, with support for the new platforms API.
+--
+
+	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.defaultconfig(sln)
+		make.projects(sln)
+
+		_p('.PHONY: all clean help $(PROJECTS)')
+		_p('')
+		_p('all: $(PROJECTS)')
+		_p('')
+
+		make.projectrules(sln)
+		make.cleanrules(sln)
+		make.helprule(sln)
+	end
+
+
+--
+-- Write out the rules for the `make clean` action.
+--
+
+	function make.cleanrules(sln)
+		_p('clean:')
+		for prj in solution.eachproject_ng(sln) do
+			local slnpath = solution.getlocation(sln)
+			local prjpath = path.getrelative(slnpath, project.getlocation(prj))
+			_p(1,'@${MAKE} --no-print-directory -C %s -f %s clean', make.esc(prjpath), make.esc(make.getmakefilename(prj, true)))
+		end
+		_p('')
+	end
+
+
+--
+-- Write out the make file help rule and configurations list.
+--
+
+	function make.helprule(sln)
+		_p('help:')
+		_p(1,'@echo "Usage: make [config=name] [target]"')
+		_p(1,'@echo ""')
+		_p(1,'@echo "CONFIGURATIONS:"')
+
+		for cfg in solution.eachconfig(sln) do
+			_p(1, '@echo "  %s"', make.esc(cfg.shortname))
+		end
+
+		_p(1,'@echo ""')
+
+		_p(1,'@echo "TARGETS:"')
+		_p(1,'@echo "   all (default)"')
+		_p(1,'@echo "   clean"')
+
+		for prj in solution.eachproject_ng(sln) do
+			_p(1,'@echo "   %s"', prj.name)
+		end
+
+		_p(1,'@echo ""')
+		_p(1,'@echo "For more information, see http://industriousone.com/premake/quick-start"')
+	end
+
+
+--
+-- Write out the list of projects that comprise the solution.
+--
+
+	function make.projects(sln)
+		_p('PROJECTS := %s', table.concat(make.esc(table.extract(sln.projects, "name")), " "))
+		_p('')
+	end
+
+
+--
+-- Write out the rules to build each of the solution's projects.
+--
+
+	function make.projectrules(sln)
+		for prj in solution.eachproject_ng(sln) do
+			local deps = project.getdependencies(prj)
+			deps = table.extract(deps, "name")			
+			_p('%s: %s', make.esc(prj.name), make.esc(table.concat(deps, " ")))
+			
+			_p(1,'@echo "==== Building %s ($(config)) ===="', prj.name)
+
+			local slnpath = solution.getlocation(sln)
+			local prjpath = path.getrelative(slnpath, project.getlocation(prj))
+			_p(1,'@${MAKE} --no-print-directory -C %s -f %s', make.esc(prjpath), make.esc(make.getmakefilename(prj, true)))
+			
+			_p('')
+		end
+	end
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
+
 	function premake.make_solution(sln)
 		-- create a shortcut to the compiler interface
 		local cc = premake[_OPTIONS.cc]
 		for _, prj in ipairs(sln.projects) do
 			_p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), "name")), " "))
 			_p('\t@echo "==== Building %s ($(config)) ===="', prj.name)
-			_p('\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))
+			_p('\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(make.getmakefilename(prj, true)))
 			_p('')
 		end
 
 		-- clean rules
 		_p('clean:')
 		for _ ,prj in ipairs(sln.projects) do
-			_p('\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))
+			_p('\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(make.getmakefilename(prj, true)))
 		end
 		_p('')
 		

src/actions/vstudio/_vstudio.lua

---
--- _vstudio.lua
--- Define the Visual Studio 200x actions.
--- Copyright (c) 2008-2011 Jason Perkins and the Premake project
---
-
-	premake.vstudio = { }
-	local vstudio = premake.vstudio
-
-
---
--- Map Premake platform identifiers to the Visual Studio versions. Adds the Visual
--- Studio specific "any" and "mixed" to make solution generation easier.
---
-
-	vstudio.platforms = { 
-		any     = "Any CPU", 
-		mixed   = "Mixed Platforms", 
-		Native  = "Win32",
-		x86     = "x86",
-		x32     = "Win32", 
-		x64     = "x64",
-		PS3     = "PS3",
-		Xbox360 = "Xbox 360",
-	}
-
-	
-
---
--- Returns the architecture identifier for a project.
--- Used by the solutions.
---
-
-	function vstudio.arch(prj)
-		if (prj.language == "C#") then
-			if (_ACTION < "vs2005") then
-				return ".NET"
-			else
-				return "Any CPU"
-			end
-		else
-			return "Win32"
-		end
-	end
-	
-	
-
---
--- Process the solution's list of configurations and platforms, creates a list
--- of build configuration/platform pairs in a Visual Studio compatible format.
---
-
-	function vstudio.buildconfigs(sln)
-		local cfgs = { }
-		
-		local platforms = premake.filterplatforms(sln, vstudio.platforms, "Native")
-
-		-- Figure out what's in this solution
-		local hascpp    = premake.hascppproject(sln)
-		local hasdotnet = premake.hasdotnetproject(sln)
-
-		-- "Mixed Platform" solutions are generally those containing both
-		-- C/C++ and .NET projects. Starting in VS2010, all .NET solutions
-		-- also contain the Mixed Platform option.
-		if hasdotnet and (_ACTION > "vs2008" or hascpp) then
-			table.insert(platforms, 1, "mixed")
-		end
-		
-		-- "Any CPU" is added to solutions with .NET projects. Starting in
-		-- VS2010, only pure .NET solutions get this option.
-		if hasdotnet and (_ACTION < "vs2010" or not hascpp) then
-			table.insert(platforms, 1, "any")