Merge pull request #818 from Blizzard/gmake-to-module
Make module of 'gmake' action.
This commit is contained in:
commit
7a1ffeff7c
@ -11,6 +11,8 @@
|
||||
|
||||
local dmake = m.make
|
||||
|
||||
require ("gmake")
|
||||
|
||||
local make = p.make
|
||||
local cpp = p.make.cpp
|
||||
local project = p.project
|
||||
|
9
modules/gmake/_manifest.lua
Normal file
9
modules/gmake/_manifest.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
"_preload.lua",
|
||||
"gmake.lua",
|
||||
"gmake_cpp.lua",
|
||||
"gmake_csharp.lua",
|
||||
"gmake_makefile.lua",
|
||||
"gmake_utility.lua",
|
||||
"gmake_workspace.lua",
|
||||
}
|
63
modules/gmake/_preload.lua
Normal file
63
modules/gmake/_preload.lua
Normal file
@ -0,0 +1,63 @@
|
||||
--
|
||||
-- _preload.lua
|
||||
-- Define the makefile action(s).
|
||||
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local project = p.project
|
||||
|
||||
---
|
||||
-- The GNU make action, with support for the new platforms API
|
||||
---
|
||||
|
||||
newaction {
|
||||
trigger = "gmake",
|
||||
shortname = "GNU Make",
|
||||
description = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Utility", "Makefile" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
valid_tools = {
|
||||
cc = { "clang", "gcc" },
|
||||
dotnet = { "mono", "msnet", "pnet" }
|
||||
},
|
||||
|
||||
onWorkspace = function(wks)
|
||||
p.escaper(p.make.esc)
|
||||
p.generate(wks, p.make.getmakefilename(wks, false), p.make.generate_workspace)
|
||||
end,
|
||||
|
||||
onProject = function(prj)
|
||||
p.escaper(p.make.esc)
|
||||
local makefile = p.make.getmakefilename(prj, true)
|
||||
if prj.kind == p.UTILITY then
|
||||
p.generate(prj, makefile, p.make.utility.generate)
|
||||
elseif prj.kind == p.MAKEFILE then
|
||||
p.generate(prj, makefile, p.make.makefile.generate)
|
||||
else
|
||||
if project.isdotnet(prj) then
|
||||
p.generate(prj, makefile, p.make.cs.generate)
|
||||
elseif project.isc(prj) or project.iscpp(prj) then
|
||||
p.generate(prj, makefile, p.make.cpp.generate)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
onCleanWorkspace = function(wks)
|
||||
p.clean.file(wks, p.make.getmakefilename(wks, false))
|
||||
end,
|
||||
|
||||
onCleanProject = function(prj)
|
||||
p.clean.file(prj, p.make.getmakefilename(prj, true))
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Decide when the full module should be loaded.
|
||||
--
|
||||
|
||||
return function(cfg)
|
||||
return (_ACTION == "gmake")
|
||||
end
|
@ -1,63 +1,20 @@
|
||||
--
|
||||
-- _make.lua
|
||||
-- gmake.lua
|
||||
-- Define the makefile action(s).
|
||||
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
p.make = {}
|
||||
|
||||
p.modules.gmake = {}
|
||||
p.modules.gmake._VERSION = p._VERSION
|
||||
|
||||
-- for backwards compatibility.
|
||||
p.make = p.modules.gmake
|
||||
|
||||
local make = p.make
|
||||
local project = p.project
|
||||
|
||||
|
||||
---
|
||||
-- The GNU make action, with support for the new platforms API
|
||||
---
|
||||
|
||||
newaction {
|
||||
trigger = "gmake",
|
||||
shortname = "GNU Make",
|
||||
description = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Utility", "Makefile" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
valid_tools = {
|
||||
cc = { "clang", "gcc" },
|
||||
dotnet = { "mono", "msnet", "pnet" }
|
||||
},
|
||||
|
||||
onWorkspace = function(wks)
|
||||
p.escaper(make.esc)
|
||||
p.generate(wks, make.getmakefilename(wks, false), make.generate_workspace)
|
||||
end,
|
||||
|
||||
onProject = function(prj)
|
||||
p.escaper(make.esc)
|
||||
local makefile = make.getmakefilename(prj, true)
|
||||
if prj.kind == p.UTILITY then
|
||||
p.generate(prj, makefile, make.utility.generate)
|
||||
elseif prj.kind == p.MAKEFILE then
|
||||
p.generate(prj, makefile, make.makefile.generate)
|
||||
else
|
||||
if project.isdotnet(prj) then
|
||||
p.generate(prj, makefile, make.cs.generate)
|
||||
elseif project.isc(prj) or project.iscpp(prj) then
|
||||
p.generate(prj, makefile, make.cpp.generate)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
onCleanWorkspace = function(wks)
|
||||
p.clean.file(wks, make.getmakefilename(wks, false))
|
||||
end,
|
||||
|
||||
onCleanProject = function(prj)
|
||||
p.clean.file(prj, make.getmakefilename(prj, true))
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Write out the default configuration rule for a workspace or project.
|
||||
--
|
||||
@ -323,3 +280,12 @@
|
||||
function make.targetDirRules(prj)
|
||||
make.mkdirRules("$(TARGETDIR)")
|
||||
end
|
||||
|
||||
|
||||
include("gmake_cpp.lua")
|
||||
include("gmake_csharp.lua")
|
||||
include("gmake_makefile.lua")
|
||||
include("gmake_utility.lua")
|
||||
include("gmake_workspace.lua")
|
||||
|
||||
return p.modules.gmake
|
33
modules/gmake/tests/_tests.lua
Normal file
33
modules/gmake/tests/_tests.lua
Normal file
@ -0,0 +1,33 @@
|
||||
require ("gmake")
|
||||
|
||||
return {
|
||||
-- Makefile tests
|
||||
"test_make_escaping.lua",
|
||||
"test_make_tovar.lua",
|
||||
|
||||
-- Makefile workspaces
|
||||
"workspace/test_config_maps.lua",
|
||||
"workspace/test_default_config.lua",
|
||||
"workspace/test_group_rule.lua",
|
||||
"workspace/test_help_rule.lua",
|
||||
"workspace/test_project_rule.lua",
|
||||
|
||||
-- Makefile C/C++ projects
|
||||
"cpp/test_clang.lua",
|
||||
"cpp/test_file_rules.lua",
|
||||
"cpp/test_flags.lua",
|
||||
"cpp/test_ldflags.lua",
|
||||
"cpp/test_make_pch.lua",
|
||||
"cpp/test_make_linking.lua",
|
||||
"cpp/test_objects.lua",
|
||||
"cpp/test_target_rules.lua",
|
||||
"cpp/test_tools.lua",
|
||||
"cpp/test_wiidev.lua",
|
||||
|
||||
-- Makefile C# projects
|
||||
"cs/test_embed_files.lua",
|
||||
"cs/test_flags.lua",
|
||||
"cs/test_links.lua",
|
||||
"cs/test_response.lua",
|
||||
"cs/test_sources.lua",
|
||||
}
|
@ -76,10 +76,10 @@
|
||||
|
||||
function suite.pch_searchesIncludeDirs()
|
||||
pchheader "premake.h"
|
||||
includedirs { "../src/host" }
|
||||
includedirs { "../../../src/host" }
|
||||
prepareVars()
|
||||
test.capture [[
|
||||
PCH = ../src/host/premake.h
|
||||
PCH = ../../../src/host/premake.h
|
||||
]]
|
||||
end
|
||||
|
||||
@ -140,9 +140,9 @@ endif
|
||||
function suite.findsPCH_onIncludeDirs()
|
||||
location "MyProject"
|
||||
pchheader "premake.h"
|
||||
includedirs { "../src/host" }
|
||||
includedirs { "../../../src/host" }
|
||||
prepareVars()
|
||||
test.capture [[
|
||||
PCH = ../../src/host/premake.h
|
||||
PCH = ../../../../src/host/premake.h
|
||||
]]
|
||||
end
|
@ -64,14 +64,6 @@
|
||||
"tools/snc.lua",
|
||||
"tools/clang.lua",
|
||||
|
||||
-- GNU make action
|
||||
"actions/make/_make.lua",
|
||||
"actions/make/make_workspace.lua",
|
||||
"actions/make/make_cpp.lua",
|
||||
"actions/make/make_csharp.lua",
|
||||
"actions/make/make_utility.lua",
|
||||
"actions/make/make_makefile.lua",
|
||||
|
||||
-- Visual Studio actions
|
||||
"actions/vstudio/_vstudio.lua",
|
||||
"actions/vstudio/vs2005.lua",
|
||||
|
@ -5,6 +5,7 @@
|
||||
--
|
||||
|
||||
return {
|
||||
"gmake",
|
||||
"xcode",
|
||||
"codelite",
|
||||
"gmake2",
|
||||
|
@ -144,35 +144,4 @@ return {
|
||||
"actions/vstudio/vc2010/test_user_file.lua",
|
||||
"actions/vstudio/vc2010/test_vectorextensions.lua",
|
||||
"actions/vstudio/vc2010/test_ensure_nuget_imports.lua",
|
||||
|
||||
-- Makefile tests
|
||||
"actions/make/test_make_escaping.lua",
|
||||
"actions/make/test_make_tovar.lua",
|
||||
|
||||
-- Makefile workspaces
|
||||
"actions/make/workspace/test_config_maps.lua",
|
||||
"actions/make/workspace/test_default_config.lua",
|
||||
"actions/make/workspace/test_group_rule.lua",
|
||||
"actions/make/workspace/test_help_rule.lua",
|
||||
"actions/make/workspace/test_project_rule.lua",
|
||||
|
||||
-- Makefile C/C++ projects
|
||||
"actions/make/cpp/test_clang.lua",
|
||||
"actions/make/cpp/test_file_rules.lua",
|
||||
"actions/make/cpp/test_flags.lua",
|
||||
"actions/make/cpp/test_ldflags.lua",
|
||||
"actions/make/cpp/test_make_pch.lua",
|
||||
"actions/make/cpp/test_make_linking.lua",
|
||||
"actions/make/cpp/test_objects.lua",
|
||||
"actions/make/cpp/test_target_rules.lua",
|
||||
"actions/make/cpp/test_tools.lua",
|
||||
"actions/make/cpp/test_wiidev.lua",
|
||||
|
||||
-- Makefile C# projects
|
||||
"actions/make/cs/test_embed_files.lua",
|
||||
"actions/make/cs/test_flags.lua",
|
||||
"actions/make/cs/test_links.lua",
|
||||
"actions/make/cs/test_response.lua",
|
||||
"actions/make/cs/test_sources.lua",
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user