Permalink
Browse files

Added stubs for GMake next-gen action

  • Loading branch information...
1 parent a9a16e7 commit 2963abab560fb8040f8ac4ae248343ff848f6b2a @starkos starkos committed Apr 30, 2012
@@ -1,14 +1,97 @@
--
-- _make.lua
-- Define the makefile action(s).
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
--
- _MAKE = { }
premake.make = { }
local make = premake.make
--
+-- The GNU make action, with support for the new platforms API
+--
+
+ newaction {
+ trigger = "gmakeng",
+ shortname = "GNU Make Next-gen",
+ description = "Experimental GNU makefiles for POSIX, MinGW, and Cygwin",
+
+ -- temporary, until I can phase out the legacy implementations
+ isnextgen = true,
+
+ valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
+
+ valid_languages = { "C", "C++", "C#" },
+
+ valid_tools = {
+ cc = { "gcc" },
+ dotnet = { "mono", "msnet", "pnet" }
+ },
+
+ onsolution = function(sln)
+ premake.generate(sln, make.getmakefilename(sln, false), make.generate_solution)
+ end,
+
+ onproject = function(prj)
+ local makefile = make.getmakefilename(prj, true)
+ if premake.isdotnetproject(prj) then
+ premake.generate(prj, makefile, make.generate_csharp)
+ else
+ premake.generate(prj, makefile, make.generate_cpp)
+ end
+ end,
+
+ oncleansolution = function(sln)
+ premake.clean.file(sln, make.getmakefilename(sln, false))
+ end,
+
+ oncleanproject = function(prj)
+ premake.clean.file(prj, make.getmakefilename(prj, true))
+ end
+ }
+
+
+--
+-- Get the makefile file name for a solution or a project. If this object is the
+-- only one writing to a location then I can use "Makefile". If more than one object
+-- writes to the same location I use name + ".make" to keep it unique.
+--
+
+ function make.getmakefilename(this, searchprjs)
+ local count = 0
+ for sln in premake.solution.each() do
+ if sln.location == this.location then
+ count = count + 1
+ end
+
+ if (searchprjs) then
+ for _,prj in ipairs(sln.projects) do
+ if prj.location == this.location then
+ count = count + 1
+ end
+ end
+ end
+ end
+
+ if count == 1 then
+ return "Makefile"
+ else
+ return this.name .. ".make"
+ end
+ end
+
+
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
+
+ _MAKE = { }
+
+
+--
-- Escape a string so it can be written to a makefile.
--
@@ -63,32 +146,6 @@
--
--- Get the makefile file name for a solution or a project. If this object is the
--- only one writing to a location then I can use "Makefile". If more than one object
--- writes to the same location I use name + ".make" to keep it unique.
---
-
- function _MAKE.getmakefilename(this, searchprjs)
- -- how many projects/solutions use this location?
- local count = 0
- for sln in premake.solution.each() do
- if (sln.location == this.location) then count = count + 1 end
- if (searchprjs) then
- for _,prj in ipairs(sln.projects) do
- if (prj.location == this.location) then count = count + 1 end
- end
- end
- end
-
- if (count == 1) then
- return "Makefile"
- else
- return this.name .. ".make"
- end
- end
-
-
---
-- Returns a list of object names, properly escaped to be included in the makefile.
--
@@ -139,11 +196,11 @@
},
onsolution = function(sln)
- premake.generate(sln, _MAKE.getmakefilename(sln, false), premake.make_solution)
+ premake.generate(sln, make.getmakefilename(sln, false), premake.make_solution)
end,
onproject = function(prj)
- local makefile = _MAKE.getmakefilename(prj, true)
+ local makefile = make.getmakefilename(prj, true)
if premake.isdotnetproject(prj) then
premake.generate(prj, makefile, premake.make_csharp)
else
@@ -152,10 +209,10 @@
end,
oncleansolution = function(sln)
- premake.clean.file(sln, _MAKE.getmakefilename(sln, false))
+ premake.clean.file(sln, make.getmakefilename(sln, false))
end,
oncleanproject = function(prj)
- premake.clean.file(prj, _MAKE.getmakefilename(prj, true))
+ premake.clean.file(prj, make.getmakefilename(prj, true))
end
}
@@ -5,8 +5,26 @@
--
premake.make.cpp = { }
- local cpp = premake.make.cpp
local make = premake.make
+ local cpp = premake.make.cpp
+
+
+--
+
+-- Generate a GNU make C++ project makefile, with support for the new platforms API.
+
+--
+
+
+ function make.generate_cpp(prj)
+ print("** Warning: GMake C++ project have not been ported yet")
+ end
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
function premake.make_cpp(prj)
@@ -1,9 +1,30 @@
--
-- make_csharp.lua
-- Generate a C# project makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
--
+ local make = premake.make
+
+
+--
+
+-- Generate a GNU make C# project makefile, with support for the new platforms API.
+
+--
+
+
+ function make.generate_csharp(prj)
+ print("** Warning: GMake C# projects have not been ported yet")
+ end
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
+
+
--
-- Given a .resx resource file, builds the path to corresponding .resource
-- file, matching the behavior and naming of Visual Studio.
@@ -1,9 +1,29 @@
--
-- make_solution.lua
-- Generate a solution-level makefile.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
--
+ local make = premake.make
+
+
+--
+
+-- Generate a GNU make "solution" makefile, with support for the new platforms API.
+
+--
+
+
+ function make.generate_solution(sln)
+ print("** Warning: GMake solutions have not been ported yet")
+ end
+
+
+
+-----------------------------------------------------------------------------
+-- Everything below this point is a candidate for deprecation
+-----------------------------------------------------------------------------
+
function premake.make_solution(sln)
-- create a shortcut to the compiler interface
local cc = premake[_OPTIONS.cc]
@@ -35,14 +55,14 @@
for _, prj in ipairs(sln.projects) do
_p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), "name")), " "))
_p('\t@echo "==== Building %s ($(config)) ===="', prj.name)
- _p('\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))
+ _p('\t@${MAKE} --no-print-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(make.getmakefilename(prj, true)))
_p('')
end
-- clean rules
_p('clean:')
for _ ,prj in ipairs(sln.projects) do
- _p('\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true)))
+ _p('\t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(make.getmakefilename(prj, true)))
end
_p('')
@@ -10,9 +10,12 @@
--
+
-- Generate a Visual Studio 200x C# project, with support for the new platforms API.
+
--
+
function cs2005.generate_ng(prj)
print("** Warning: C# projects have not been ported yet")
end

0 comments on commit 2963aba

Please sign in to comment.