0 issues 1 contributor 4 branches 0 releases
Additions: 37 Deletions: 2 View patch
1 VEXE ?= ./v
2 VCREPO ?= https://github.com/vlang/vc
3 TCCREPO ?= https://github.com/vlang/tccbin
4+LEGACYREPO ?= https://github.com/macports/macports-legacy-support
5
6 VCFILE := v.c
7 TMPTCC := $(VROOT)/thirdparty/tcc
8+LEGACYLIBS := $(VROOT)/thirdparty/legacy
9+TMPLEGACY := $(LEGACYLIBS)/source
10 TCCOS := unknown
11 TCCARCH := unknown
12 GITCLEANPULL := git clean -xf && git pull --quiet
13 ifeq ($(_SYS),Darwin)
14 MAC := 1
15 TCCOS := macos
16+ifeq ($(shell expr $(shell uname -r | cut -d. -f1) \<= 15), 1)
17+LEGACY := 1
18+endif
19 endif
20
21 ifeq ($(_SYS),FreeBSD)
22 endif
23 endif
24
25-.PHONY: all clean check fresh_vc fresh_tcc check_for_working_tcc
26+.PHONY: all clean check fresh_vc fresh_tcc fresh_legacy check_for_working_tcc
27
28 ifdef prod
29 VFLAGS+=-prod
30 endif
31
32-all: latest_vc latest_tcc
33+all: latest_vc latest_tcc latest_legacy
34 ifdef WIN32
35 $(CC) $(CFLAGS) -std=c99 -municode -w -o v1.exe $(VC)/$(VCFILE) $(LDFLAGS)
36 v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
37 del v1.exe
38 del v2.exe
39 else
40+ifdef LEGACY
41+ $(MAKE) -C $(TMPLEGACY)
42+ $(MAKE) -C $(TMPLEGACY) PREFIX=$(realpath $(LEGACYLIBS)) CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) install
43+ rm -rf $(TMPLEGACY)
44+ $(eval override LDFLAGS+=-L$(realpath $(LEGACYLIBS))/lib -lMacportsLegacySupport)
45+endif
46 $(CC) $(CFLAGS) -std=gnu99 -w -o v1.exe $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
47 ./v1.exe -no-parallel -o v2.exe $(VFLAGS) cmd/v
48 ./v2.exe -o $(VEXE) $(VFLAGS) cmd/v
49
50 clean:
51 rm -rf $(TMPTCC)
52+ rm -rf $(LEGACYLIBS)
53 rm -rf $(VC)
54
55 ifndef local
56 @$(MAKE) --quiet check_for_working_tcc 2> /dev/null
57 endif
58
59+ifndef local
60+latest_legacy: $(TMPLEGACY)/.git/config
61+ifdef LEGACY
62+ cd $(TMPLEGACY) && $(GITCLEANPULL)
63+endif
64+else
65+latest_legacy:
66+ifdef LEGACY
67+ @echo "Using local legacysupport"
68+endif
69+endif
70+
71+fresh_legacy:
72+ rm -rf $(LEGACYLIBS)
73+ $(GITFASTCLONE) $(LEGACYREPO) $(TMPLEGACY)
74+
75 $(TMPTCC)/.git/config:
76 $(MAKE) fresh_tcc
77
78 $(VC)/.git/config:
79 $(MAKE) fresh_vc
80
81+$(TMPLEGACY)/.git/config:
82+ifdef LEGACY
83+ $(MAKE) fresh_legacy
84+endif
85+
86 asan:
87 $(MAKE) all CFLAGS='-fsanitize=address,undefined'
88
89
1 // that can be found in the LICENSE file.
2 module time
3
4+#flag darwin [email protected]/thirdparty/legacy/include/LegacySupport
5 #include <time.h>
6 #include <errno.h>
7