Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make module of 'gmake' action. #818

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/d/actions/gmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

local dmake = m.make

require ("gmake")

local make = p.make
local cpp = p.make.cpp
local project = p.project
Expand Down
9 changes: 9 additions & 0 deletions modules/gmake/_manifest.lua
Original file line number Diff line number Diff line change
@@ -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 changes: 63 additions & 0 deletions modules/gmake/_preload.lua
Original file line number Diff line number Diff line change
@@ -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
66 changes: 16 additions & 50 deletions src/actions/make/_make.lua → modules/gmake/gmake.lua
Original file line number Diff line number Diff line change
@@ -1,62 +1,19 @@
--
-- _make.lua
-- gmake.lua
-- Define the makefile action(s).
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
--

local p = premake
p.make = {}

local make = p.make
local project = p.project

p.modules.gmake = {}
p.modules.gmake._VERSION = p._VERSION

---
-- 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
}
-- for backwards compatibility.
p.make = p.modules.gmake

local make = p.make
local project = p.project

--
-- Write out the default configuration rule for a workspace or project.
Expand Down Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions modules/gmake/tests/_tests.lua
Original file line number Diff line number Diff line change
@@ -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",
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
8 changes: 0 additions & 8 deletions src/_manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/_modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
--

return {
"gmake",
"xcode",
"codelite",
"gmake2",
Expand Down
31 changes: 0 additions & 31 deletions tests/_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",

}