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:
parent
2c4a51a596
commit
bf8cf8b817
38
Makefile
38
Makefile
@ -10,7 +10,8 @@ TCCREPO ?= https://github.com/vlang/tccbin
|
||||
|
||||
VCFILE := v.c
|
||||
TMPTCC := $(VROOT)/thirdparty/tcc
|
||||
TCCBRANCH := thirdparty-unknown-unknown
|
||||
TCCOS := unknown
|
||||
TCCARCH := unknown
|
||||
GITCLEANPULL := git clean -xf && git pull --quiet
|
||||
GITFASTCLONE := git clone --depth 1 --quiet --single-branch
|
||||
|
||||
@ -26,30 +27,55 @@ endif
|
||||
|
||||
ifeq ($(_SYS),Linux)
|
||||
LINUX := 1
|
||||
TCCBRANCH := thirdparty-linux-amd64
|
||||
TCCOS := linux
|
||||
endif
|
||||
|
||||
ifeq ($(_SYS),Darwin)
|
||||
MAC := 1
|
||||
TCCBRANCH := thirdparty-macos-amd64
|
||||
TCCOS := macos
|
||||
endif
|
||||
|
||||
ifeq ($(_SYS),FreeBSD)
|
||||
TCCOS := freebsd
|
||||
LDFLAGS += -lexecinfo
|
||||
endif
|
||||
|
||||
ifdef ANDROID_ROOT
|
||||
ANDROID := 1
|
||||
undefine LINUX
|
||||
TCCBRANCH := thirdparty-linux-arm64
|
||||
TCCOS := android
|
||||
endif
|
||||
#####
|
||||
|
||||
ifdef WIN32
|
||||
TCCBRANCH := thirdparty-windows-amd64
|
||||
TCCOS := windows
|
||||
VCFILE := v_win.c
|
||||
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
|
||||
ifdef WIN32
|
||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS)
|
||||
@ -104,10 +130,8 @@ endif
|
||||
endif
|
||||
|
||||
fresh_tcc:
|
||||
ifndef ANDROID
|
||||
rm -rf $(TMPTCC)
|
||||
$(GITFASTCLONE) --branch $(TCCBRANCH) $(TCCREPO) $(TMPTCC)
|
||||
endif
|
||||
|
||||
$(TMPTCC)/.git/config:
|
||||
$(MAKE) fresh_tcc
|
||||
|
Loading…
Reference in New Issue
Block a user