summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/makefile/makefile.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/plugins/project/makefile/makefile.lua')
-rw-r--r--xmake/plugins/project/makefile/makefile.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/plugins/project/makefile/makefile.lua b/xmake/plugins/project/makefile/makefile.lua
index e31de2f83..202dfa63a 100644
--- a/xmake/plugins/project/makefile/makefile.lua
+++ b/xmake/plugins/project/makefile/makefile.lua
@@ -120,6 +120,12 @@ function _make_object(makefile, target, sourcefile, objectfile)
command = format("%s$(%s)%s", command:sub(1, p - 1), sourcekind:upper(), command:sub(e + 1))
end
+ -- replace ccache to $(CCACHE)
+ p, e = command:find("ccache", 1, true)
+ if p then
+ command = format("%s$(%s)%s", command:sub(1, p - 1), "CCACHE", command:sub(e + 1))
+ end
+
-- make head
makefile:printf("%s:", objectfile)
@@ -173,6 +179,12 @@ function _make_single_object(makefile, target, sourcekind, sourcebatch)
command = format("%s$(%s)%s", command:sub(1, p - 1), sourcekind:upper(), command:sub(e + 1))
end
+ -- replace ccache to $(CCACHE)
+ p, e = command:find("ccache", 1, true)
+ if p then
+ command = format("%s$(%s)%s", command:sub(1, p - 1), "CCACHE", command:sub(e + 1))
+ end
+
-- make head
makefile:printf("%s:", objectfiles)
@@ -301,6 +313,8 @@ end
-- make all
function _make_all(makefile)
+ -- make variables for ccache
+ makefile:print("CCACHE=ccache")
-- make variables for source kinds
for sourcekind, _ in pairs(language.sourcekinds()) do
local shellname = tool.shellname(sourcekind)