diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index d5d107ac..1a2e11e2 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -86,28 +86,43 @@
_p(1,'ProjectGUID="{%s}"', prj.uuid)
-- try to determine what kind of targets we're building here
- local isWin, isPS3, isManaged
+ local isWin, isPS3, isManaged, isMakefile
for cfg in project.eachconfig(prj) do
if cfg.system == premake.WINDOWS then
isWin = true
- elseif cfg.system == premake.PS3 then
+ end
+ if cfg.system == premake.PS3 then
isPS3 = true
end
if cfg.flags.Managed then
isManaged = true
end
+ if cfg.kind == premake.MAKEFILE then
+ isMakefile = true
+ end
end
if isWin then
- if _ACTION > "vs2003" then
+ if _ACTION > "vs2003" and not isMakefile then
_x(1,'RootNamespace="%s"', prj.name)
end
- _p(1,'Keyword="%s"', iif(isManaged, "ManagedCProj", "Win32Proj"))
- _p(1,'TargetFrameworkVersion="0"')
- elseif isPS3 then
- _p(1,'TargetFrameworkVersion="196613"')
+
+ local keyword = "Win32Proj"
+ if isManaged then
+ keyword = "ManagedCProj"
+ end
+ if isMakefile then
+ keyword = "MakeFileProj"
+ end
+ _p(1,'Keyword="%s"', keyword)
end
+ local version = 0
+ if isMakefile or not isWin then
+ version = 196613
+ end
+ _p(1,'TargetFrameworkVersion="%d"', version)
+
_p(1,'>')
end
@@ -154,15 +169,7 @@
local objdir = project.getrelative(cfg.project, cfg.objdir)
_x(3,'IntermediateDirectory="%s"', path.translate(objdir))
- local cfgtype
- if (cfg.kind == "SharedLib") then
- cfgtype = 2
- elseif (cfg.kind == "StaticLib") then
- cfgtype = 4
- else
- cfgtype = 1
- end
- _p(3,'ConfigurationType="%s"', cfgtype)
+ vc200x.configurationType(cfg)
if (cfg.flags.MFC) then
_p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2))
@@ -206,6 +213,11 @@
--
function vc200x.toolsForConfig(cfg)
+ if cfg.kind == premake.MAKEFILE then
+ return {
+ "VCNMakeTool"
+ }
+ end
if _ACTION == "vs2002" then
return {
"VCCLCompilerTool",
@@ -595,6 +607,23 @@
end
+ function vc200x.VCNMakeTool(cfg)
+ _p(3,'')
+ end
+
+
function vc200x.VCResourceCompilerTool(cfg)
_p(3,'
+ ]]
+ end
diff --git a/tests/actions/vstudio/vc200x/test_nmake_settings.lua b/tests/actions/vstudio/vc200x/test_nmake_settings.lua
new file mode 100644
index 00000000..bb1a79d6
--- /dev/null
+++ b/tests/actions/vstudio/vc200x/test_nmake_settings.lua
@@ -0,0 +1,69 @@
+--
+-- tests/actions/vstudio/vc200x/test_nmake_settings.lua
+-- Validate generation the VCNMakeTool element in Visual Studio 200x C/C++ projects.
+-- Copyright (c) 2013 Jason Perkins and the Premake project
+--
+
+ local suite = test.declare("vs200x_nmake_settings")
+ local vc200x = premake.vstudio.vc200x
+
+
+--
+-- Setup/teardown
+--
+
+ local sln, prj, cfg
+
+ function suite.setup()
+ _ACTION = "vs2008"
+ sln = test.createsolution()
+ kind "Makefile"
+ end
+
+ local function prepare()
+ prj = premake.solution.getproject_ng(sln, 1)
+ cfg = premake5.project.getconfig(prj, "Debug")
+ vc200x.VCNMakeTool(cfg)
+ end
+
+
+--
+-- Verify the basic structure of the compiler block with no flags or settings.
+--
+
+ function suite.onDefaultSettings()
+ prepare()
+ test.capture [[
+
+ ]]
+ end
+
+
+--
+-- Make sure the target file extension is included.
+--
+
+ function suite.usesTargetExtension()
+ targetextension ".exe"
+ prepare()
+ test.capture [[
+
]]
end
+
+
+--
+-- Makefile projects set new keyword and drop the root namespace.
+--
+
+ function suite.keywordIsCorrect_onMakefile()
+ kind "Makefile"
+ prepare()
+ test.capture [[
+
+ ]]
+ end
diff --git a/tests/actions/vstudio/vc2010/test_nmake_props.lua b/tests/actions/vstudio/vc2010/test_nmake_props.lua
index 2cb8698e..fbe234d8 100644
--- a/tests/actions/vstudio/vc2010/test_nmake_props.lua
+++ b/tests/actions/vstudio/vc2010/test_nmake_props.lua
@@ -16,6 +16,7 @@
local sln, prj, cfg
function suite.setup()
+ _ACTION = "vs2010"
sln = test.createsolution()
kind "Makefile"
end
diff --git a/tests/premake4.lua b/tests/premake4.lua
index 166c7de4..3d098d25 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -123,6 +123,7 @@
dofile("actions/vstudio/vc200x/test_files.lua")
dofile("actions/vstudio/vc200x/test_linker_block.lua")
dofile("actions/vstudio/vc200x/test_manifest_block.lua")
+ dofile("actions/vstudio/vc200x/test_nmake_settings.lua")
dofile("actions/vstudio/vc200x/test_platforms.lua")
dofile("actions/vstudio/vc200x/test_project.lua")
dofile("actions/vstudio/vc200x/test_project_refs.lua")