_preload.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --
  2. -- _preload.lua
  3. -- Define the makefile action(s).
  4. -- Copyright (c) 2002-2015 Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. local project = p.project
  8. ---
  9. -- The GNU make action, with support for the new platforms API
  10. ---
  11. newaction {
  12. trigger = "gmake",
  13. shortname = "GNU Make",
  14. description = "Generate GNU makefiles for POSIX, MinGW, and Cygwin",
  15. toolset = "gcc",
  16. valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Utility", "Makefile" },
  17. valid_languages = { "C", "C++", "C#" },
  18. valid_tools = {
  19. cc = { "clang", "gcc" },
  20. dotnet = { "mono", "msnet", "pnet" }
  21. },
  22. onWorkspace = function(wks)
  23. p.escaper(p.make.esc)
  24. p.generate(wks, p.make.getmakefilename(wks, false), p.make.generate_workspace)
  25. end,
  26. onProject = function(prj)
  27. p.escaper(p.make.esc)
  28. local makefile = p.make.getmakefilename(prj, true)
  29. if prj.kind == p.UTILITY then
  30. p.generate(prj, makefile, p.make.utility.generate)
  31. elseif prj.kind == p.MAKEFILE then
  32. p.generate(prj, makefile, p.make.makefile.generate)
  33. else
  34. if project.isdotnet(prj) then
  35. p.generate(prj, makefile, p.make.cs.generate)
  36. elseif project.isc(prj) or project.iscpp(prj) then
  37. p.generate(prj, makefile, p.make.cpp.generate)
  38. end
  39. end
  40. end,
  41. onCleanWorkspace = function(wks)
  42. p.clean.file(wks, p.make.getmakefilename(wks, false))
  43. end,
  44. onCleanProject = function(prj)
  45. p.clean.file(prj, p.make.getmakefilename(prj, true))
  46. end
  47. }
  48. --
  49. -- Decide when the full module should be loaded.
  50. --
  51. return function(cfg)
  52. return (_ACTION == "gmake")
  53. end