Yuriy O'Donnell avatar Yuriy O'Donnell committed 06e99c6 Merge

merged with latest premake-dev

Comments (0)

Files changed (176)

+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
 *.sdf
 *.sln
 *.suo
+*.ncb
 *.vcproj*
 *.vcxproj*
 *.opensdf
+*.workspace
+*.project
+*.tags
+
+*.bbprojectsettings
+Scratchpad.txt
+Unix Worksheet.worksheet
+project.bbprojectdata
+Premake4.tmproj
 b356c6f751e085dad8d264143e9ae0dabe78423d 4.3-beta1
 1dd035de5b6dba46c32decd97269ceb70dc61f4b 4.3-rc2
 582630d7b7d40abb096131e822e2ea0376296a73 4.3
+79873394f6f666b593816d4f513c8f646737e265 4.4-beta1
+8f58c46b28369862039dbc3e57cd7a46baf7afdd 4.4-beta2
+84f69f787603f2dede4123965933e02de11724fb 4.4-beta3
+--------
+  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 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
+
+
 -------
   4.4  (in progress)
 -------
 
+* Feature 1590022: Source file filtering and grouping
+* Feature 3100379: C# support for Visual Studio 2010
+* Feature 1657833: Set working directory for debugging
 * Added support for Haiku OS (Yuriy O'Donnell)
 * Patch 2963313: Enable setting .NET framework version (Justen Hyde)
 * Switched PS3 builds from GCC to SNC
 * Ignore NoRTTI flag for Managed C++ projects (Nick Darnell)
-
-
--------
- 4.3.1 (in progress)
--------
-
+* Added host.is64bit
+* Added os.getversion
+* Patch 3140456: Explicitly specify architecture for VS StaticLib (Brian Mazza)
 * Bug 3119793: Fixed ClCompile blocks with vs10 and PCH (Dan Dunham)
 * Bug 2920784: Symbol visibility in Xcode3 libraries (burnson2)
 * Bug 3133743: Sets ONLY_ACTIVE_ARCH = YES in Xcode debug builds (James Wynn)
 * Properly pass return codes back to shell in release builds
 * Bug 3135734: Remove WholeProgramOptimization setting in vs10 (doug)
+* Bug 3138377: Link dependencies ignored within "SharedLib" configuration
+* Bug 3163703: pdb file being set in the wrong section. (hodsondd)
+* Bug 3157645: Full path for xcode frameworks
+* Bug 3232160: Environment variables are cut off
+* Patch 3043933 Allow gmake to use static lib when shared lib of same name exists (Jonathan Derque)
+* Bug 3294459: vs10 x86_64 using incorrect debug format for minimal rebuild (learner)
+* Bug 3297634: Special characters in directory name Xcode3 (jdale)
+* Feature 3100194: English aliases for Optimize flags
+* Bug 3308203: Incorrect relative paths for gmake sibling static libraries (Adam)
+* Bug 3277343: SM_SERVERR2 is not always defined by default (Martin Ridgers)
+* Added os.stat
+* Bug 3381149: Path of PCH source file in VS10 not being translated (intyuh)
+* Patch 3021550: Add Wii homebrew platform (Pathogen David)
+* Patch 3035550: Make/Distcc outputs dependencies to wrong location
+* Patch 3138574: NoImportLib ignored in Windows makefiles dependencies (rjmyst3)
+* Patch 3367641: Remove warnings in Xcode 4
+* Patch 3372345: Gmake action's PCHs don't work with Mingw (Martin Ridgers)
+* Patch 3317329: Support vstudio CompileAs for mixed-language projects (xpol)
+* Patch 3337372: Improved precompiled header support (Anders Ericsson)
+* Patch 3401184: Fix Gmake LDFLAGS generation order (Adam Petrone)
+* Patch 3381066: Fix VS2010 project references
+* Added debug environment variable support for Visual Studio
+* Added debug environment variable support for Codeblocks using gdb
+* Bug: Visual Studio 2010 forces x86 when platform is Native
+* Patch 3351583: _PREMAKE_COMMAND variable (Konstantin Tokarev)
+* Added new global _WORKING_DIR
+* Patch 3451928: VS2008 trying to build *.h files in C projects
+* 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
+
 
 -------
   4.3
 RC3 -> RC4
 
 - Embed scripts instead of bytecodes to avoid portability issues
-- solution() and project() now only set the active object when 
+- solution() and project() now only set the active object when
   called with a name; remains unchanged otherwise
 
 RC2 -> RC3
 - Added new cb-ow (Code::Blocks Open Watcom) target (Tim Channon)
 - Place OSX winexe's into Content/MacOS folder (William Burnson)
 - Sibling executables may now be listed in package.links
-- Bug 1520012: Improper Makefiles when filenames have spaces 
+- Bug 1520012: Improper Makefiles when filenames have spaces
   (Diaa Sami)
 - Bug 2045506: "no-exceptions" flag ignored for VS200x (Benoit Miller)
 - Bug 2034470: Error in cmd line error handler
 -----
 
 - Patch 1946122: Add support for VS2008 (Ryan Pusztai)
-- Patch 1913448: Win32 crash when using '--clean --usetargetpath' 
+- Patch 1913448: Win32 crash when using '--clean --usetargetpath'
   (David Walters)
 - Patch 1771168: luaL_getn speed optimization (Richard O'Grady)
 - Bug 1939089: Premake segfault on Linux/PPC (Fabio Till)
 - Fixed "bad argument #2 to 'chdir'" error
-- Disable -MMD on multiple -arch flags (poor man's Universal binary 
+- Disable -MMD on multiple -arch flags (poor man's Universal binary
   support)
 
 
 
 - Prevent creation of import libraries on OS X
 - Improved handling of dylibs on OS X
-- Patch 1771977: Ability to compile C source as C++ in Code::Blocks 
+- Patch 1771977: Ability to compile C source as C++ in Code::Blocks
   (Ryan Pusztai)
 - Bug 1804810: out-implib not present in linux gnu compler toolchain
 - Bug 1806949: .Net reference paths are broken when bindir is specified
 - Bug 1806960: Make clean does not remove .mdb files
-- Bug 1831389: Makefiles stored in subdirs contain no targets on 
+- Bug 1831389: Makefiles stored in subdirs contain no targets on
   first run
 
 
 - Bug 1655595: Compile/build problem on FreeBSD
 - Bug: "gnu" clean rule doesn't work in cmd.exe
 - Improved behavior of Linux findlib()
-- Updated Code::Blocks support to latest project version 
+- Updated Code::Blocks support to latest project version
   (major="1" minor="6")
 - Patch 1681666: GNU targets always show the console if kind = 'winexe'
 
 - Added unit test suite
 - Merged Scott Graham unicode build flag patch
 - Removed package.warninglevel in favor of extra-warnings flag
-- Added package.targetprefix 
+- Added package.targetprefix
 - Overhauled structure of generated GNU makefiles
 - Added --os command line option
 - Fixed bug 1268588: Use gcc to link C packages
 - Worked around VS.NET bug for .NET assemblies > 64K.
 - Added --very-verbose flag to GNU generator.
 - GNU generator now supports assembly sources.
- 
+
 
 -----
  2.1
 - Added support for Digital Mars compiler.
 
 
-------- 
+-------
  1.6.1
 -------
 
 - VS7 generator crashed if a package was built before one of its
   dependencies. Now immediately assigns UUID before processing.
-  
+
 
 -----
  1.6
 
 - Added support for Visual Studio 2003 and SharpDevelop.
 - Added binaries directory as a reference path for VS7.
-	
+
 
 -----
  1.5
 -----
 
 - Added initial support for building static libraries.
-- Added "no-main" flag, prevents overriding WinMain() on 
+- Added "no-main" flag, prevents overriding WinMain() on
   Windows builds.
 - Added "--no-rtti" and "no-exceptions" build flags to
   disable those C++ features.
 - Display error message when project has no packages.
 - Moved VC7 *.pdb files into intermediates directory.
-  
+
 
 -----
  1.4
 
 - Bug fixes to the path manipulation routines.
 - GNU makefiles are regenerated when premake scripts change.
-    
+
 
 -----
  1.3
-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.
 
 		configuration "vs*"
 			defines     { "_CRT_SECURE_NO_WARNINGS" }
+		
+		configuration "vs2005"
+			defines	{"_CRT_SECURE_NO_DEPRECATE" }
+
+		configuration "windows"
+			links { "ole32" }
 
 		configuration "linux"
 			defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
 			links       { "m", "dl" } 
+
+		configuration "bsd"
+			defines     { "LUA_USE_POSIX", "LUA_USE_DLOPEN" }
+			links       { "m" } 
 			
 		configuration "macosx"
 			defines     { "LUA_USE_MACOSX" }
+			links       { "CoreServices.framework" }
 			
 		configuration { "macosx", "gmake" }
-			buildoptions { "-mmacosx-version-min=10.1" }
-			linkoptions { "-lstdc++-static", "-mmacosx-version-min=10.1" }
+			buildoptions { "-mmacosx-version-min=10.4" }
+			linkoptions  { "-mmacosx-version-min=10.4" }
 
 		configuration { "linux", "bsd", "macosx" }
 			linkoptions { "-rdynamic" }

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

 
 	local function stripfile(fname)
 		local f = io.open(fname)
-		local s = f:read("*a")
+		local s = assert(f:read("*a"))
 		f:close()
 
 		-- strip tabs
 		
 		-- 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("\\", "\\\\")
 

scripts/release.lua

 
 function dorelease()
 	local z
-	local hgroot = "https://bitbucket.org/premake/premake-stable"
 
 -- 
 -- Helper function: runs a command (formatted, with optional arguments) and
 -- Look for required utilities
 --
 
-	local required = { "hg", "zip", "tar", "make", "gcc" }
+	local required = { "hg", "make", "gcc" }
 	for _, value in ipairs(required) do
 		z = exec("%s --version", value)
 		if z ~= 0 then
    print( "BEFORE RUNNING THIS SCRIPT follow the checklist in RELEASE.txt" )
    print( "")
    print( "Press [Enter] to begin.")
-   io .read()
+   io.read()
 
 
 
 	os.chdir("release")
 	
 	os.rmdir(pkgname)
-	z = exec( "hg clone -r %s %s %s", version, hgroot, pkgname)
+	z = exec( "hg clone -r %s .. %s", version, pkgname)
 	if z ~= 0 then
 		error("** Failed to download tagged sources", 0)
 	end

src/_manifest.lua

 --
 -- _manifest.lua
 -- Manage the list of built-in Premake scripts.
--- Copyright (c) 2002-2010 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/configs.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/ow.lua",
 		"tools/snc.lua",
-		"base/validate.lua",
-		"base/help.lua",
-		"base/premake.lua",
-		
+
 		-- CodeBlocks action
 		"actions/codeblocks/_codeblocks.lua",
 		"actions/codeblocks/codeblocks_workspace.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/vs_generic_solution.lua",
-		"actions/vstudio/vs2010_vcxproxj.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_main.lua

 --
 -- _premake_main.lua
 -- Script-side entry point for the main program logic.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
 --
 
 
 	local shorthelp     = "Type 'premake4 --help' for help"
 	local versionhelp   = "premake4 (Premake Build Script Generator) %s"
 	
+	_WORKING_DIR        = os.getcwd()
 
 
 --
 		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.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
+			for sln in premake.solution.each() do
+				premake.solution.bakeprojects(sln)
+			end
+		end
+			
 		
 		-- Hand over control to the action
 		printf("Running action '%s'...", action.trigger)

src/actions/codeblocks/_codeblocks.lua

 --
 -- _codeblocks.lua
 -- Define the Code::Blocks action(s).
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
 --
 
+	premake.codeblocks = { }
 
 	newaction {
 		trigger         = "codeblocks",
 		},
 		
 		onsolution = function(sln)
-			premake.generate(sln, "%%.workspace", premake.codeblocks_workspace)
+			premake.generate(sln, "%%.workspace", premake.codeblocks.workspace)
 		end,
 		
 		onproject = function(prj)
-			premake.generate(prj, "%%.cbp", premake.codeblocks_cbp)
+			premake.generate(prj, "%%.cbp", premake.codeblocks.cbp)
 		end,
 		
 		oncleansolution = function(sln)

src/actions/codeblocks/codeblocks_cbp.lua

 --
 -- codeblocks_cbp.lua
 -- Generate a Code::Blocks C/C++ project.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
 --
 
-	function premake.codeblocks_cbp(prj)
+	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(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
 		end
 		_p(2,'</Build>')
 		
-		-- begin files block --
-		local pchheader
-		if (prj.pchheader) then
-			pchheader = path.getrelative(prj.location, prj.pchheader)
+		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
-		
-		for _,fname in ipairs(prj.files) do
-			_p(2,'<Unit filename="%s">', premake.esc(fname))
-			if path.isresourcefile(fname) then
-				_p(3,'<Option compilerVar="WINDRES" />')
-			elseif path.iscfile(fname) and prj.language == "C++" then
-				_p(3,'<Option compilerVar="CC" />')
-			end
-			if not prj.flags.NoPCH and fname == 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 files block --
-		
-		_p(2,'<Extensions />')
+		_p(2,'</Extensions>')
+
 		_p(1,'</Project>')
 		_p('</CodeBlocks_project_file>')
 		_p('')

src/actions/codeblocks/codeblocks_workspace.lua

 -- Copyright (c) 2009 Jason Perkins and the Premake project
 --
 
-	function premake.codeblocks_workspace(sln)
+	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)

src/actions/codelite/_codelite.lua

 -- Copyright (c) 2008-2009 Jason Perkins and the Premake project
 --
 
+	premake.codelite = { }
+
 	newaction {
 		trigger         = "codelite",
 		shortname       = "CodeLite",
 		},
 		
 		onsolution = function(sln)
-			premake.generate(sln, "%%.workspace", premake.codelite_workspace)
+			premake.generate(sln, "%%.workspace", premake.codelite.workspace)
 		end,
 		
 		onproject = function(prj)
-			premake.generate(prj, "%%.project", premake.codelite_project)
+			premake.generate(prj, "%%.project", premake.codelite.project)
 		end,
 		
 		oncleansolution = function(sln)

src/actions/codelite/codelite_project.lua

 --
 -- codelite_project.lua
 -- Generate a CodeLite C/C++ project file.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
 --
 
-	function premake.codelite_project(prj)
+	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))
-		
-		premake.walksources(prj, premake.codelite_files)
+
+		-- Write out the list of source code files in the project
+		codelite.files(prj)
 
 		local types = { 
 			ConsoleApp  = "Executable", 
 				local fname  = premake.esc(cfg.buildtarget.fullpath)
 				local objdir = premake.esc(cfg.objectsdir)
 				local runcmd = cfg.buildtarget.name
-				local rundir = cfg.buildtarget.directory
+				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="" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, rundir, pause)
+				_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('</CodeLite_Project>')
 	end
-
-
-
---
--- Write out entries for the files element; called from premake.walksources().
---
-
-	function premake.codelite_files(prj, fname, state, nestlevel)
-		local indent = string.rep("  ", nestlevel + 1)
-		
-		if (state == "GroupStart") then
-			io.write(indent .. '<VirtualDirectory Name="' .. path.getname(fname) .. '">\n')
-		elseif (state == "GroupEnd") then
-			io.write(indent .. '</VirtualDirectory>\n')
-		else
-			io.write(indent .. '<File Name="' .. fname .. '"/>\n')
-		end
-	end
-	
-
-

src/actions/codelite/codelite_workspace.lua

 --
 -- codelite_workspace.lua
 -- Generate a CodeLite workspace file.
--- Copyright (c) 2009 Jason Perkins and the Premake project
+-- Copyright (c) 2009, 2011 Jason Perkins and the Premake project
 --
 
-	function premake.codelite_workspace(sln)
+	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))
 		

