summaryrefslogtreecommitdiff
path: root/xmake/actions/build/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-05 11:16:32 +0800
committerruki <[email protected]>2016-05-05 11:16:32 +0800
commitf68de1b816bd631634a82d6cd8c8ea4636961a54 (patch)
tree2c6721241cfe821dcb96386a6705fe7496acd213 /xmake/actions/build/builder.lua
parentc5818eef6be6d364bacfc32f7ec71154f71b6f96 (diff)
modify assert and check target
Diffstat (limited to 'xmake/actions/build/builder.lua')
-rwxr-xr-xxmake/actions/build/builder.lua42
1 files changed, 39 insertions, 3 deletions
diff --git a/xmake/actions/build/builder.lua b/xmake/actions/build/builder.lua
index fc64e8e1b..4113b8ef7 100755
--- a/xmake/actions/build/builder.lua
+++ b/xmake/actions/build/builder.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file build.lua
+-- @file builder.lua
--
-- imports
@@ -28,14 +28,50 @@ import("core.project.project")
import("core.project.cache")
import("core.tool.tool")
--- make target
+-- get target
+function _target(targetname)
+
+ -- get and check it
+ return assert(project.target(targetname), "unknown target: %s", targetname)
+end
+
+-- make the given target
+function _make_target(target)
+
+ -- make for all dependent targets
+ for _, depname in ipairs(target:get("deps")) do
+ _make_target(_target(depname))
+ end
+
+ -- trace
+ print("make target: %s", target:name())
+end
+
+-- make
function make(targetname)
+ -- make all targets
+ if targetname == "all" then
+
+ -- make all targets
+ for _, target in pairs(project.targets()) do
+ _make_target(target)
+ end
+ else
+
+ -- make target
+ _make_target(_target(targetname))
+ end
end
--- make target from makefile
+-- make from makefile
function make_from_makefile(targetname)
+ -- check target
+ if targetname ~= "all" then
+ _target(targetname)
+ end
+
-- make makefile
task.run("makefile", {output = path.join(config.get("buildir"), "makefile")})