mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make: improve diagnostic messages when the prebuilt tcc executable does not work/is missing
This commit is contained in:
parent
ef562c92a5
commit
6dfa11e2f7
13
GNUmakefile
13
GNUmakefile
@ -76,7 +76,7 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: all clean fresh_vc fresh_tcc
|
||||
.PHONY: all clean fresh_vc fresh_tcc check_for_working_tcc
|
||||
|
||||
ifdef prod
|
||||
VFLAGS+=-prod
|
||||
@ -95,6 +95,7 @@ else
|
||||
./v2.exe -o $(V) $(VFLAGS) cmd/v
|
||||
rm -rf v1.exe v2.exe
|
||||
endif
|
||||
@$(V) run cmd/tools/detect_tcc.v
|
||||
@echo "V has been successfully built"
|
||||
@$(V) -version
|
||||
|
||||
@ -110,16 +111,21 @@ latest_vc:
|
||||
@echo "Using local vc"
|
||||
endif
|
||||
|
||||
check_for_working_tcc:
|
||||
@$(TMPTCC)/tcc.exe --version > /dev/null 2> /dev/null || echo "The executable '$(TMPTCC)/tcc.exe' does not work."
|
||||
|
||||
fresh_vc:
|
||||
rm -rf $(VC)
|
||||
$(GITFASTCLONE) $(VCREPO) $(VC)
|
||||
|
||||
ifndef local
|
||||
latest_tcc: $(TMPTCC)/.git/config
|
||||
cd $(TMPTCC) && $(GITCLEANPULL)
|
||||
@pushd . > /dev/null && cd $(TMPTCC) && $(GITCLEANPULL) && popd > /dev/null
|
||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||
else
|
||||
latest_tcc:
|
||||
@echo "Using local tcc"
|
||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||
endif
|
||||
|
||||
fresh_tcc:
|
||||
@ -128,12 +134,15 @@ ifndef local
|
||||
# Check wether a TCC branch exists for the user's system configuration.
|
||||
ifneq (,$(findstring thirdparty-$(TCCOS)-$(TCCARCH), $(shell git ls-remote --heads $(TCCREPO) | sed 's/^[a-z0-9]*\trefs.heads.//')))
|
||||
$(GITFASTCLONE) --branch thirdparty-$(TCCOS)-$(TCCARCH) $(TCCREPO) $(TMPTCC)
|
||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||
else
|
||||
@echo 'Pre-built TCC not available for thirdparty-$(TCCOS)-$(TCCARCH) at $(TCCREPO), will use the system compiler: $(CC)'
|
||||
$(GITFASTCLONE) --branch thirdparty-unknown-unknown $(TCCREPO) $(TMPTCC)
|
||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||
endif
|
||||
else
|
||||
@echo "Using local tccbin"
|
||||
@$(MAKE) --quiet check_for_working_tcc 2> /dev/null
|
||||
endif
|
||||
|
||||
$(TMPTCC)/.git/config:
|
||||
|
1
Makefile
1
Makefile
@ -9,3 +9,4 @@ all:
|
||||
./v2 -o v $(VFLAGS) cmd/v
|
||||
rm -rf v1 v2 vc/
|
||||
@echo "V has been successfully built"
|
||||
./v run ./cmd/tools/detect_tcc.v
|
||||
|
15
cmd/tools/detect_tcc.v
Normal file
15
cmd/tools/detect_tcc.v
Normal file
@ -0,0 +1,15 @@
|
||||
fn main() {
|
||||
$if tinyc {
|
||||
println('Your `tcc` is working. Good - it is much faster at compiling C source code.')
|
||||
exit(0)
|
||||
}
|
||||
|
||||
println('
|
||||
NB: `tcc` was not used, so unless you install it yourself, your backend
|
||||
C compiler will be `cc`, which is usually either `clang`, `gcc` or `msvc`.
|
||||
|
||||
These C compilers, are several times slower at compiling C source code,
|
||||
compared to `tcc`. They do produce more optimised executables, but that
|
||||
is done at the cost of compilation speed.
|
||||
')
|
||||
}
|
Loading…
Reference in New Issue
Block a user