src/actions/make/_make.lua

 --
 -- _make.lua
 -- Define the makefile action(s).
--- Copyright (c) 2002-2010 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
 --
 
 	_MAKE = { }
 	premake.make = { }
+	local make = premake.make
 
 --
 -- Escape a string so it can be written to a makefile.
 		return result
 	end
 	
+
+
+--
+-- Write out the raw settings blocks.
+--
+
+	function make.settings(cfg, cc)
+		if #cfg.makesettings > 0 then
+			for _, value in ipairs(cfg.makesettings) do
+				_p(value)
+			end
+		end
 		
+		local toolsettings = cc.platforms[cfg.platform].cfgsettings
+		if toolsettings then
+			_p(toolsettings)
+		end
+	end
+
+
 --
 -- Register the "gmake" action
 --

src/actions/make/make_cpp.lua

 --
 -- make_cpp.lua
 -- Generate a C/C++ project makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
 --
 
 	premake.make.cpp = { }
-	local _ = premake.make.cpp
-	
+	local cpp = premake.make.cpp
+	local make = premake.make
+
 
 	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
 				premake.gmake_cpp_config(cfg, cc)
 			end
 		end
-		
+
 		-- list intermediate files
 		_p('OBJECTS := \\')
 		for _, file in ipairs(prj.files) do
 			end
 		end
 		_p('')
