2017-06-13 16:51:58 +00:00
|
|
|
--
|
|
|
|
-- Name: gmake2/_preload.lua
|
|
|
|
-- Purpose: Define the gmake2 action.
|
|
|
|
-- Author: Blizzard Entertainment (Tom van Dijck)
|
|
|
|
-- Modified by: Aleksi Juvani
|
|
|
|
-- Vlad Ivanov
|
|
|
|
-- Created: 2016/01/01
|
|
|
|
-- Copyright: (c) 2016-2017 Jason Perkins, Blizzard Entertainment and the Premake project
|
|
|
|
--
|
|
|
|
|
|
|
|
local p = premake
|
2017-06-14 22:47:48 +00:00
|
|
|
local project = p.project
|
2017-06-13 16:51:58 +00:00
|
|
|
|
|
|
|
newaction {
|
|
|
|
trigger = "gmake2",
|
|
|
|
shortname = "Alternative 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" }
|
|
|
|
},
|
|
|
|
|
|
|
|
onInitialize = function()
|
2017-06-14 22:47:48 +00:00
|
|
|
require("gmake2")
|
2017-06-13 16:51:58 +00:00
|
|
|
p.modules.gmake2.cpp.initialize()
|
|
|
|
end,
|
|
|
|
|
|
|
|
onWorkspace = function(wks)
|
|
|
|
p.escaper(p.modules.gmake2.esc)
|
|
|
|
p.generate(wks, p.modules.gmake2.getmakefilename(wks, false), p.modules.gmake2.generate_workspace)
|
|
|
|
end,
|
|
|
|
|
|
|
|
onProject = function(prj)
|
|
|
|
p.escaper(p.modules.gmake2.esc)
|
|
|
|
local makefile = p.modules.gmake2.getmakefilename(prj, true)
|
|
|
|
if prj.kind == p.UTILITY then
|
|
|
|
p.generate(prj, makefile, p.modules.gmake2.utility.generate)
|
|
|
|
elseif prj.kind == p.MAKEFILE then
|
|
|
|
p.generate(prj, makefile, p.modules.gmake2.makefile.generate)
|
|
|
|
else
|
|
|
|
if project.isdotnet(prj) then
|
|
|
|
p.generate(prj, makefile, p.modules.gmake2.cs.generate)
|
2017-06-14 22:47:48 +00:00
|
|
|
elseif project.isc(prj) or project.iscpp(prj) then
|
2017-06-13 16:51:58 +00:00
|
|
|
p.generate(prj, makefile, p.modules.gmake2.cpp.generate)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
|
|
|
onCleanWorkspace = function(wks)
|
|
|
|
p.clean.file(wks, p.modules.gmake2.getmakefilename(wks, false))
|
|
|
|
end,
|
|
|
|
|
|
|
|
onCleanProject = function(prj)
|
|
|
|
p.clean.file(prj, p.modules.gmake2.getmakefilename(prj, true))
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Decide when the full module should be loaded.
|
|
|
|
--
|
|
|
|
|
|
|
|
return function(cfg)
|
|
|
|
return (_ACTION == "gmake2")
|
|
|
|
end
|