mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make: optimize Makefile
This commit is contained in:
parent
1386c5df13
commit
f1f4e380a2
40
Makefile
40
Makefile
@ -2,9 +2,9 @@ CC ?= cc
|
|||||||
CFLAGS ?=
|
CFLAGS ?=
|
||||||
LDFLAGS ?=
|
LDFLAGS ?=
|
||||||
TMPDIR ?= /tmp
|
TMPDIR ?= /tmp
|
||||||
|
VC ?= ./vc
|
||||||
|
|
||||||
VCFILE := v.c
|
VCFILE := v.c
|
||||||
TMPVC := $(TMPDIR)/vc
|
|
||||||
TMPTCC := /var/tmp/tcc
|
TMPTCC := /var/tmp/tcc
|
||||||
VCREPO := https://github.com/vlang/vc
|
VCREPO := https://github.com/vlang/vc
|
||||||
TCCREPO := https://github.com/vlang/tccbin
|
TCCREPO := https://github.com/vlang/tccbin
|
||||||
@ -45,20 +45,27 @@ endif
|
|||||||
|
|
||||||
all: latest_vc latest_tcc
|
all: latest_vc latest_tcc
|
||||||
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 $(VC)/$(VCFILE) $(LDFLAGS)
|
||||||
./v.exe self
|
ifdef prod
|
||||||
|
./v.exe -prod self
|
||||||
else
|
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
|
ifdef ANDROID
|
||||||
chmod 755 v
|
chmod 755 v
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef prod
|
||||||
|
./v -prod self
|
||||||
|
else
|
||||||
./v self
|
./v self
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef ANDROID
|
ifndef ANDROID
|
||||||
$(MAKE) modules
|
$(MAKE) modules
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
ifdef V_ALWAYS_CLEAN_TMP
|
|
||||||
$(MAKE) clean_tmp
|
|
||||||
endif
|
endif
|
||||||
@echo "V has been successfully built"
|
@echo "V has been successfully built"
|
||||||
@./v -version
|
@./v -version
|
||||||
@ -68,19 +75,26 @@ endif
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(TMPTCC)
|
rm -rf $(TMPTCC)
|
||||||
rm -rf $(TMPVC)
|
rm -rf $(VC)
|
||||||
|
|
||||||
latest_vc: $(TMPVC)/.git/config
|
latest_vc: $(VC)/.git/config
|
||||||
cd $(TMPVC) && $(GITCLEANPULL)
|
ifndef local
|
||||||
|
cd $(VC) && $(GITCLEANPULL)
|
||||||
|
else
|
||||||
|
@echo "Using local vc"
|
||||||
|
endif
|
||||||
|
|
||||||
fresh_vc:
|
fresh_vc:
|
||||||
rm -rf $(TMPVC)
|
$(GITFASTCLONE) $(VCREPO) $(VC)
|
||||||
$(GITFASTCLONE) $(VCREPO) $(TMPVC)
|
|
||||||
|
|
||||||
latest_tcc: $(TMPTCC)/.git/config
|
latest_tcc: $(TMPTCC)/.git/config
|
||||||
ifndef ANDROID
|
ifndef ANDROID
|
||||||
ifndef MAC
|
ifndef MAC
|
||||||
|
ifndef local
|
||||||
cd $(TMPTCC) && $(GITCLEANPULL)
|
cd $(TMPTCC) && $(GITCLEANPULL)
|
||||||
|
else
|
||||||
|
@echo "Using local tcc"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -97,7 +111,7 @@ ifndef MAC
|
|||||||
$(MAKE) fresh_tcc
|
$(MAKE) fresh_tcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(TMPVC)/.git/config:
|
$(VC)/.git/config:
|
||||||
$(MAKE) fresh_vc
|
$(MAKE) fresh_vc
|
||||||
|
|
||||||
selfcompile:
|
selfcompile:
|
||||||
|
Loading…
Reference in New Issue
Block a user