parent
c92b09d3e7
commit
478ebed069
42
Makefile
42
Makefile
|
@ -4,7 +4,12 @@ LDFLAGS ?=
|
|||
TMPDIR ?= /tmp
|
||||
|
||||
VCFILE := v.c
|
||||
TMPVC := $(TMPDIR)/v.c
|
||||
TMPVC := $(TMPDIR)/vc
|
||||
TMPTCC := /var/tmp/tcc
|
||||
VCREPO := https://github.com/vlang/vc
|
||||
TCCREPO := https://github.com/vlang/tccbin
|
||||
GITCLEANPULL := git clean -xf && git pull --quiet
|
||||
GITFASTCLONE := git clone --depth 1 --quiet
|
||||
|
||||
#### Platform detections and overrides:
|
||||
_SYS := $(shell uname 2>/dev/null || echo Unknown)
|
||||
|
@ -34,15 +39,16 @@ endif
|
|||
#####
|
||||
|
||||
ifdef WIN32
|
||||
TCCREPO := https://github.com/vlang/tccbin_win
|
||||
VCFILE := v_win.c
|
||||
endif
|
||||
|
||||
all: latest_vc
|
||||
all: latest_vc latest_tcc
|
||||
ifdef WIN32
|
||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC) $(LDFLAGS)
|
||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC)/$(VCFILE) $(LDFLAGS)
|
||||
./v.exe self
|
||||
else
|
||||
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC) $(LDFLAGS) -lm
|
||||
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm
|
||||
ifdef ANDROID
|
||||
chmod 755 v
|
||||
endif
|
||||
|
@ -61,10 +67,32 @@ clean: clean_tmp
|
|||
git clean -xf
|
||||
|
||||
clean_tmp:
|
||||
rm $(TMPVC)
|
||||
rm -rf $(TMPTCC)
|
||||
rm -rf $(TMPVC)
|
||||
|
||||
latest_vc:
|
||||
curl "https://raw.githubusercontent.com/vlang/vc/master/v.c" -o $(TMPVC) -s
|
||||
latest_vc: $(TMPVC)/.git/config
|
||||
cd $(TMPVC) && $(GITCLEANPULL)
|
||||
|
||||
fresh_vc:
|
||||
rm -rf $(TMPVC)
|
||||
$(GITFASTCLONE) $(VCREPO) $(TMPVC)
|
||||
|
||||
latest_tcc: $(TMPTCC)/.git/config
|
||||
ifndef ANDROID
|
||||
cd $(TMPTCC) && $(GITCLEANPULL)
|
||||
endif
|
||||
|
||||
fresh_tcc:
|
||||
ifndef ANDROID
|
||||
rm -rf $(TMPTCC)
|
||||
$(GITFASTCLONE) $(TCCREPO) $(TMPTCC)
|
||||
endif
|
||||
|
||||
$(TMPTCC)/.git/config:
|
||||
$(MAKE) fresh_tcc
|
||||
|
||||
$(TMPVC)/.git/config:
|
||||
$(MAKE) fresh_vc
|
||||
|
||||
selfcompile:
|
||||
./v -keepc -cg -o v cmd/v
|
||||
|
|
Loading…
Reference in New Issue