- 
+
 		_p('RESOURCES := \\')
 		for _, file in ipairs(prj.files) do
 			if path.isresourcefile(file) then
 			end
 		end
 		_p('')
- 
+
 		-- identify the shell type
 		_p('SHELLTYPE := msdos')
 		_p('ifeq (,$(ComSpec)$(COMSPEC))')
 		_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
-		_.pchrules(prj)
-				
+		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 $<)')
-				if (path.iscfile(file)) then
-					_p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
-				else
-					_p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
-				end
+				cpp.buildcommand(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 now
-		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
 
-		_p('  OBJDIR     = %s', _MAKE.esc(cfg.objectsdir))		
+		-- if this platform requires a special compiler or linker, list it here
+		cpp.platformtools(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), " "))
-		_p('  CPPFLAGS  += %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), " "))
+
+		-- CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, and RESFLAGS
+		cpp.flags(cfg, cc)
 
 		-- set up precompiled headers
-		_.pchconfig(cfg)
-				
-		_p('  CFLAGS    += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
-		_p('  CXXFLAGS  += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
-		_p('  LDFLAGS   += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " "))
+		cpp.pchconfig(cfg)
+
 		_p('  LIBS      += %s', table.concat(cc.getlinkflags(cfg), " "))
-		_p('  RESFLAGS  += $(DEFINES) $(INCLUDES) %s', table.concat(table.join(cc.getdefines(cfg.resdefines), cc.getincludedirs(cfg.resincludedirs), cfg.resoptions), " "))
 		_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)
+
 		_p('endif')
 		_p('')
 	end
-	
-	
+
+
+--
+-- Platform support
+--
+
+	function cpp.platformtools(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(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 _.pchconfig(cfg)			
+	function cpp.pchconfig(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('  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 _.pchrules(prj)
+	function cpp.pchrules(prj)
 		_p('ifneq (,$(PCH))')
 		_p('$(GCH): $(PCH)')
 		_p('\t@echo $(notdir $<)')
+		_p('ifeq (posix,$(SHELLTYPE))')
 		_p('\t-$(SILENT) cp $< $(OBJDIR)')
-		if prj.language == "C" then
-			_p('\t$(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<"')
-		else
-			_p('\t$(SILENT) $(CXX) $(CXXFLAGS) -o "$@" -c "$<"')
-		end
+		_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)
+		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

 		local embedded = { }
 		local copypairs = { }
 		
-		for fcfg in premake.eachfile(prj) do
+		for fcfg in premake.project.eachfile(prj) do
 			local action = csc.getbuildaction(fcfg)
 			if action == "Compile" then
 				table.insert(sources, fcfg.name)

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",
-		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")
-
-		-- .NET projects add "Any CPU", mixed mode solutions add "Mixed Platforms"
-		local hascpp    = premake.hascppproject(sln)
-		local hasdotnet = premake.hasdotnetproject(sln)
-		if hasdotnet then
-			table.insert(platforms, 1, "any")
-		end
-		if hasdotnet and hascpp then
-			table.insert(platforms, 2, "mixed")
-		end
-		
-		for _, buildcfg in ipairs(sln.configurations) do
-			for _, platform in ipairs(platforms) do
-				local entry = { }
-				entry.src_buildcfg = buildcfg
-				entry.src_platform = platform
-				
-				-- PS3 is funky and needs special handling; it's more of a build
-				-- configuration than a platform from Visual Studio's point of view				
-				if platform ~= "PS3" then
-					entry.buildcfg = buildcfg
-					entry.platform = vstudio.platforms[platform]
-				else
-					entry.buildcfg = platform .. " " .. buildcfg
-					entry.platform = "Win32"
-				end
-				
-				-- create a name the way VS likes it
-				entry.name = entry.buildcfg .. "|" .. entry.platform
-				
-				-- flag the "fake" platforms added for .NET
-				entry.isreal = (platform ~= "any" and platform ~= "mixed")
-				
-				table.insert(cfgs, entry)
-			end
-		end
-		
-		return cfgs
-	end
-	
-
-
---
--- Clean Visual Studio files
---
-
-	function vstudio.cleansolution(sln)
-		premake.clean.file(sln, "%%.sln")
-		premake.clean.file(sln, "%%.suo")
-		premake.clean.file(sln, "%%.ncb")
-		-- MonoDevelop files
-		premake.clean.file(sln, "%%.userprefs")
-		premake.clean.file(sln, "%%.usertasks")
-	end
-	
-	function vstudio.cleanproject(prj)
-		local fname = premake.project.getfilename(prj, "%%")
-
-		os.remove(fname .. ".vcproj")
-		os.remove(fname .. ".vcproj.user")
-
-		os.remove(fname .. ".vcxproj")
-		os.remove(fname .. ".vcxproj.user")
-		os.remove(fname .. ".vcxproj.filters")
-
-		os.remove(fname .. ".csproj")
-		os.remove(fname .. ".csproj.user")
-
-		os.remove(fname .. ".pidb")
-		os.remove(fname .. ".sdf")
-	end
-
-	function vstudio.cleantarget(name)
-		os.remove(name .. ".pdb")
-		os.remove(name .. ".idb")
-		os.remove(name .. ".ilk")
-		os.remove(name .. ".vshost.exe")
-		os.remove(name .. ".exe.manifest")
-	end
-	
-	
-
---
--- Assemble the project file name.
---
-
-	function vstudio.projectfile(prj)
-		local extension
-		if (prj.language == "C#") then
-			extension = ".csproj"
-		elseif (_ACTION == "vs2010"  and prj.language == "C++" )then
-			extension = ".vcxproj"
-		elseif (_ACTION == "vs2010"  and prj.language == "C" )then
-			extension = ".vcxproj"
-		else
-			extension = ".vcproj"
-		end
-
-		local fname = path.join(prj.location, prj.name)
-		return fname..extension
-	end
-	
-
---
--- Returns the Visual Studio tool ID for a given project type.
---
-
-	function vstudio.tool(prj)
-		if (prj.language == "C#") then
-			return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"
-		else
-			return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"
-		end
-	end
-
-
---
--- Register the Visual Studio command line actions
---
-
-	newaction {
-		trigger         = "vs2002",
-		shortname       = "Visual Studio 2002",
-		description     = "Generate Microsoft Visual Studio 2002 project files",
-		os              = "windows",
-		
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++", "C#" },
-		
-		valid_tools     = {
-			cc     = { "msc"   },
-			dotnet = { "msnet" },
-		},
-
-		onsolution = function(sln)
-			premake.generate(sln, "%%.sln", vstudio.sln2002.generate)
-		end,
-		
-		onproject = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.generate(prj, "%%.csproj", vstudio.cs2002.generate)
-				premake.generate(prj, "%%.csproj.user", vstudio.cs2002.generate_user)
-			else
-				premake.generate(prj, "%%.vcproj", vstudio.vc200x.generate)
-			end
-		end,
-		
-		oncleansolution = premake.vstudio.cleansolution,
-		oncleanproject  = premake.vstudio.cleanproject,
-		oncleantarget   = premake.vstudio.cleantarget
-	}
-
-	newaction {
-		trigger         = "vs2003",
-		shortname       = "Visual Studio 2003",
-		description     = "Generate Microsoft Visual Studio 2003 project files",
-		os              = "windows",
-
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++", "C#" },
-		
-		valid_tools     = {
-			cc     = { "msc"   },
-			dotnet = { "msnet" },
-		},
-
-		onsolution = function(sln)
-			premake.generate(sln, "%%.sln", vstudio.sln2003.generate)
-		end,
-		
-		onproject = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.generate(prj, "%%.csproj", vstudio.cs2002.generate)
-				premake.generate(prj, "%%.csproj.user", vstudio.cs2002.generate_user)
-			else
-				premake.generate(prj, "%%.vcproj", vstudio.vc200x.generate)
-			end
-		end,
-		
-		oncleansolution = premake.vstudio.cleansolution,
-		oncleanproject  = premake.vstudio.cleanproject,
-		oncleantarget   = premake.vstudio.cleantarget
-	}
-
-	newaction {
-		trigger         = "vs2005",
-		shortname       = "Visual Studio 2005",
-		description     = "Generate Microsoft Visual Studio 2005 project files",
-		os              = "windows",
-
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++", "C#" },
-		
-		valid_tools     = {
-			cc     = { "msc"   },
-			dotnet = { "msnet" },
-		},
-
-		onsolution = function(sln)
-			premake.generate(sln, "%%.sln", vstudio.sln2005.generate)
-		end,
-		
-		onproject = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.generate(prj, "%%.csproj", vstudio.cs2005.generate)
-				premake.generate(prj, "%%.csproj.user", vstudio.cs2005.generate_user)
-			else
-				premake.generate(prj, "%%.vcproj", vstudio.vc200x.generate)
-			end
-		end,
-		
-		oncleansolution = vstudio.cleansolution,
-		oncleanproject  = vstudio.cleanproject,
-		oncleantarget   = vstudio.cleantarget
-	}
-
-	newaction {
-		trigger         = "vs2008",
-		shortname       = "Visual Studio 2008",
-		description     = "Generate Microsoft Visual Studio 2008 project files",
-		os              = "windows",
-
-		valid_kinds     = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
-		
-		valid_languages = { "C", "C++", "C#" },
-		
-		valid_tools     = {
-			cc     = { "msc"   },
-			dotnet = { "msnet" },
-		},
-
-		onsolution = function(sln)
-			premake.generate(sln, "%%.sln", vstudio.sln2005.generate)
-		end,
-		
-		onproject = function(prj)
-			if premake.isdotnetproject(prj) then
-				premake.generate(prj, "%%.csproj", vstudio.cs2005.generate)
-				premake.generate(prj, "%%.csproj.user", vstudio.cs2005.generate_user)
-			else
-				premake.generate(prj, "%%.vcproj", vstudio.vc200x.generate)
-			end
-		end,
-		
-		oncleansolution = vstudio.cleansolution,
-		oncleanproject  = vstudio.cleanproject,