diff --git a/src/_manifest.lua b/src/_manifest.lua index 40c90b96..4ecb41a3 100644 --- a/src/_manifest.lua +++ b/src/_manifest.lua @@ -20,8 +20,9 @@ "base/project.lua", "base/config.lua", "base/functions.lua", - "base/gcc.lua", "base/cmdline.lua", + "base/gcc.lua", + "base/ow.lua", -- this one must be last "_premake_main.lua" diff --git a/src/_premake_main.lua b/src/_premake_main.lua index 26921865..7ac05008 100644 --- a/src/_premake_main.lua +++ b/src/_premake_main.lua @@ -16,10 +16,15 @@ -- local function showhelp() + -- sort the lists of actions and options actions = { } for name,_ in pairs(premake.actions) do table.insert(actions, name) end table.sort(actions) + options = { } + for name,_ in pairs(premake.options) do table.insert(options, name) end + table.sort(options) + printf("Premake %s, a build script generator", _PREMAKE_VERSION) printf(_PREMAKE_COPYRIGHT) printf("%s %s", _VERSION, _COPYRIGHT) @@ -27,21 +32,33 @@ printf("Usage: premake4 [options] action [arguments]") printf("") + printf("OPTIONS") + printf("") + for _,name in ipairs(options) do + local opt = premake.options[name] + local trigger = opt.trigger + local description = opt.description + + if (opt.value) then trigger = trigger .. "=" .. opt.value end + if (opt.allowed) then description = description .. "; one of:" end + + printf(" --%-15s %s", trigger, description) + if (opt.allowed) then + table.sort(opt.allowed, function(a,b) return a[1] < b[1] end) + for _, value in ipairs(opt.allowed) do + printf(" %-14s %s", value[1], value[2]) + end + end + printf("") + end + printf("ACTIONS") printf("") for _,name in ipairs(actions) do - printf(" %-17s %s", name, premake.actions[name].description) + printf(" %-17s %s", name, premake.actions[name].description) end printf("") - printf("OPTIONS") - printf("") - printf(" --file=name Process the specified Premake script file") - printf(" --help Display this information") - printf(" --scripts=path Search for additional scripts on the given path") - printf(" --version Display version information") - printf("") - printf("For additional information, see http://industriousone.com/premake") end @@ -113,18 +130,28 @@ end - -- Prep the session, and then hand off control to the action + -- Validate the command-line arguments. This has to happen after the + -- script has run to allow for project-specific options + local action = premake.actions[name] if (not premake.actions[_ACTION]) then - error("Error: No such action '".._ACTION.."'", 0) + error("Error: no such action '".._ACTION.."'", 0) end + ok, err = premake.checkoptions() + if (not ok) then error("Error: " .. err, 0) end + + + -- Sanity check the current project setup + ok, err = premake.checktools() if (not ok) then error("Error: " .. err, 0) end ok, err = premake.checkprojects() if (not ok) then error("Error: " .. err, 0) end + + -- Hand over control to the action premake.doaction(_ACTION) return 0 diff --git a/src/actions/codeblocks/_codeblocks.lua b/src/actions/codeblocks/_codeblocks.lua index 0ed3cd1b..746fd2c9 100644 --- a/src/actions/codeblocks/_codeblocks.lua +++ b/src/actions/codeblocks/_codeblocks.lua @@ -15,7 +15,7 @@ valid_languages = { "C", "C++" }, valid_tools = { - cc = { "gcc" }, + cc = { "gcc", "ow" }, }, solutiontemplates = { diff --git a/src/actions/codeblocks/codeblocks_cbp.tmpl b/src/actions/codeblocks/codeblocks_cbp.tmpl index 5c98a70c..e80783d5 100644 --- a/src/actions/codeblocks/codeblocks_cbp.tmpl +++ b/src/actions/codeblocks/codeblocks_cbp.tmpl @@ -1,10 +1,11 @@ +<% local cc = premake[_OPTIONS.cc] %>