summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-07-28 22:08:22 +0800
committerruki <[email protected]>2019-07-28 22:08:22 +0800
commitde61169ec9ff9ab2749708ced96f6f5b6a83c8c8 (patch)
treed9da5d04600d377b4a9dbc4ad21268f6a367699c
parent41cf8c97d7817ab6d3b76b252bf6d75e2f565eb3 (diff)
improve to tmpdir
-rw-r--r--core/prefix.mak8
-rw-r--r--makefile23
-rw-r--r--xmake/core/base/os.lua2
3 files changed, 23 insertions, 10 deletions
diff --git a/core/prefix.mak b/core/prefix.mak
index ddfc4944a..622f1d594 100644
--- a/core/prefix.mak
+++ b/core/prefix.mak
@@ -4,8 +4,12 @@
include $(PRO_DIR)/project.mak
# the temporary directory
-TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),$(TMPDIR))
-TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),/tmp)
+ifeq ($(TMPDIR),)
+TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),/tmp)
+else
+# for termux
+TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),$(TMPDIR))
+endif
# the source directory
SRC_DIR = $(PRO_DIR)/src
diff --git a/makefile b/makefile
index 7346738da..b0c5eef25 100644
--- a/makefile
+++ b/makefile
@@ -1,17 +1,26 @@
# is debug?
-debug :=n
-verbose:=
+debug :=n
+verbose :=
-#debug :=y
-#verbose:=-v
+#debug :=y
+#verbose :=-v
# prefix
-prefix:=$(if $(prefix),$(prefix),$(PREFIX)) # for termux
-prefix:=$(if $(prefix),$(prefix),$(if $(findstring /usr/local/bin,$(PATH)),/usr/local,/usr))
+ifeq ($(prefix),) # compatible with brew script (make install prefix=xxx)
+ifeq ($(PREFIX),)
+prefix :=$(if $(findstring /usr/local/bin,$(PATH)),/usr/local,/usr)
+else
+prefix :=$(PREFIX)
+endif
+endif
# the temporary directory
-TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),$(TMPDIR)) # for termux
+ifeq ($(TMPDIR),)
TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),/tmp)
+else
+# for termux
+TMP_DIR :=$(if $(TMP_DIR),$(TMP_DIR),$(TMPDIR))
+endif
# platform
PLAT :=$(if $(PLAT),$(PLAT),$(if ${shell uname | egrep -i linux},linux,))
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 59f36b062..b8a81c8bd 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -493,7 +493,7 @@ function os.tmpdir()
-- get root tmpdir
if os._ROOT_TMPDIR == nil then
- os._ROOT_TMPDIR = os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()
+ os._ROOT_TMPDIR = (os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()):trim()
end
local tmpdir_root = os._ROOT_TMPDIR