make: optimize Makefile
parent
1386c5df13
commit
f1f4e380a2
40
Makefile
40
Makefile
|
@ -2,9 +2,9 @@ CC ?= cc
|
|||
CFLAGS ?=
|
||||
LDFLAGS ?=
|
||||
TMPDIR ?= /tmp
|
||||
VC ?= ./vc
|
||||
|
||||
VCFILE := v.c
|
||||
TMPVC := $(TMPDIR)/vc
|
||||
TMPTCC := /var/tmp/tcc
|
||||
VCREPO := https://github.com/vlang/vc
|
||||
TCCREPO := https://github.com/vlang/tccbin
|
||||
|
@ -45,20 +45,27 @@ endif
|
|||
|
||||
all: latest_vc latest_tcc
|
||||
ifdef WIN32
|
||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(TMPVC)/$(VCFILE) $(LDFLAGS)
|
||||
./v.exe self
|
||||
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o v.exe $(VC)/$(VCFILE) $(LDFLAGS)
|
||||
ifdef prod
|
||||
./v.exe -prod self
|
||||
else
|
||||
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(TMPVC)/$(VCFILE) $(LDFLAGS) -lm -lpthread
|
||||
./v.exe self
|
||||
endif
|
||||
else
|
||||
$(CC) $(CFLAGS) -g -std=gnu11 -w -o v $(VC)/$(VCFILE) $(LDFLAGS) -lm -lpthread
|
||||
ifdef ANDROID
|
||||
chmod 755 v
|
||||
endif
|
||||
|
||||
ifdef prod
|
||||
./v -prod self
|
||||
else
|
||||
./v self
|
||||
endif
|
||||
|
||||
ifndef ANDROID
|
||||
$(MAKE) modules
|
||||
endif
|
||||
endif
|
||||
ifdef V_ALWAYS_CLEAN_TMP
|
||||
$(MAKE) clean_tmp
|
||||
endif
|
||||
@echo "V has been successfully built"
|
||||
@./v -version
|
||||
|
@ -68,19 +75,26 @@ endif
|
|||
|
||||
clean:
|
||||
rm -rf $(TMPTCC)
|
||||
rm -rf $(TMPVC)
|
||||
rm -rf $(VC)
|
||||
|
||||
latest_vc: $(TMPVC)/.git/config
|
||||
cd $(TMPVC) && $(GITCLEANPULL)
|
||||
latest_vc: $(VC)/.git/config
|
||||
ifndef local
|
||||
cd $(VC) && $(GITCLEANPULL)
|
||||
else
|
||||
@echo "Using local vc"
|
||||
endif
|
||||
|
||||
fresh_vc:
|
||||
rm -rf $(TMPVC)
|
||||
$(GITFASTCLONE) $(VCREPO) $(TMPVC)
|
||||
$(GITFASTCLONE) $(VCREPO) $(VC)
|
||||
|
||||
latest_tcc: $(TMPTCC)/.git/config
|
||||
ifndef ANDROID
|
||||
ifndef MAC
|
||||
ifndef local
|
||||
cd $(TMPTCC) && $(GITCLEANPULL)
|
||||
else
|
||||
@echo "Using local tcc"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -97,7 +111,7 @@ ifndef MAC
|
|||
$(MAKE) fresh_tcc
|
||||
endif
|
||||
|
||||
$(TMPVC)/.git/config:
|
||||
$(VC)/.git/config:
|
||||
$(MAKE) fresh_vc
|
||||
|
||||
selfcompile:
|
||||
|
|
Loading…
Reference in New Issue