diff --git a/modules/d/actions/gmake.lua b/modules/d/actions/gmake.lua index 4f2b1cda4d..f043cf8923 100644 --- a/modules/d/actions/gmake.lua +++ b/modules/d/actions/gmake.lua @@ -11,6 +11,8 @@ local dmake = m.make + require ("gmake") + local make = p.make local cpp = p.make.cpp local project = p.project diff --git a/modules/gmake/_manifest.lua b/modules/gmake/_manifest.lua new file mode 100644 index 0000000000..11adfd1fbd --- /dev/null +++ b/modules/gmake/_manifest.lua @@ -0,0 +1,9 @@ +return { + "_preload.lua", + "gmake.lua", + "gmake_cpp.lua", + "gmake_csharp.lua", + "gmake_makefile.lua", + "gmake_utility.lua", + "gmake_workspace.lua", +} diff --git a/modules/gmake/_preload.lua b/modules/gmake/_preload.lua new file mode 100644 index 0000000000..1bcf0d4551 --- /dev/null +++ b/modules/gmake/_preload.lua @@ -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 diff --git a/src/actions/make/_make.lua b/modules/gmake/gmake.lua similarity index 81% rename from src/actions/make/_make.lua rename to modules/gmake/gmake.lua index b9dd6b17ff..218d16410a 100644 --- a/src/actions/make/_make.lua +++ b/modules/gmake/gmake.lua @@ -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. @@ -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 diff --git a/src/actions/make/make_cpp.lua b/modules/gmake/gmake_cpp.lua similarity index 100% rename from src/actions/make/make_cpp.lua rename to modules/gmake/gmake_cpp.lua diff --git a/src/actions/make/make_csharp.lua b/modules/gmake/gmake_csharp.lua similarity index 100% rename from src/actions/make/make_csharp.lua rename to modules/gmake/gmake_csharp.lua diff --git a/src/actions/make/make_makefile.lua b/modules/gmake/gmake_makefile.lua similarity index 100% rename from src/actions/make/make_makefile.lua rename to modules/gmake/gmake_makefile.lua diff --git a/src/actions/make/make_utility.lua b/modules/gmake/gmake_utility.lua similarity index 100% rename from src/actions/make/make_utility.lua rename to modules/gmake/gmake_utility.lua diff --git a/src/actions/make/make_workspace.lua b/modules/gmake/gmake_workspace.lua similarity index 100% rename from src/actions/make/make_workspace.lua rename to modules/gmake/gmake_workspace.lua diff --git a/modules/gmake/tests/_tests.lua b/modules/gmake/tests/_tests.lua new file mode 100644 index 0000000000..cd629ad25c --- /dev/null +++ b/modules/gmake/tests/_tests.lua @@ -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", +} diff --git a/tests/actions/make/cpp/test_clang.lua b/modules/gmake/tests/cpp/test_clang.lua similarity index 100% rename from tests/actions/make/cpp/test_clang.lua rename to modules/gmake/tests/cpp/test_clang.lua diff --git a/tests/actions/make/cpp/test_file_rules.lua b/modules/gmake/tests/cpp/test_file_rules.lua similarity index 100% rename from tests/actions/make/cpp/test_file_rules.lua rename to modules/gmake/tests/cpp/test_file_rules.lua diff --git a/tests/actions/make/cpp/test_flags.lua b/modules/gmake/tests/cpp/test_flags.lua similarity index 100% rename from tests/actions/make/cpp/test_flags.lua rename to modules/gmake/tests/cpp/test_flags.lua diff --git a/tests/actions/make/cpp/test_ldflags.lua b/modules/gmake/tests/cpp/test_ldflags.lua similarity index 100% rename from tests/actions/make/cpp/test_ldflags.lua rename to modules/gmake/tests/cpp/test_ldflags.lua diff --git a/tests/actions/make/cpp/test_make_linking.lua b/modules/gmake/tests/cpp/test_make_linking.lua similarity index 100% rename from tests/actions/make/cpp/test_make_linking.lua rename to modules/gmake/tests/cpp/test_make_linking.lua diff --git a/tests/actions/make/cpp/test_make_pch.lua b/modules/gmake/tests/cpp/test_make_pch.lua similarity index 94% rename from tests/actions/make/cpp/test_make_pch.lua rename to modules/gmake/tests/cpp/test_make_pch.lua index 9bfb5f9f9c..bdd134070a 100644 --- a/tests/actions/make/cpp/test_make_pch.lua +++ b/modules/gmake/tests/cpp/test_make_pch.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 diff --git a/tests/actions/make/cpp/test_objects.lua b/modules/gmake/tests/cpp/test_objects.lua similarity index 100% rename from tests/actions/make/cpp/test_objects.lua rename to modules/gmake/tests/cpp/test_objects.lua diff --git a/tests/actions/make/cpp/test_target_rules.lua b/modules/gmake/tests/cpp/test_target_rules.lua similarity index 100% rename from tests/actions/make/cpp/test_target_rules.lua rename to modules/gmake/tests/cpp/test_target_rules.lua diff --git a/tests/actions/make/cpp/test_tools.lua b/modules/gmake/tests/cpp/test_tools.lua similarity index 100% rename from tests/actions/make/cpp/test_tools.lua rename to modules/gmake/tests/cpp/test_tools.lua diff --git a/tests/actions/make/cpp/test_wiidev.lua b/modules/gmake/tests/cpp/test_wiidev.lua similarity index 100% rename from tests/actions/make/cpp/test_wiidev.lua rename to modules/gmake/tests/cpp/test_wiidev.lua diff --git a/tests/actions/make/cs/test_embed_files.lua b/modules/gmake/tests/cs/test_embed_files.lua similarity index 100% rename from tests/actions/make/cs/test_embed_files.lua rename to modules/gmake/tests/cs/test_embed_files.lua diff --git a/tests/actions/make/cs/test_flags.lua b/modules/gmake/tests/cs/test_flags.lua similarity index 100% rename from tests/actions/make/cs/test_flags.lua rename to modules/gmake/tests/cs/test_flags.lua diff --git a/tests/actions/make/cs/test_links.lua b/modules/gmake/tests/cs/test_links.lua similarity index 100% rename from tests/actions/make/cs/test_links.lua rename to modules/gmake/tests/cs/test_links.lua diff --git a/tests/actions/make/cs/test_response.lua b/modules/gmake/tests/cs/test_response.lua similarity index 100% rename from tests/actions/make/cs/test_response.lua rename to modules/gmake/tests/cs/test_response.lua diff --git a/tests/actions/make/cs/test_sources.lua b/modules/gmake/tests/cs/test_sources.lua similarity index 100% rename from tests/actions/make/cs/test_sources.lua rename to modules/gmake/tests/cs/test_sources.lua diff --git a/tests/actions/make/test_make_escaping.lua b/modules/gmake/tests/test_make_escaping.lua similarity index 100% rename from tests/actions/make/test_make_escaping.lua rename to modules/gmake/tests/test_make_escaping.lua diff --git a/tests/actions/make/test_make_tovar.lua b/modules/gmake/tests/test_make_tovar.lua similarity index 100% rename from tests/actions/make/test_make_tovar.lua rename to modules/gmake/tests/test_make_tovar.lua diff --git a/tests/actions/make/workspace/test_config_maps.lua b/modules/gmake/tests/workspace/test_config_maps.lua similarity index 100% rename from tests/actions/make/workspace/test_config_maps.lua rename to modules/gmake/tests/workspace/test_config_maps.lua diff --git a/tests/actions/make/workspace/test_default_config.lua b/modules/gmake/tests/workspace/test_default_config.lua similarity index 100% rename from tests/actions/make/workspace/test_default_config.lua rename to modules/gmake/tests/workspace/test_default_config.lua diff --git a/tests/actions/make/workspace/test_group_rule.lua b/modules/gmake/tests/workspace/test_group_rule.lua similarity index 100% rename from tests/actions/make/workspace/test_group_rule.lua rename to modules/gmake/tests/workspace/test_group_rule.lua diff --git a/tests/actions/make/workspace/test_help_rule.lua b/modules/gmake/tests/workspace/test_help_rule.lua similarity index 100% rename from tests/actions/make/workspace/test_help_rule.lua rename to modules/gmake/tests/workspace/test_help_rule.lua diff --git a/tests/actions/make/workspace/test_project_rule.lua b/modules/gmake/tests/workspace/test_project_rule.lua similarity index 100% rename from tests/actions/make/workspace/test_project_rule.lua rename to modules/gmake/tests/workspace/test_project_rule.lua diff --git a/src/_manifest.lua b/src/_manifest.lua index b8dc56bfd8..159d19c2ab 100644 --- a/src/_manifest.lua +++ b/src/_manifest.lua @@ -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", diff --git a/src/_modules.lua b/src/_modules.lua index 12aa402ae6..c6fd8958f0 100644 --- a/src/_modules.lua +++ b/src/_modules.lua @@ -5,6 +5,7 @@ -- return { + "gmake", "xcode", "codelite", "gmake2", diff --git a/tests/_tests.lua b/tests/_tests.lua index eb9b373b53..94160210cb 100644 --- a/tests/_tests.lua +++ b/tests/_tests.lua @@ -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", - }