diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-25 14:36:33 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-25 14:43:46 +0200 |
commit | 86ffb2474883642c3f95698d47acea32458247e0 (patch) | |
tree | 217a2dfbf012f89370f47abfde790c42b5cf8050 /app/tools/libwg-go | |
parent | 2c9e11f4f26796a98b8caae77aa723e429dc1ea1 (diff) |
Use variable map instead of shell switch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/tools/libwg-go')
-rw-r--r-- | app/tools/libwg-go/Makefile | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/tools/libwg-go/Makefile b/app/tools/libwg-go/Makefile index c54797c7..43af1439 100644 --- a/app/tools/libwg-go/Makefile +++ b/app/tools/libwg-go/Makefile @@ -2,6 +2,13 @@ containing = $(foreach v,$2,$(if $(findstring $1,$v),$v)) FILES := $(wildcard ../wireguard-go/*/*.go) $(wildcard ../wireguard-go/*.go) FILES := $(filter-out %/main.go $(filter-out %_linux.go,$(call containing,_,$(FILES))),$(FILES)) +NDK_GO_ARCH_MAP_x86 := 386 +NDK_GO_ARCH_MAP_x86_64 := amd64 +NDK_GO_ARCH_MAP_arm := arm +NDK_GO_ARCH_MAP_arm64 := arm64 +NDK_GO_ARCH_MAP_mips := mipsx +NDK_GO_ARCH_MAP_mips64 := mips64x + export GOPATH := $(CURDIR)/gopath export GOROOT := $(CURDIR)/goroot export PATH := $(GOROOT)/bin:$(PATH) @@ -9,12 +16,12 @@ CLANG_FLAGS := --target=$(ANDROID_LLVM_TRIPLE) --gcc-toolchain=$(ANDROID_TOOLCHA export CGO_CFLAGS := $(CLANG_FLAGS) $(CFLAGS) export CGO_LDFLAGS := $(CLANG_FLAGS) $(LDFLAGS) export CC := $(ANDROID_C_COMPILER) -GO_ARCH_FILTER := case "$(ANDROID_ARCH_NAME)" in x86) echo 386 ;; x86_64) echo amd64 ;; *) echo $(ANDROID_ARCH_NAME) ;; esac -export GOARCH := $(shell $(GO_ARCH_FILTER)) +export GOARCH := $(NDK_GO_ARCH_MAP_$(ANDROID_ARCH_NAME)) export GOOS := android export CGO_ENABLED := 1 -GORELEASETARBALL := https://dl.google.com/go/go1.10.1.$(shell uname -s | tr '[:upper:]' '[:lower:]')-amd64.tar.gz +GORELEASEVERSION := 1.10.1 +GORELEASETARBALL := https://dl.google.com/go/go$(GORELEASEVERSION).$(shell uname -s | tr '[:upper:]' '[:lower:]')-$(NDK_GO_ARCH_MAP_$(shell uname -m)).tar.gz default: $(DESTDIR)/libwg-go.so |