makefile: simplify and speed up
parent
db5036686b
commit
c7e4f5eefb
42
Makefile
42
Makefile
|
@ -4,12 +4,7 @@ LDFLAGS ?=
|
||||||
TMPDIR ?= /tmp
|
TMPDIR ?= /tmp
|
||||||
|
|
||||||
VCFILE := v.c
|
VCFILE := v.c
|
||||||
TMPVC := $(TMPDIR)/vc
|
TMPVC := $(TMPDIR)/v.c
|
||||||
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:
|
#### Platform detections and overrides:
|
||||||
_SYS := $(shell uname 2>/dev/null || echo Unknown)
|
_SYS := $(shell uname 2>/dev/null || echo Unknown)
|
||||||
|
@ -39,16 +34,15 @@ endif
|
||||||
#####
|
#####
|
||||||
|
|
||||||
ifdef WIN32
|
ifdef WIN32
|
||||||
TCCREPO := https://github.com/vlang/tccbin_win
|
|
||||||
VCFILE := v_win.c
|
VCFILE := v_win.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: latest_vc latest_tcc
|
all: latest_vc
|
||||||
ifdef WIN32
|
ifdef WIN32
|
||||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC)/$(VCFILE) $(LDFLAGS)
|
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC) $(LDFLAGS)
|
||||||
./v.exe self
|
./v.exe self
|
||||||
else
|
else
|
||||||
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm
|
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC) $(LDFLAGS) -lm
|
||||||
ifdef ANDROID
|
ifdef ANDROID
|
||||||
chmod 755 v
|
chmod 755 v
|
||||||
endif
|
endif
|
||||||
|
@ -67,32 +61,10 @@ clean: clean_tmp
|
||||||
git clean -xf
|
git clean -xf
|
||||||
|
|
||||||
clean_tmp:
|
clean_tmp:
|
||||||
rm -rf $(TMPTCC)
|
rm $(TMPVC)
|
||||||
rm -rf $(TMPVC)
|
|
||||||
|
|
||||||
latest_vc: $(TMPVC)/.git/config
|
latest_vc:
|
||||||
cd $(TMPVC) && $(GITCLEANPULL)
|
curl "https://raw.githubusercontent.com/vlang/vc/master/v.c" -o $(TMPVC) -s
|
||||||
|
|
||||||
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:
|
selfcompile:
|
||||||
./v -keepc -cg -o v cmd/v
|
./v -keepc -cg -o v cmd/v
|
||||||
|
|
2
make.bat
2
make.bat
|
@ -8,7 +8,7 @@ if exist "vc" (
|
||||||
rd /s /q vc
|
rd /s /q vc
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Downloading v.c...
|
echo Downloading v.c from github.com/vlang/vc...
|
||||||
git clone --depth 1 --quiet https://github.com/vlang/vc
|
git clone --depth 1 --quiet https://github.com/vlang/vc
|
||||||
|
|
||||||
REM option to force msvc or gcc
|
REM option to force msvc or gcc
|
||||||
|
|
Loading…
Reference in New Issue