mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
4d6b8cbfd8
commit
bc06866b20
38
GNUmakefile
38
GNUmakefile
@ -7,9 +7,12 @@ VC ?= ./vc
|
|||||||
VEXE ?= ./v
|
VEXE ?= ./v
|
||||||
VCREPO ?= https://github.com/vlang/vc
|
VCREPO ?= https://github.com/vlang/vc
|
||||||
TCCREPO ?= https://github.com/vlang/tccbin
|
TCCREPO ?= https://github.com/vlang/tccbin
|
||||||
|
LEGACYREPO ?= https://github.com/macports/macports-legacy-support
|
||||||
|
|
||||||
VCFILE := v.c
|
VCFILE := v.c
|
||||||
TMPTCC := $(VROOT)/thirdparty/tcc
|
TMPTCC := $(VROOT)/thirdparty/tcc
|
||||||
|
LEGACYLIBS := $(VROOT)/thirdparty/legacy
|
||||||
|
TMPLEGACY := $(LEGACYLIBS)/source
|
||||||
TCCOS := unknown
|
TCCOS := unknown
|
||||||
TCCARCH := unknown
|
TCCARCH := unknown
|
||||||
GITCLEANPULL := git clean -xf && git pull --quiet
|
GITCLEANPULL := git clean -xf && git pull --quiet
|
||||||
@ -36,6 +39,9 @@ endif
|
|||||||
ifeq ($(_SYS),Darwin)
|
ifeq ($(_SYS),Darwin)
|
||||||
MAC := 1
|
MAC := 1
|
||||||
TCCOS := macos
|
TCCOS := macos
|
||||||
|
ifeq ($(shell expr $(shell uname -r | cut -d. -f1) \<= 15), 1)
|
||||||
|
LEGACY := 1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(_SYS),FreeBSD)
|
ifeq ($(_SYS),FreeBSD)
|
||||||
@ -79,13 +85,13 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all clean check fresh_vc fresh_tcc check_for_working_tcc
|
.PHONY: all clean check fresh_vc fresh_tcc fresh_legacy check_for_working_tcc
|
||||||
|
|
||||||
ifdef prod
|
ifdef prod
|
||||||
VFLAGS+=-prod
|
VFLAGS+=-prod
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: latest_vc latest_tcc
|
all: latest_vc latest_tcc latest_legacy
|
||||||
ifdef WIN32
|
ifdef WIN32
|
||||||
$(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS)
|
$(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS)
|
||||||
v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
|
v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
|
||||||
@ -93,6 +99,12 @@ ifdef WIN32
|
|||||||
del v1.exe
|
del v1.exe
|
||||||
del v2.exe
|
del v2.exe
|
||||||
else
|
else
|
||||||
|
ifdef LEGACY
|
||||||
|
$(MAKE) -C $(TMPLEGACY)
|
||||||
|
$(MAKE) -C $(TMPLEGACY) PREFIX=$(realpath $(LEGACYLIBS)) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) install
|
||||||
|
rm -rf $(TMPLEGACY)
|
||||||
|
$(eval override LDFLAGS+=-L$(realpath $(LEGACYLIBS))/lib -lMacportsLegacySupport)
|
||||||
|
endif
|
||||||
$(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
|
$(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
|
||||||
./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
|
./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
|
||||||
./v2.exe -o $(VEXE) $(VFLAGS) cmd/v
|
./v2.exe -o $(VEXE) $(VFLAGS) cmd/v
|
||||||
@ -104,6 +116,7 @@ endif
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(TMPTCC)
|
rm -rf $(TMPTCC)
|
||||||
|
rm -rf $(LEGACYLIBS)
|
||||||
rm -rf $(VC)
|
rm -rf $(VC)
|
||||||
|
|
||||||
ifndef local
|
ifndef local
|
||||||
@ -148,12 +161,33 @@ else
|
|||||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef local
|
||||||
|
latest_legacy: $(TMPLEGACY)/.git/config
|
||||||
|
ifdef LEGACY
|
||||||
|
cd $(TMPLEGACY) && $(GITCLEANPULL)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
latest_legacy:
|
||||||
|
ifdef LEGACY
|
||||||
|
@echo "Using local legacysupport"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
fresh_legacy:
|
||||||
|
rm -rf $(LEGACYLIBS)
|
||||||
|
$(GITFASTCLONE) $(LEGACYREPO) $(TMPLEGACY)
|
||||||
|
|
||||||
$(TMPTCC)/.git/config:
|
$(TMPTCC)/.git/config:
|
||||||
$(MAKE) fresh_tcc
|
$(MAKE) fresh_tcc
|
||||||
|
|
||||||
$(VC)/.git/config:
|
$(VC)/.git/config:
|
||||||
$(MAKE) fresh_vc
|
$(MAKE) fresh_vc
|
||||||
|
|
||||||
|
$(TMPLEGACY)/.git/config:
|
||||||
|
ifdef LEGACY
|
||||||
|
$(MAKE) fresh_legacy
|
||||||
|
endif
|
||||||
|
|
||||||
asan:
|
asan:
|
||||||
$(MAKE) all CFLAGS='-fsanitize=address,undefined'
|
$(MAKE) all CFLAGS='-fsanitize=address,undefined'
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
// that can be found in the LICENSE file.
|
// that can be found in the LICENSE file.
|
||||||
module time
|
module time
|
||||||
|
|
||||||
|
#flag darwin -I@VEXEROOT/thirdparty/legacy/include/LegacySupport
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user