summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-16 23:48:17 +0800
committerruki <[email protected]>2020-09-16 23:48:17 +0800
commit8290d48edda4098d0e76eb54e0c12e24218c53c0 (patch)
tree6d714540b0fc186c27fa9d6b2f5b6d2ee8da5a08
parent2458b7dfefdcbe7c39b4590467e3cf6c96f8ef00 (diff)
improve core/makefile for ARCH
-rw-r--r--core/makefile54
-rw-r--r--core/plat/bsd/prefix.mak4
-rw-r--r--core/plat/cygwin/prefix.mak4
-rw-r--r--core/plat/linux/prefix.mak4
-rw-r--r--core/plat/macosx/prefix.mak4
-rw-r--r--core/plat/msys/prefix.mak4
-rw-r--r--core/src/luajit/makefile8
-rw-r--r--core/suffix.mak12
-rw-r--r--makefile44
9 files changed, 69 insertions, 69 deletions
diff --git a/core/makefile b/core/makefile
index e423b0c5c..3e1ebeb11 100644
--- a/core/makefile
+++ b/core/makefile
@@ -159,36 +159,36 @@ PLAT :=$(if $(PLAT),$(PLAT),$(if ${shell uname | egrep -i bsd},bsd,))
PLAT :=$(if $(PLAT),$(PLAT),linux)
# architecture
-ifeq ($(ARCH),)
+ifeq ($(BUILD_ARCH),)
ifneq ($(MSYSTEM_CARCH),)
MSYSARCH := $(if $(findstring mingw32,$(shell which gcc)),i386,$(MSYSTEM_CARCH))
else
MSYSARCH := x$(shell getconf LONG_BIT)
endif
-ARCH :=$(if $(findstring windows,$(PLAT)),x86,$(ARCH))
-ARCH :=$(if $(findstring msys,$(PLAT)),$(MSYSARCH),$(ARCH))
-ARCH :=$(if $(findstring cygwin,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring macosx,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring linux,$(PLAT)),$(shell uname -m),$(ARCH))
-ARCH :=$(if $(findstring bsd,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring iphoneos,$(PLAT)),armv7,$(ARCH))
-ARCH :=$(if $(findstring android,$(PLAT)),armv7,$(ARCH))
-ARCH :=$(if $(findstring i686,$(ARCH)),i386,$(ARCH)) # from msys/mingw32
-ARCH :=$(if $(findstring x32,$(ARCH)),i386,$(ARCH))
-ARCH :=$(if $(findstring x64,$(ARCH)),x86_64,$(ARCH))
+BUILD_ARCH :=$(if $(findstring windows,$(PLAT)),x86,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring msys,$(PLAT)),$(MSYSARCH),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring cygwin,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring macosx,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring linux,$(PLAT)),$(shell uname -m),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring bsd,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring iphoneos,$(PLAT)),armv7,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring android,$(PLAT)),armv7,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring i686,$(BUILD_ARCH)),i386,$(BUILD_ARCH)) # from msys/mingw32
+BUILD_ARCH :=$(if $(findstring x32,$(BUILD_ARCH)),i386,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring x64,$(BUILD_ARCH)),x86_64,$(BUILD_ARCH))
# on termux/ci
ifneq ($(TERMUX_ARCH),)
-ARCH := $(TERMUX_ARCH)
+BUILD_ARCH := $(TERMUX_ARCH)
endif
endif
# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
-ARCHSTR := $(ARCH)
-ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(ARCH))
-ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(ARCH))
+ARCHSTR := $(BUILD_ARCH)
+BUILD_ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(BUILD_ARCH))
# debug
DEBUG :=$(if $(DEBUG),$(DEBUG),n)
@@ -208,22 +208,22 @@ DEMO :=$(if $(DEMO),$(DEMO),y)
PROF :=$(if $(PROF),$(PROF),n)
# arm
-ARM :=$(if $(findstring arm,$(ARCH)),y,n)
+ARM :=$(if $(findstring arm,$(BUILD_ARCH)),y,n)
# x86
-x86 :=$(if $(findstring i386,$(ARCH)),y,n)
+x86 :=$(if $(findstring i386,$(BUILD_ARCH)),y,n)
# x64
-x64 :=$(if $(findstring x86_64,$(ARCH)),y,n)
+x64 :=$(if $(findstring x86_64,$(BUILD_ARCH)),y,n)
# sh4
-SH4 :=$(if $(findstring sh4,$(ARCH)),y,n)
+SH4 :=$(if $(findstring sh4,$(BUILD_ARCH)),y,n)
# mips
-MIPS :=$(if $(findstring mips,$(ARCH)),y,n)
+MIPS :=$(if $(findstring mips,$(BUILD_ARCH)),y,n)
# sparc
-SPARC :=$(if $(findstring sparc,$(ARCH)),y,n)
+SPARC :=$(if $(findstring sparc,$(BUILD_ARCH)),y,n)
# the project directory
PRO_DIR :=$(abspath .)
@@ -351,7 +351,7 @@ config : .null
@$(ECHO) "============================================================================="
@$(ECHO) "compile:"
@$(ECHO) " plat:\t\t"$(PLAT)
- @$(ECHO) " arch:\t\t"$(ARCH)
+ @$(ECHO) " arch:\t\t"$(BUILD_ARCH)
@$(ECHO) " host:\t\t"$(HOST)
@$(ECHO) " demo:\t\t"$(DEMO)
@$(ECHO) " prof:\t\t"$(PROF)
@@ -442,14 +442,14 @@ config : .null
@$(ECHO) "export "$(call MAKE_UPPER,$(PLAT)) >> .config.mak
@$(ECHO) "" >> .config.mak
@$(ECHO) "# architecture" >> .config.mak
- @$(ECHO) "ARCH ="$(ARCH) >> .config.mak
+ @$(ECHO) "BUILD_ARCH ="$(BUILD_ARCH) >> .config.mak
@$(ECHO) "ARM ="$(ARM) >> .config.mak
@$(ECHO) "x86 ="$(x86) >> .config.mak
@$(ECHO) "x64 ="$(x64) >> .config.mak
@$(ECHO) "SH4 ="$(SH4) >> .config.mak
@$(ECHO) "MIPS ="$(MIPS) >> .config.mak
@$(ECHO) "SPARC ="$(SPARC) >> .config.mak
- @$(ECHO) "export ARCH" >> .config.mak
+ @$(ECHO) "export BUILD_ARCH" >> .config.mak
@$(ECHO) "export ARM" >> .config.mak
@$(ECHO) "export x86" >> .config.mak
@$(ECHO) "export x64" >> .config.mak
diff --git a/core/plat/bsd/prefix.mak b/core/plat/bsd/prefix.mak
index ff0c15e62..d0ea68d52 100644
--- a/core/plat/bsd/prefix.mak
+++ b/core/plat/bsd/prefix.mak
@@ -33,8 +33,8 @@ MKDIR = mkdir -p
MAKE = gmake -r
# architecture flags
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(ARCH)),-m64,))
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(ARCH)),-m32,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(BUILD_ARCH)),-m64,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(BUILD_ARCH)),-m32,))
# check flags for x64 or x86
ifneq ($(AHFLAGS),)
diff --git a/core/plat/cygwin/prefix.mak b/core/plat/cygwin/prefix.mak
index 1ad336cb9..fc7ac9c30 100644
--- a/core/plat/cygwin/prefix.mak
+++ b/core/plat/cygwin/prefix.mak
@@ -33,8 +33,8 @@ MKDIR = mkdir -p
MAKE = make -r
# architecture flags
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(ARCH)),-m64,))
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(ARCH)),-m32,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(BUILD_ARCH)),-m64,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(BUILD_ARCH)),-m32,))
# check flags for x64 or x86
ifneq ($(AHFLAGS),)
diff --git a/core/plat/linux/prefix.mak b/core/plat/linux/prefix.mak
index 9a38121f3..0bb741c0e 100644
--- a/core/plat/linux/prefix.mak
+++ b/core/plat/linux/prefix.mak
@@ -33,8 +33,8 @@ MKDIR = mkdir -p
MAKE = make -r
# architecture flags
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(ARCH)),-m64,))
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(ARCH)),-m32,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(BUILD_ARCH)),-m64,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(BUILD_ARCH)),-m32,))
# check flags for x64 or x86
ifneq ($(AHFLAGS),)
diff --git a/core/plat/macosx/prefix.mak b/core/plat/macosx/prefix.mak
index f7e9e96fb..a1199c2d3 100644
--- a/core/plat/macosx/prefix.mak
+++ b/core/plat/macosx/prefix.mak
@@ -16,8 +16,8 @@ DLL_SUFFIX = .dylib
ASM_SUFFIX = .S
# cpu bits
-BITS := $(if $(findstring x86_64,$(ARCH)),64,)
-BITS := $(if $(findstring i386,$(ARCH)),32,)
+BITS := $(if $(findstring x86_64,$(BUILD_ARCH)),64,)
+BITS := $(if $(findstring i386,$(BUILD_ARCH)),32,)
BITS := $(if $(BITS),$(BITS),$(shell getconf LONG_BIT))
# prefix
diff --git a/core/plat/msys/prefix.mak b/core/plat/msys/prefix.mak
index 304e37158..9d4dc8dd5 100644
--- a/core/plat/msys/prefix.mak
+++ b/core/plat/msys/prefix.mak
@@ -33,8 +33,8 @@ MKDIR = mkdir -p
MAKE = make -r
# architecture flags
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(ARCH)),-m64,))
-AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(ARCH)),-m32,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring x86_64,$(BUILD_ARCH)),-m64,))
+AHFLAGS := $(if $(AHFLAGS),$(AHFLAGS),$(if $(findstring i386,$(BUILD_ARCH)),-m32,))
# check flags for x64 or x86
ifneq ($(AHFLAGS),)
diff --git a/core/src/luajit/makefile b/core/src/luajit/makefile
index 62a485522..94b3b5819 100644
--- a/core/src/luajit/makefile
+++ b/core/src/luajit/makefile
@@ -91,16 +91,16 @@ ifeq ($(PLAT),cygwin)
iswin = yes
endif
-# autogen plat and arch
+# autogen plat and BUILD_ARCH
GENPLAT := $(PLAT)
-GENARCH := $(ARCH)
+GENARCH := $(BUILD_ARCH)
# asm files
ifdef iswin
-ifeq ($(ARCH),x86_64)
+ifeq ($(BUILD_ARCH),x86_64)
GENARCH := x64
endif
-ifeq ($(ARCH),i386)
+ifeq ($(BUILD_ARCH),i386)
GENARCH := x86
endif
GENPLAT := windows
diff --git a/core/suffix.mak b/core/suffix.mak
index 0e08152bc..1a1d1c6b7 100644
--- a/core/suffix.mak
+++ b/core/suffix.mak
@@ -120,7 +120,7 @@ endif
# append package includes
define APPEND_PACKAGE_INC_DIRS
-INC_DIRS += $(PKG_DIR)/$(1).pkg/inc/$(PLAT)/$(ARCH) $(PKG_DIR)/$(1).pkg/inc/$(PLAT) $(PKG_DIR)/$(1).pkg/inc $($(1)_INCPATH)
+INC_DIRS += $(PKG_DIR)/$(1).pkg/inc/$(PLAT)/$(BUILD_ARCH) $(PKG_DIR)/$(1).pkg/inc/$(PLAT) $(PKG_DIR)/$(1).pkg/inc $($(1)_INCPATH)
endef
$(foreach name, $(PKG_NAMES), $(eval $(call APPEND_PACKAGE_INC_DIRS,$(name))))
@@ -139,7 +139,7 @@ endif
define APPEND_PACKAGE_OPTIONS_FOR_MODULE
$(1)_LIBS += $($(2)_LIBNAMES)
$(1)_INC_DIRS += $($(2)_INCPATH)
-$(1)_LIB_DIRS += $($(2)_LIBPATH) $(PKG_DIR_NATIVE)/$(2).pkg/lib/release/$(PLAT)/$(ARCH)
+$(1)_LIB_DIRS += $($(2)_LIBPATH) $(PKG_DIR_NATIVE)/$(2).pkg/lib/release/$(PLAT)/$(BUILD_ARCH)
$(1)_CXFLAGS += $($(2)_INCFLAGS)
$(1)_MXFLAGS += $($(2)_INCFLAGS)
$(1)_LDFLAGS += $($(2)_LIBFLAGS)
@@ -336,17 +336,17 @@ endef
# make library dirs
define MAKE_INSTALL_LIB_DIRS
-$(1)_LIB_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/lib/$(PLAT)/$(ARCH)/%,$(1)))
+$(1)_LIB_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/lib/$(PLAT)/$(BUILD_ARCH)/%,$(1)))
endef
# make dynamic dirs
define MAKE_INSTALL_DLL_DIRS
-$(1)_DLL_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/lib/$(PLAT)/$(ARCH)/%,$(1)))
+$(1)_DLL_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/lib/$(PLAT)/$(BUILD_ARCH)/%,$(1)))
endef
# make binary dirs
define MAKE_INSTALL_BIN_DIRS
-$(1)_BIN_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/bin/$(PLAT)/$(ARCH)/%,$(1)))
+$(1)_BIN_DIRS_ := $(dir $(patsubst $(SRC_DIR)/$(2)/%,$(BIN_DIR)/$(2).pkg/bin/$(PLAT)/$(BUILD_ARCH)/%,$(1)))
endef
# make install files
@@ -358,7 +358,7 @@ $(foreach file, $($(1)_BIN_FILES), $(eval $(call MAKE_INSTALL_BIN_DIRS,$(file),$
INSTALL_FILES += $($(1)_INC_FILES) $($(1)_LIB_FILES) $($(1)_DLL_FILES) $($(1)_BIN_FILES) $(if $(findstring y,$($(1)_CONFIG)),$(CFG_FILE),)
-$(CFG_FILE)_DIRS_ := $(BIN_DIR)/$($(1)_PKG_NAME).pkg/inc/$(PLAT)/$(ARCH)
+$(CFG_FILE)_DIRS_ := $(BIN_DIR)/$($(1)_PKG_NAME).pkg/inc/$(PLAT)/$(BUILD_ARCH)
endef
$(foreach name, $(NAMES), $(eval $(call MAKE_INSTALL_FILES,$(name))))
diff --git a/makefile b/makefile
index 4d046fdc5..27c185100 100644
--- a/makefile
+++ b/makefile
@@ -33,44 +33,44 @@ PLAT :=$(if $(PLAT),$(PLAT),$(if ${shell uname | egrep -i bsd},bsd,))
PLAT :=$(if $(PLAT),$(PLAT),linux)
# architecture
-ifeq ($(ARCH),)
+ifeq ($(BUILD_ARCH),)
ifneq ($(MSYSTEM_CARCH),)
MSYSARCH := $(if $(findstring mingw32,$(shell which gcc)),i386,$(MSYSTEM_CARCH))
else
MSYSARCH := x$(shell getconf LONG_BIT)
endif
-ARCH :=$(if $(findstring windows,$(PLAT)),x86,$(ARCH))
-ARCH :=$(if $(findstring msys,$(PLAT)),$(MSYSARCH),$(ARCH))
-ARCH :=$(if $(findstring cygwin,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring macosx,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring linux,$(PLAT)),$(shell uname -m),$(ARCH))
-ARCH :=$(if $(findstring bsd,$(PLAT)),x$(shell getconf LONG_BIT),$(ARCH))
-ARCH :=$(if $(findstring iphoneos,$(PLAT)),armv7,$(ARCH))
-ARCH :=$(if $(findstring android,$(PLAT)),armv7,$(ARCH))
-ARCH :=$(if $(findstring i686,$(ARCH)),i386,$(ARCH)) # from msys/mingw32
-ARCH :=$(if $(findstring x32,$(ARCH)),i386,$(ARCH))
-ARCH :=$(if $(findstring x64,$(ARCH)),x86_64,$(ARCH))
+BUILD_ARCH :=$(if $(findstring windows,$(PLAT)),x86,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring msys,$(PLAT)),$(MSYSARCH),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring cygwin,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring macosx,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring linux,$(PLAT)),$(shell uname -m),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring bsd,$(PLAT)),x$(shell getconf LONG_BIT),$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring iphoneos,$(PLAT)),armv7,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring android,$(PLAT)),armv7,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring i686,$(BUILD_ARCH)),i386,$(BUILD_ARCH)) # from msys/mingw32
+BUILD_ARCH :=$(if $(findstring x32,$(BUILD_ARCH)),i386,$(BUILD_ARCH))
+BUILD_ARCH :=$(if $(findstring x64,$(BUILD_ARCH)),x86_64,$(BUILD_ARCH))
# on termux/ci
ifneq ($(TERMUX_ARCH),)
-ARCH := $(TERMUX_ARCH)
+BUILD_ARCH := $(TERMUX_ARCH)
endif
endif
# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
-ARCHSTR := $(ARCH)
-ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(ARCH))
-ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(ARCH))
+ARCHSTR := $(BUILD_ARCH)
+BUILD_ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(BUILD_ARCH))
-# conditionally map ARCH from amd64 to x86_64 if set from the outside
+# conditionally map BUILD_ARCH from amd64 to x86_64 if set from the outside
#
-# Some OS provide a definition for $(ARCH) through an environment
+# Some OS provide a definition for $(BUILD_ARCH) through an environment
# variable. It might be set to amd64 which implies x86_64. Since e.g.
# luajit expects either i386 or x86_64, the value amd64 is transformed
# to match a directory for a platform dependent implementation.
-ARCH :=$(if $(findstring amd64,$(ARCH)),x86_64,$(ARCH))
+BUILD_ARCH :=$(if $(findstring amd64,$(BUILD_ARCH)),x86_64,$(BUILD_ARCH))
# is windows?
iswin =
@@ -108,7 +108,7 @@ build:
install:
@echo installing to $(destdir) ...
@echo plat: $(PLAT)
- @echo arch: $(ARCH)
+ @echo BUILD_ARCH: $(BUILD_ARCH)
@# create the xmake install directory
@if [ -d $(xmake_dir_install) ]; then rm -rf $(xmake_dir_install); fi
@if [ ! -d $(xmake_dir_install) ]; then mkdir -p $(xmake_dir_install); fi