summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/linux
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-05 10:18:00 +0800
committerruki <[email protected]>2015-06-05 10:18:00 +0800
commit12ce7dea3c7a74f77e9792236cb85bab4fd001e4 (patch)
treea64fd1ef7c1380ae63e5c982472e8712489b3374 /xmake/scripts/platform/linux
parentf9cecfd11c958122bb6d619069593b91333bdf6f (diff)
add ccache
Diffstat (limited to 'xmake/scripts/platform/linux')
-rw-r--r--xmake/scripts/platform/linux/linux.lua9
-rw-r--r--xmake/scripts/platform/linux/prober.lua41
2 files changed, 46 insertions, 4 deletions
diff --git a/xmake/scripts/platform/linux/linux.lua b/xmake/scripts/platform/linux/linux.lua
index 3cc436d39..9226ee98a 100644
--- a/xmake/scripts/platform/linux/linux.lua
+++ b/xmake/scripts/platform/linux/linux.lua
@@ -36,10 +36,11 @@ linux._ARCHS = {"x86", "x64"}
function linux.make(configs)
-- init the file formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"lib", ".so"}
+ configs.formats = {}
+ configs.formats.static = {"lib", ".a"}
+ configs.formats.object = {"", ".o"}
+ configs.formats.shared = {"lib", ".so"}
+
end
-- get the option menu for action: xmake config or global
diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua
index 5e382e5e4..1a3024df1 100644
--- a/xmake/scripts/platform/linux/prober.lua
+++ b/xmake/scripts/platform/linux/prober.lua
@@ -45,12 +45,53 @@ function prober._probe_arch(configs)
return true
end
+-- probe the ccache
+function prober._probe_ccache(configs)
+
+ -- get the ccache mode
+ local mode = configs.ccache
+
+ -- ok?
+ if mode and mode == "y" and configs.__ccache then return true end
+
+ -- disable?
+ if mode and mode == "n" then
+ configs.__ccache = nil
+ return true
+ end
+
+ -- probe the ccache path
+ local ccache_path = tools.probe("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
+
+ -- probe ok? update it
+ if ccache_path then
+ configs.ccache = "y"
+ configs.__ccache = ccache_path
+ else
+ configs.ccache = "n"
+ end
+
+ -- ok
+ return true
+end
+
-- probe the project configure
function prober.config(configs)
-- probe the architecture
if not prober._probe_arch(configs) then return end
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
+end
+
+-- probe the global configure
+function prober.global(configs)
+
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
end
-- return module: prober