summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-12 21:12:55 +0800
committerruki <[email protected]>2020-09-12 21:14:11 +0800
commitb23f11f53af9f087292c08cfcb62adff62d1ce2f (patch)
treede90316e741d5e4e4db26f77fe6cd61b84561939
parent37766bcc2dfb3dc0a620485a273b115d3f6b906a (diff)
fix makefile for arm
-rw-r--r--core/makefile20
-rw-r--r--core/src/luajit/makefile6
-rw-r--r--makefile19
3 files changed, 17 insertions, 28 deletions
diff --git a/core/makefile b/core/makefile
index 31b3b9026..17bfde98d 100644
--- a/core/makefile
+++ b/core/makefile
@@ -177,21 +177,18 @@ 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))
-# for arm linux?
-ifeq ($(PLAT),linux)
+# on termux/ci
ifneq ($(TERMUX_ARCH),)
-ARCHSTR := $(TERMUX_ARCH) # on termux/ci
-else
-ARCHSTR := $(shell uname -m) # on arm device, e.g. termux app
-endif
-ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring armv7,$(ARCHSTR)),armv7,$(ARCH))
-ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(ARCH))
-ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(ARCH))
+ARCH := $(TERMUX_ARCH)
endif
endif
+# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
+ARCH := $(if $(findstring aarch64,$(ARCH)),arm64,$(ARCH))
+ARCH := $(if $(findstring arm64,$(ARCH)),arm64,$(ARCH))
+ARCH := $(if $(findstring arm,$(ARCH)),arm,$(ARCH))
+ARCH := $(if $(findstring i686,$(ARCH)),i386,$(ARCH))
+
# debug
DEBUG :=$(if $(DEBUG),$(DEBUG),n)
@@ -354,6 +351,7 @@ config : .null
@$(ECHO) "compile:"
@$(ECHO) " plat:\t\t"$(PLAT)
@$(ECHO) " arch:\t\t"$(ARCH)
+ @$(ECHO) " arch:\t\t"$(shell uname -m)
@$(ECHO) " host:\t\t"$(HOST)
@$(ECHO) " demo:\t\t"$(DEMO)
@$(ECHO) " prof:\t\t"$(PROF)
diff --git a/core/src/luajit/makefile b/core/src/luajit/makefile
index 0331e4ae3..62a485522 100644
--- a/core/src/luajit/makefile
+++ b/core/src/luajit/makefile
@@ -94,12 +94,6 @@ endif
# autogen plat and arch
GENPLAT := $(PLAT)
GENARCH := $(ARCH)
-ifeq ($(ARCH),arm64-v8a)
-GENARCH := arm64
-endif
-ifeq ($(ARCH),armv7)
-GENARCH := arm
-endif
# asm files
ifdef iswin
diff --git a/makefile b/makefile
index 7067f491e..7fdd273d1 100644
--- a/makefile
+++ b/makefile
@@ -51,21 +51,18 @@ 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))
-# for arm linux?
-ifeq ($(PLAT),linux)
+# on termux/ci
ifneq ($(TERMUX_ARCH),)
-ARCHSTR := $(TERMUX_ARCH) # on termux/ci
-else
-ARCHSTR := $(shell uname -m) # on arm device, e.g. termux app
-endif
-ARCH := $(if $(findstring aarch64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring arm64,$(ARCHSTR)),arm64,$(ARCH))
-ARCH := $(if $(findstring armv7,$(ARCHSTR)),armv7,$(ARCH))
-ARCH := $(if $(findstring arm,$(ARCHSTR)),arm,$(ARCH))
-ARCH := $(if $(findstring i686,$(ARCHSTR)),i386,$(ARCH))
+ARCH := $(TERMUX_ARCH)
endif
endif
+# translate architecture, e.g. armhf/armv7l -> arm, arm64-v8a -> arm64
+ARCH := $(if $(findstring aarch64,$(ARCH)),arm64,$(ARCH))
+ARCH := $(if $(findstring arm64,$(ARCH)),arm64,$(ARCH))
+ARCH := $(if $(findstring arm,$(ARCH)),arm,$(ARCH))
+ARCH := $(if $(findstring i686,$(ARCH)),i386,$(ARCH))
+
# conditionally map ARCH from amd64 to x86_64 if set from the outside
#
# Some OS provide a definition for $(ARCH) through an environment