1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

makefile: detect CPU architecture for cloning the proper prebuilt thirdparty/tcc branch (#7502)

This commit is contained in:
spaceface 2020-12-23 13:41:50 +01:00 committed by GitHub
parent 2c4a51a596
commit bf8cf8b817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,8 @@ TCCREPO ?= https://github.com/vlang/tccbin
VCFILE := v.c VCFILE := v.c
TMPTCC := $(VROOT)/thirdparty/tcc TMPTCC := $(VROOT)/thirdparty/tcc
TCCBRANCH := thirdparty-unknown-unknown TCCOS := unknown
TCCARCH := unknown
GITCLEANPULL := git clean -xf && git pull --quiet GITCLEANPULL := git clean -xf && git pull --quiet
GITFASTCLONE := git clone --depth 1 --quiet --single-branch GITFASTCLONE := git clone --depth 1 --quiet --single-branch
@ -26,30 +27,55 @@ endif
ifeq ($(_SYS),Linux) ifeq ($(_SYS),Linux)
LINUX := 1 LINUX := 1
TCCBRANCH := thirdparty-linux-amd64 TCCOS := linux
endif endif
ifeq ($(_SYS),Darwin) ifeq ($(_SYS),Darwin)
MAC := 1 MAC := 1
TCCBRANCH := thirdparty-macos-amd64 TCCOS := macos
endif endif
ifeq ($(_SYS),FreeBSD) ifeq ($(_SYS),FreeBSD)
TCCOS := freebsd
LDFLAGS += -lexecinfo LDFLAGS += -lexecinfo
endif endif
ifdef ANDROID_ROOT ifdef ANDROID_ROOT
ANDROID := 1 ANDROID := 1
undefine LINUX undefine LINUX
TCCBRANCH := thirdparty-linux-arm64 TCCOS := android
endif endif
##### #####
ifdef WIN32 ifdef WIN32
TCCBRANCH := thirdparty-windows-amd64 TCCOS := windows
VCFILE := v_win.c VCFILE := v_win.c
endif endif
TCCARCH := $(shell uname -m 2>/dev/null || echo unknown)
ifeq ($(TCCARCH),x86_64)
TCCARCH := amd64
else
ifneq ($(filter x86%,$(TCCARCH)),)
TCCARCH := i386
else
ifeq ($(_ARCH),arm64)
TCCARCH := arm64
else
ifeq ($(_ARCH),aarch64)
TCCARCH := arm64
else
ifneq ($(filter arm%,$(TCCARCH)),)
TCCARCH := arm
endif
endif
endif
endif
endif
TCCBRANCH := thirdparty-$(TCCOS)-$(TCCARCH)
all: latest_vc latest_tcc all: latest_vc latest_tcc
ifdef WIN32 ifdef WIN32
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) $(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS)
@ -104,10 +130,8 @@ endif
endif endif
fresh_tcc: fresh_tcc:
ifndef ANDROID
rm -rf $(TMPTCC) rm -rf $(TMPTCC)
$(GITFASTCLONE) --branch $(TCCBRANCH) $(TCCREPO) $(TMPTCC) $(GITFASTCLONE) --branch $(TCCBRANCH) $(TCCREPO) $(TMPTCC)
endif
$(TMPTCC)/.git/config: $(TMPTCC)/.git/config:
$(MAKE) fresh_tcc $(MAKE) fresh_tcc