summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-16 23:54:16 +0800
committerruki <[email protected]>2020-09-16 23:54:16 +0800
commit92175acd1173b70cbd84ef5a80505cb30e00eeab (patch)
tree95c4819cd35aaba1983b80524f6f806d9e9c2cd7
parent8290d48edda4098d0e76eb54e0c12e24218c53c0 (diff)
fix makefile for arm64
-rw-r--r--core/makefile35
-rw-r--r--makefile45
2 files changed, 37 insertions, 43 deletions
diff --git a/core/makefile b/core/makefile
index 3e1ebeb11..08a9bee4c 100644
--- a/core/makefile
+++ b/core/makefile
@@ -165,30 +165,31 @@ MSYSARCH := $(if $(findstring mingw32,$(shell which gcc)),i386,$(MSYSTEM_CARCH)
else
MSYSARCH := x$(shell getconf LONG_BIT)
endif
-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))
+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),)
-BUILD_ARCH := $(TERMUX_ARCH)
+BUILD_ARCH := $(TERMUX_ARCH)
endif
endif
# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
-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))
+BUILD_ARCH := $(if $(findstring aarch64,$(BUILD_ARCH)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm64,$(BUILD_ARCH)),arm64,$(BUILD_ARCH))
+ifneq ($(BUILD_ARCH),arm64)
+BUILD_ARCH := $(if $(findstring arm,$(BUILD_ARCH)),arm,$(BUILD_ARCH))
+endif
+BUILD_ARCH := $(if $(findstring i686,$(BUILD_ARCH)),i386,$(BUILD_ARCH))
# debug
DEBUG :=$(if $(DEBUG),$(DEBUG),n)
diff --git a/makefile b/makefile
index 27c185100..294d4c83a 100644
--- a/makefile
+++ b/makefile
@@ -39,38 +39,31 @@ MSYSARCH := $(if $(findstring mingw32,$(shell which gcc)),i386,$(MSYSTEM_CARCH)
else
MSYSARCH := x$(shell getconf LONG_BIT)
endif
-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))
+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),)
-BUILD_ARCH := $(TERMUX_ARCH)
+BUILD_ARCH := $(TERMUX_ARCH)
endif
endif
# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
-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 BUILD_ARCH from amd64 to x86_64 if set from the outside
-#
-# 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.
-BUILD_ARCH :=$(if $(findstring amd64,$(BUILD_ARCH)),x86_64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring aarch64,$(BUILD_ARCH)),arm64,$(BUILD_ARCH))
+BUILD_ARCH := $(if $(findstring arm64,$(BUILD_ARCH)),arm64,$(BUILD_ARCH))
+ifneq ($(BUILD_ARCH),arm64)
+BUILD_ARCH := $(if $(findstring arm,$(BUILD_ARCH)),arm,$(BUILD_ARCH))
+endif
+BUILD_ARCH := $(if $(findstring i686,$(BUILD_ARCH)),i386,$(BUILD_ARCH))
# is windows?
iswin =
@@ -108,7 +101,7 @@ build:
install:
@echo installing to $(destdir) ...
@echo plat: $(PLAT)
- @echo BUILD_ARCH: $(BUILD_ARCH)
+ @echo 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