summaryrefslogtreecommitdiff
path: root/xmake/actions
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-21 21:50:35 +0800
committerruki <[email protected]>2016-03-21 21:50:35 +0800
commitd1f010fc5582cdaabb2ed758b2aaf7ffa5a95a43 (patch)
treed71bacbac82886d60e67ea8747de864d69dacf0f /xmake/actions
parent308b4d3661fad938dae830ee357778f85918f963 (diff)
add tool module for sandbox
Diffstat (limited to 'xmake/actions')
-rwxr-xr-xxmake/actions/config/makefile.lua35
1 files changed, 32 insertions, 3 deletions
diff --git a/xmake/actions/config/makefile.lua b/xmake/actions/config/makefile.lua
index 293fb45c0..62cd4084f 100755
--- a/xmake/actions/config/makefile.lua
+++ b/xmake/actions/config/makefile.lua
@@ -21,9 +21,10 @@
--
-- imports
+import("core.platform.tool")
import("core.project.project")
--- get log file
+-- get log makefile
function _logfile()
-- get it
@@ -33,6 +34,34 @@ end
-- make the object
function _make_object(makefile, target, srcfile, objfile)
+ -- make object for the *.o/obj source makefile
+--[[ if _make_object_for_object(makefile, target, srcfile, objfile) then return
+ elseif _make_object_for_static(makefile, target, srcfile, objfile) then return
+ end]]
+
+ -- make command
+ local ccache = tool.shellname("ccache")
+ local compiler = target:compiler(srcfile)
+ local cmd = compiler:makecmd(target, srcfile, objfile, _logfile())
+ if ccache then
+ cmd = ccache:append(cmd, " ")
+ end
+
+ -- make head
+ makefile:printf("%s:", objfile)
+
+ -- make dependence
+ makefile:print(" %s", srcfile)
+
+ -- make body
+ makefile:print("\t@echo %scompiling.$(mode) %s", ifelse(ccache, "ccache ", ""), srcfile)
+ makefile:write(format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:encode()))
+ makefile:print("\t@xmake l mkdir %s", path.directory(objfile))
+ makefile:print("\t@%s", cmd)
+
+ -- make tail
+ makefile:print("")
+
end
-- make all objects of the given target
@@ -88,7 +117,7 @@ function _make_target(makefile, target)
-- make body
makefile:print("\t@echo linking.$(mode) %s", path.filename(targetfile))
- makefile:write("\t@xmake l $(VERBOSE) verbose \"%s\"\n", verbose)
+ makefile:write(format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", verbose))
makefile:print("\t@xmake l mkdir %s", path.directory(targetfile))
makefile:print("\t@%s", cmd)
@@ -143,7 +172,7 @@ function make()
-- enter project directory
os.cd("$(projectdir)")
- -- remove the log file first
+ -- remove the log makefile first
os.rm(_logfile())
-- open the makefile