mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
configury update & bump VERSION to 0.9.28rc
configure: - option --targetos=... for cross build - cleanup win32/build-tcc.bat: - option -b <bindir> - make 'libtcc1.a' and cross-prefix-libtcc1.a (same convention as with makefile) Makefile: - streamline tcov-tests, help, etc. workflow/build.xml: simplify - using "windows-2019" runner (instead of windows-latest) because its msys seems more complete and has no problems with the 96_nodata_wanted.test either. Changelog,TODO,USES,tcc-doc.texi: update
This commit is contained in:
parent
8c5fe87665
commit
086870addd
74
.github/workflows/build.yml
vendored
74
.github/workflows/build.yml
vendored
@ -1,68 +1,32 @@
|
|||||||
name: build and run tests
|
name: build and run tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ mob ]
|
branches: [ mob ]
|
||||||
pull_request:
|
|
||||||
branches: [ mob ]
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release-linux-i686-amd64:
|
test-x86_64-linux:
|
||||||
name: tinycc master linux/amd64
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Install dependencies
|
- name: make & test tcc
|
||||||
run: sudo apt-get install -y
|
run: ./configure && make && make test -k
|
||||||
gcc
|
|
||||||
# see what's available in /usr/bin
|
|
||||||
- name: see what's available
|
|
||||||
run: ls -l /usr/bin
|
|
||||||
# build project amd64
|
|
||||||
- name: build amd64
|
|
||||||
run: |
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
# run tests
|
|
||||||
- name: run test_exs amd64
|
|
||||||
run: |
|
|
||||||
make test
|
|
||||||
|
|
||||||
build-release-osx-amd64:
|
test-x86_64-osx:
|
||||||
name: tinycc master osx/amd64
|
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
# see what's available in /usr/bin
|
- name: make & test tcc
|
||||||
- name: see what's available
|
run: ./configure && make && make test -k
|
||||||
run: ls -l /usr/bin
|
|
||||||
# build project amd64
|
|
||||||
- name: build amd64
|
|
||||||
run: |
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
# run tests
|
|
||||||
- name: run test_exs amd64
|
|
||||||
run: |
|
|
||||||
make test
|
|
||||||
|
|
||||||
build-release-windows-amd64-on-windows:
|
test-x86_64-win32:
|
||||||
name: tinycc master windows/amd64 on Windows
|
runs-on: windows-2019
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: msys2/setup-msys2@v2
|
- name: make & test tcc
|
||||||
# build project amd64
|
shell: cmd
|
||||||
- name: build amd64
|
|
||||||
run: |
|
run: |
|
||||||
msys2 -c './configure'
|
set MSYS2_PATH_TYPE=inherit
|
||||||
make
|
set MSYSTEM=MINGW64
|
||||||
# silency failing tests
|
set CHERE_INVOKING=yes
|
||||||
- name: silence 96_nodata_wanted
|
C:\msys64\usr\bin\bash -l -c "./configure && make && make test -k"
|
||||||
run: |
|
|
||||||
pushd .\tests\tests2
|
|
||||||
Get-Content .\96_nodata_wanted.expect -TotalCount 2 | Out-File .\96_nodata_wanted.expect2 -Encoding default
|
|
||||||
mv .\96_nodata_wanted.expect2 .\96_nodata_wanted.expect -force
|
|
||||||
popd
|
|
||||||
# run tests
|
|
||||||
- name: run test_exs amd64
|
|
||||||
run: |
|
|
||||||
make test
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -31,9 +31,9 @@ tags
|
|||||||
TAGS
|
TAGS
|
||||||
tcc.1
|
tcc.1
|
||||||
*.pod
|
*.pod
|
||||||
|
*.tcov
|
||||||
tcc-doc.html
|
tcc-doc.html
|
||||||
tcc-doc.info
|
tcc-doc.info
|
||||||
tcc_c.tcov
|
|
||||||
|
|
||||||
win32/doc
|
win32/doc
|
||||||
win32/examples/libtcc_test.c
|
win32/examples/libtcc_test.c
|
||||||
|
21
Changelog
21
Changelog
@ -1,19 +1,26 @@
|
|||||||
version 0.9.28:
|
version 0.9.28:
|
||||||
|
|
||||||
User interface:
|
User interface:
|
||||||
- new tcc -ar x and t flags (herman ten brugge)
|
- -b : bounds checker much improved (herman ten brugge)
|
||||||
|
- -bt : support for standalone backtraces also (grischka)
|
||||||
|
- -gdwarf : debug format (herman ten brugge)
|
||||||
|
- -M, -MM, and -MMD (Arthur Williams)
|
||||||
|
- -W[no-]error=<option> (Steffen Nurpmeso)
|
||||||
|
|
||||||
Platforms:
|
Platforms:
|
||||||
- new RISC-V (riscv64) target
|
- new RISC-V (riscv64) target (Michael Matz)
|
||||||
- native macOS support for x86_64/arm64 (Herman ten Brugge)
|
- native macOS support for x86_64 (Michael Matz, Herman ten Brugge)
|
||||||
|
- arm and riscv64 assemblers (Danny Milosavljevic)
|
||||||
|
- Android support with position independent executables (grischka)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
- Improved support for C11
|
- _Static_assert() (matthias)
|
||||||
- C11 _Static_assert support (matthias)
|
- __attribute__ ((cleanup(func))) (matthias)
|
||||||
|
- stdatomic (Dmitry Selyutin)
|
||||||
|
- asm goto ("jmp %l[label]" : : : : label) (Michael Matz)
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
- fix preprocessor line (#line) directive (Herman ten Brugge)
|
- ... many, see git shortlog release_0_9_27...release_0_9_27
|
||||||
Many more! see also git shortlog release_0_9_27...HEAD
|
|
||||||
|
|
||||||
Version 0.9.27:
|
Version 0.9.27:
|
||||||
|
|
||||||
|
112
Makefile
112
Makefile
@ -30,13 +30,19 @@ ifdef CONFIG_WIN32
|
|||||||
LIBTCC = libtcc$(DLLSUF)
|
LIBTCC = libtcc$(DLLSUF)
|
||||||
LIBTCCDEF = libtcc.def
|
LIBTCCDEF = libtcc.def
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CONFIG_debug),yes)
|
||||||
|
LDFLAGS += -s
|
||||||
|
endif
|
||||||
NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32)
|
NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32)
|
||||||
else
|
else
|
||||||
CFG = -unx
|
CFG = -unx
|
||||||
LIBS=-lm -lpthread
|
LIBS+=-lm
|
||||||
ifneq ($(CONFIG_ldl),no)
|
ifneq ($(CONFIG_ldl),no)
|
||||||
LIBS+=-ldl
|
LIBS+=-ldl
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CONFIG_pthread),no)
|
||||||
|
LIBS+=-lpthread
|
||||||
|
endif
|
||||||
# make libtcc as static or dynamic library?
|
# make libtcc as static or dynamic library?
|
||||||
ifeq ($(CONFIG_static),no)
|
ifeq ($(CONFIG_static),no)
|
||||||
LIBTCC=libtcc$(DLLSUF)
|
LIBTCC=libtcc$(DLLSUF)
|
||||||
@ -68,11 +74,8 @@ endif
|
|||||||
TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
||||||
TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
|
TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
|
||||||
TCCFLAGS = $(TCCFLAGS$(CFG))
|
TCCFLAGS = $(TCCFLAGS$(CFG))
|
||||||
ifdef USE_TCC_C
|
TCC_LOCAL = $(TOP)/tcc$(EXESUF)
|
||||||
TCC = $(TOP)/tcc_c$(EXESUF) $(TCCFLAGS)
|
TCC = $(TCC_LOCAL) $(TCCFLAGS)
|
||||||
else
|
|
||||||
TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
|
CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
|
||||||
LIBS_P = $(LIBS)
|
LIBS_P = $(LIBS)
|
||||||
@ -181,11 +184,8 @@ DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"")
|
|||||||
DEFINES += $(DEF-$(or $(findstring win,$T),unx))
|
DEFINES += $(DEF-$(or $(findstring win,$T),unx))
|
||||||
|
|
||||||
ifneq ($(X),)
|
ifneq ($(X),)
|
||||||
ifeq ($(CONFIG_WIN32),yes)
|
|
||||||
DEF-win += -DCONFIG_TCC_CROSSPREFIX="\"$X\""
|
|
||||||
DEF-unx += -DCONFIG_TCC_CROSSPREFIX="\"lib/$X\""
|
|
||||||
else
|
|
||||||
DEF-all += -DCONFIG_TCC_CROSSPREFIX="\"$X\""
|
DEF-all += -DCONFIG_TCC_CROSSPREFIX="\"$X\""
|
||||||
|
ifneq ($(CONFIG_WIN32),yes)
|
||||||
DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\""
|
DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\""
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -249,17 +249,14 @@ endif
|
|||||||
|
|
||||||
GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no)
|
GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no)
|
||||||
ifneq ($(GITHASH),no)
|
ifneq ($(GITHASH),no)
|
||||||
GITHASH:=$(shell git log -1 --pretty='format:%cs $(GITHASH)@%h')$(shell git diff --quiet || echo '*')
|
GITHASH:=$(shell git log -1 --date=short --pretty='format:%cd $(GITHASH)@%h')
|
||||||
DEF_GITHASH:= -DTCC_GITHASH="\"$(GITHASH)\""
|
GITMODF:=$(shell git diff --quiet || echo '*')
|
||||||
|
DEF_GITHASH:= -DTCC_GITHASH="\"$(GITHASH)$(GITMODF)\""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_debug),yes)
|
ifeq ($(CONFIG_debug),yes)
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
LDFLAGS += -g
|
LDFLAGS += -g
|
||||||
else
|
|
||||||
ifndef CONFIG_OSX
|
|
||||||
LDFLAGS += -s
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# convert "include/tccdefs.h" to "tccdefs_.h"
|
# convert "include/tccdefs.h" to "tccdefs_.h"
|
||||||
@ -335,7 +332,11 @@ libtcc1.a : tcc$(EXESUF) FORCE
|
|||||||
.PRECIOUS: %-libtcc1.a
|
.PRECIOUS: %-libtcc1.a
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
run-if = $(if $(shell command -v $1),$S $1 $2)
|
# WHICH = which $1 2>/dev/null
|
||||||
|
# some versions of gnu-make do not recognize 'command' as a shell builtin
|
||||||
|
WHICH = sh -c 'command -v $1'
|
||||||
|
|
||||||
|
run-if = $(if $(shell $(call WHICH,$1)),$S $1 $2)
|
||||||
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@ -348,7 +349,7 @@ tcc-doc.info: tcc-doc.texi
|
|||||||
|
|
||||||
tcc.1 : tcc-doc.pod
|
tcc.1 : tcc-doc.pod
|
||||||
$(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \
|
$(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \
|
||||||
--release="$(VERSION)" $< >$@ && rm -f $<)
|
--release="$(VERSION)" $< >$@)
|
||||||
%.pod : %.texi
|
%.pod : %.texi
|
||||||
$(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@)
|
$(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@)
|
||||||
|
|
||||||
@ -392,8 +393,9 @@ endif
|
|||||||
|
|
||||||
# uninstall
|
# uninstall
|
||||||
uninstall-unx:
|
uninstall-unx:
|
||||||
@rm -fv $(foreach P,$(PROGS) $(PROGS_CROSS),"$(bindir)/$P")
|
@rm -fv $(addprefix "$(bindir)/",$(PROGS) $(PROGS_CROSS))
|
||||||
@rm -fv "$(libdir)/libtcc.a" "$(libdir)/libtcc.so" "$(libdir)/libtcc.dylib" "$(includedir)/libtcc.h"
|
@rm -fv $(addprefix "$(libdir)/", libtcc*.a libtcc*.so libtcc.dylib,$P)
|
||||||
|
@rm -fv $(addprefix "$(includedir)/", libtcc.h)
|
||||||
@rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
|
@rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info"
|
||||||
@rm -fv "$(docdir)/tcc-doc.html"
|
@rm -fv "$(docdir)/tcc-doc.html"
|
||||||
@rm -frv "$(tccdir)"
|
@rm -frv "$(tccdir)"
|
||||||
@ -415,17 +417,19 @@ ifneq "$(wildcard $(LIBTCC1_U))" ""
|
|||||||
$(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/lib/include")
|
$(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/lib/include")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# the msys-git shell works to configure && make except it does not have install
|
|
||||||
ifeq ($(CONFIG_WIN32)-$(shell command -v install || echo no),yes-no)
|
|
||||||
install-win : INSTALL = cp
|
|
||||||
install-win : INSTALLBIN = cp
|
|
||||||
endif
|
|
||||||
|
|
||||||
# uninstall on windows
|
# uninstall on windows
|
||||||
uninstall-win:
|
uninstall-win:
|
||||||
@rm -fv $(foreach P,libtcc.dll $(PROGS) *-tcc.exe,"$(bindir)"/$P)
|
@rm -fv $(addprefix "$(bindir)/", libtcc*.dll $(PROGS) *-tcc.exe)
|
||||||
@rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P"/*)
|
@rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P/*")
|
||||||
@rm -frv $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P")
|
@rm -frv $(addprefix "$(tccdir)/", doc examples include lib libtcc)
|
||||||
|
|
||||||
|
# the msys-git shell works to configure && make except it does not have install
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
ifeq ($(shell $(call WHICH,install) || echo no),no)
|
||||||
|
INSTALL = cp
|
||||||
|
INSTALLBIN = cp
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# other stuff
|
# other stuff
|
||||||
@ -459,66 +463,50 @@ test:
|
|||||||
# run test(s) from tests2 subdir (see make help)
|
# run test(s) from tests2 subdir (see make help)
|
||||||
tests2.%:
|
tests2.%:
|
||||||
@$(MAKE) -C tests/tests2 $@
|
@$(MAKE) -C tests/tests2 $@
|
||||||
|
# run test(s) from testspp subdir (see make help)
|
||||||
testspp.%:
|
testspp.%:
|
||||||
@$(MAKE) -C tests/pp $@
|
@$(MAKE) -C tests/pp $@
|
||||||
|
# run tests with code coverage
|
||||||
# run all tests with code coverage
|
tcov-tes% : tcc_c$(EXESUF)
|
||||||
|
@rm -f $<.tcov
|
||||||
|
@$(MAKE) --no-print-directory TCC_LOCAL=$(CURDIR)/$< tes$*
|
||||||
tcc_c$(EXESUF): $($T_FILES)
|
tcc_c$(EXESUF): $($T_FILES)
|
||||||
@${TCC} -o $@ -ftest-coverage $< $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)
|
$S$(TCC) tcc.c -o $@ -ftest-coverage $(DEFINES)
|
||||||
testc: tcc_c$(EXESUF)
|
|
||||||
@rm -f tcc_c.tcov
|
|
||||||
@USE_TCC_C=yes $(MAKE) -C tests
|
|
||||||
testc2.%: tcc_c$(EXESUF)
|
|
||||||
@rm -f tcc_c.tcov
|
|
||||||
@USE_TCC_C=yes $(MAKE) -C tests/tests2 $@
|
|
||||||
testcpp.%: tcc_c$(EXESUF)
|
|
||||||
@rm -f tcc_c.tcov
|
|
||||||
@USE_TCC_C=yes $(MAKE) -C tests/pp $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f tcc$(EXESUF) tcc_c$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tags ETAGS *.pod
|
@rm -f tcc$(EXESUF) tcc_c$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF)
|
||||||
@rm -f *.o *.a *.so* *.out *.log lib*.def *.exe *.dll a.out *.dylib *_.h
|
@rm -f tags ETAGS *.o *.a *.so* *.out *.log lib*.def *.exe *.dll
|
||||||
|
@rm -f a.out *.dylib *_.h *.pod *.tcov
|
||||||
@$(MAKE) -s -C lib $@
|
@$(MAKE) -s -C lib $@
|
||||||
@$(MAKE) -s -C tests $@
|
@$(MAKE) -s -C tests $@
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
@rm -f config.h config.mak config.texi
|
@rm -vf config.h config.mak config.texi
|
||||||
@rm -f $(TCCDOCS)
|
@rm -vf $(TCCDOCS)
|
||||||
|
|
||||||
.PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE
|
.PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "make"
|
@echo "make"
|
||||||
@echo " build native compiler (from separate objects)"
|
@echo " build native compiler (from separate objects)"
|
||||||
@echo ""
|
|
||||||
@echo "make cross"
|
@echo "make cross"
|
||||||
@echo " build cross compilers (from one source)"
|
@echo " build cross compilers (from one source)"
|
||||||
@echo ""
|
|
||||||
@echo "make ONE_SOURCE=no/yes SILENT=no/yes"
|
@echo "make ONE_SOURCE=no/yes SILENT=no/yes"
|
||||||
@echo " force building from separate/one object(s), less/more silently"
|
@echo " force building from separate/one object(s), less/more silently"
|
||||||
@echo ""
|
|
||||||
@echo "make cross-TARGET"
|
@echo "make cross-TARGET"
|
||||||
@echo " build one specific cross compiler for 'TARGET'. Currently supported:"
|
@echo " build one specific cross compiler for 'TARGET'. Currently supported:"
|
||||||
@echo " $(wordlist 1,6,$(TCC_X))"
|
@echo " $(wordlist 1,8,$(TCC_X))"
|
||||||
@echo " $(wordlist 7,99,$(TCC_X))"
|
@echo " $(wordlist 9,99,$(TCC_X))"
|
||||||
@echo ""
|
|
||||||
@echo "make test"
|
@echo "make test"
|
||||||
@echo " run all tests"
|
@echo " run all tests"
|
||||||
@echo ""
|
@echo "make tests2.all / make tests2.37 / make tests2.37+"
|
||||||
@echo "make tests2.all / make tests2.37 / make tests2.37+ / make tests2.37-"
|
@echo " run all/single test(s) from tests2, optionally update .expect"
|
||||||
@echo " run all/single test(s) from tests2, optionally update .expect, display"
|
|
||||||
@echo ""
|
|
||||||
@echo "make testspp.all / make testspp.17"
|
@echo "make testspp.all / make testspp.17"
|
||||||
@echo " run all/single test(s) from tests/pp"
|
@echo " run all/single test(s) from tests/pp"
|
||||||
@echo ""
|
@echo "make tcov-test / tcov-tests2... / tcov-testspp..."
|
||||||
@echo "make testc / testc2.all / testc2.37 / testc2.37+ / testc2.37-"
|
@echo " run tests as above with code coverage. After test(s) see tcc_c$(EXESUF).tcov"
|
||||||
@echo "make testcpp.all / make testcpp.17"
|
|
||||||
@echo " run tests with code coverage. After test(s) see tcc_c.tcov"
|
|
||||||
@echo ""
|
|
||||||
@echo "Other supported make targets:"
|
@echo "Other supported make targets:"
|
||||||
@echo " install install-strip doc clean tags ETAGS tar distclean help"
|
@echo " install install-strip doc clean tags ETAGS tar distclean help"
|
||||||
@echo ""
|
|
||||||
@echo "Custom configuration:"
|
@echo "Custom configuration:"
|
||||||
@echo " The makefile includes a file 'config-extra.mak' if it is present."
|
@echo " The makefile includes a file 'config-extra.mak' if it is present."
|
||||||
@echo " This file may contain some custom configuration. For example:"
|
@echo " This file may contain some custom configuration. For example:"
|
||||||
|
3
TODO
3
TODO
@ -1,7 +1,8 @@
|
|||||||
TODO list:
|
TODO list:
|
||||||
|
|
||||||
Releases:
|
Releases:
|
||||||
- release tcc on a regular basis (which interval? 3 months?)
|
|
||||||
|
- release tcc on a regular basis
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
|
|
||||||
|
48
USES
48
USES
@ -7,6 +7,7 @@ bigz An infinite precision Z & Q library.
|
|||||||
gawk GNU awk.
|
gawk GNU awk.
|
||||||
gmp Library for arbitrary precision arithmetic.
|
gmp Library for arbitrary precision arithmetic.
|
||||||
gnumake GNU makefile.
|
gnumake GNU makefile.
|
||||||
|
gnu mes using tinycc to bootstrap a system
|
||||||
mpfr Multiple-precision floating-point library.
|
mpfr Multiple-precision floating-point library.
|
||||||
mpc Complex floating-point library with exact rounding.
|
mpc Complex floating-point library with exact rounding.
|
||||||
mpv A free, open source, and cross-platform media player.
|
mpv A free, open source, and cross-platform media player.
|
||||||
@ -18,3 +19,50 @@ tcc Tiny CC which compiles itself.
|
|||||||
zlib Lossless data-compression library.
|
zlib Lossless data-compression library.
|
||||||
|
|
||||||
(*) This list is ordered by name.
|
(*) This list is ordered by name.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Forks & Experiments
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
arm-thumb target
|
||||||
|
by Erlend Sveen <erlend.sveen@hotmail.com>
|
||||||
|
https://git.erlendjs.no/erlendjs/tinycc.git
|
||||||
|
|
||||||
|
riscv32 target
|
||||||
|
by Sam Ellicott <sellicott@cedarville.edu>
|
||||||
|
https://github.com/sellicott/tcc-riscv32.git
|
||||||
|
|
||||||
|
Transputer target
|
||||||
|
by David Smith <agentdavo@mac.com>
|
||||||
|
https://github.com/agentdavo/tinycc-transputer
|
||||||
|
|
||||||
|
tcc-65816 - Tiny C Compiler for 65816 CPU (based on V0.9.23) from SNES-SDK
|
||||||
|
https://github.com/nArnoSNES/tcc-65816
|
||||||
|
|
||||||
|
PE-UEFI arm64
|
||||||
|
by Andrei Warkentin <andrey.warkentin@gmail.com>
|
||||||
|
https://github.com/andreiw/tinycc/
|
||||||
|
|
||||||
|
TCCLS - global register allocator (proof of concept)
|
||||||
|
by Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
|
||||||
|
https://bitbucket.org/theStack/tccls_poc.git
|
||||||
|
|
||||||
|
softfloat
|
||||||
|
by Giovanni Mascellani <gio@debian.org>
|
||||||
|
https://gitlab.com/giomasce/tinycc.git
|
||||||
|
|
||||||
|
optimize 386
|
||||||
|
by Jason Hood <jadoxa@yahoo.com.au>
|
||||||
|
|
||||||
|
tcctcl : tcl binding
|
||||||
|
https://code.google.com/archive/p/tcltcc/
|
||||||
|
|
||||||
|
tcc4tcl : tcl binding
|
||||||
|
https://chiselapp.com/user/rkeene/repository/tcc4tcl/index
|
||||||
|
|
||||||
|
lua-tcc : allows a Lua script to compile C code
|
||||||
|
https://github.com/javierguerragiraldez/lua-tcc
|
||||||
|
|
||||||
|
tcclua : semi-high-level bindings for `libtcc`
|
||||||
|
https://github.com/nucular/tcclua/blob/master/tcc.lua
|
||||||
|
421
configure
vendored
421
configure
vendored
@ -47,70 +47,19 @@ gcc_major=0
|
|||||||
gcc_minor=0
|
gcc_minor=0
|
||||||
cc_name="gcc"
|
cc_name="gcc"
|
||||||
ar_set=
|
ar_set=
|
||||||
darwin=
|
cpu=
|
||||||
cpuver=
|
cpuver=
|
||||||
dwarf=
|
dwarf=
|
||||||
|
targetos=
|
||||||
|
build_cross=
|
||||||
|
|
||||||
# use CC from environment when set
|
# use CC/AR from environment when set
|
||||||
test -n "$CC" && cc="$CC"
|
test -n "$CC" && cc="$CC"
|
||||||
|
test -n "$AR" && ar="$AR"
|
||||||
# OS specific
|
|
||||||
cpu=`uname -m`
|
|
||||||
cpu_sys="$cpu"
|
|
||||||
targetos=`uname`
|
|
||||||
if test "$targetos" = "Linux" ; then
|
|
||||||
test "$(uname -o)" = "Android" && targetos=Android
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $targetos in
|
|
||||||
Darwin)
|
|
||||||
darwin=yes
|
|
||||||
dwarf=4
|
|
||||||
confvars="$confvars OSX"
|
|
||||||
cc=`command -v cc`
|
|
||||||
cc=`readlink $cc || echo clang`
|
|
||||||
tcc_usrinclude="`xcrun --show-sdk-path`/usr/include"
|
|
||||||
DLLSUF=".dylib"
|
|
||||||
case $* in *--config-new_macho*) ;; *)
|
|
||||||
# if new_macho was not specified and (known) ver <= 10, use old (=no)
|
|
||||||
osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z
|
|
||||||
osxver=${osxver%%.*} # major version (or empty on sw_vers error)
|
|
||||||
[ "${osxver:-11}" -ge 11 ] || confvars="$confvars new_macho=no"
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
Windows_NT|MINGW*|MSYS*|CYGWIN*)
|
|
||||||
mingw32=yes
|
|
||||||
targetos=WIN32
|
|
||||||
;;
|
|
||||||
DragonFly|OpenBSD|FreeBSD|NetBSD)
|
|
||||||
confvars="$confvars BSD ldl=no"
|
|
||||||
;;
|
|
||||||
Android)
|
|
||||||
confvars="$confvars Android pie new-dtags"
|
|
||||||
if test -n "$TERMUX_VERSION"; then
|
|
||||||
prefix="$PREFIX" # "/data/data/com.termux/files/usr"
|
|
||||||
sysroot="$PREFIX"
|
|
||||||
test "$cpu" = "aarch64" -o "$cpu" = "x86_64" && S="64" || S=""
|
|
||||||
tcc_sysincludepaths="{B}/include:{R}/include/\\\"CONFIG_TRIPLET\\\":{R}/include"
|
|
||||||
tcc_libpaths="{B}:{R}/lib:/system/lib${S}"
|
|
||||||
tcc_crtprefix="{R}/lib"
|
|
||||||
tcc_elfinterp="/system/bin/linker${S}"
|
|
||||||
use_triplet="yes"
|
|
||||||
tcc_switches="-Wl,-rpath=$sysroot/lib,-section-alignment=0x1000"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# find source path
|
# find source path
|
||||||
source_path=${0%configure}
|
source_path=${0%configure}
|
||||||
source_path=${source_path%/}
|
source_path=${source_path%/}
|
||||||
source_path_used="yes"
|
|
||||||
if test -z "$source_path" -o "$source_path" = "." ; then
|
|
||||||
source_path=`pwd`
|
|
||||||
source_path_used="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for opt do
|
for opt do
|
||||||
eval opt=\"$opt\"
|
eval opt=\"$opt\"
|
||||||
@ -137,6 +86,8 @@ for opt do
|
|||||||
;;
|
;;
|
||||||
--sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2-`
|
--sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2-`
|
||||||
;;
|
;;
|
||||||
|
--targetos=*) targetos=`echo $opt | cut -d '=' -f 2-`
|
||||||
|
;;
|
||||||
--source-path=*) source_path=`echo $opt | cut -d '=' -f 2-`
|
--source-path=*) source_path=`echo $opt | cut -d '=' -f 2-`
|
||||||
;;
|
;;
|
||||||
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2-`
|
--cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2-`
|
||||||
@ -192,16 +143,119 @@ for opt do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
cc="${cross_prefix}${cc}"
|
show_help() {
|
||||||
ar="${cross_prefix}${ar}"
|
cat << EOF
|
||||||
|
Usage: configure [options]
|
||||||
|
Options: [defaults in brackets after descriptions]
|
||||||
|
|
||||||
# Checking for CFLAGS
|
Standard options:
|
||||||
test -z "$CFLAGS" && CFLAGS="-Wall -O2"
|
--help print this message
|
||||||
|
--prefix=PREFIX install in PREFIX [$prefix]
|
||||||
|
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||||
|
[same as prefix]
|
||||||
|
--bindir=DIR user executables in DIR [EPREFIX/bin]
|
||||||
|
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
|
||||||
|
--tccdir=DIR installation directory [EPREFIX/lib/tcc]
|
||||||
|
--includedir=DIR C header files in DIR [PREFIX/include]
|
||||||
|
--sharedir=DIR documentation root DIR [PREFIX/share]
|
||||||
|
--docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]
|
||||||
|
--mandir=DIR man documentation in DIR [SHAREDIR/man]
|
||||||
|
--infodir=DIR info documentation in DIR [SHAREDIR/info]
|
||||||
|
|
||||||
# on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely
|
Advanced options (experts only):
|
||||||
if test "$darwin" = "yes" -a "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then
|
--source-path=PATH path of source code [$source_path]
|
||||||
CFLAGS="$CFLAGS -arch $cpu"
|
--sysroot=PREFIX prepend PREFIX to library/include paths [$sysroot]
|
||||||
LDFLAGS="$LDFLAGS -arch $cpu"
|
--cc=CC use C compiler CC [$cc]
|
||||||
|
--ar=AR create archives using AR [$ar]
|
||||||
|
--extra-cflags= specify compiler flags [$CFLAGS]
|
||||||
|
--extra-ldflags= specify linker options [$LDFLAGS]
|
||||||
|
|
||||||
|
--debug include debug info with resulting binaries
|
||||||
|
--disable-static make libtcc.so instead of libtcc.a
|
||||||
|
--enable-static make libtcc.a instead of libtcc.dll (win32)
|
||||||
|
--disable-rpath disable use of -rpath with libtcc.so
|
||||||
|
--with-libgcc use libgcc_s.so.1 instead of libtcc1.a
|
||||||
|
--with-selinux use mmap for executable memory (tcc -run)
|
||||||
|
--enable-cross build cross compilers (see also 'make help')
|
||||||
|
|
||||||
|
--sysincludepaths=... specify system include paths, colon separated
|
||||||
|
--libpaths=... specify system library paths, colon separated
|
||||||
|
--crtprefix=... specify locations of crt?.o, colon separated
|
||||||
|
--elfinterp=... specify elf interpreter
|
||||||
|
--triplet=... specify system library/include directory triplet
|
||||||
|
--tcc-switches=... specify implicit switches passed to tcc
|
||||||
|
|
||||||
|
--config-uClibc,-musl enable system specific configurations
|
||||||
|
--config-mingw32 build on windows using msys, busybox, etc.
|
||||||
|
--config-backtrace=no disable stack backtraces (with -run or -bt)
|
||||||
|
--config-bcheck=no disable bounds checker (-b)
|
||||||
|
--config-predefs=no do not compile tccdefs.h, instead just include
|
||||||
|
--config-new_macho=no|yes Force apple object format (autodetect osx <= 10)
|
||||||
|
--config-codesign Use codesign on apple to sign executables
|
||||||
|
--dwarf=x Use dwarf debug info instead of stabs (x=2..5)
|
||||||
|
|
||||||
|
Cross build options (experimental):
|
||||||
|
--cpu=CPU target CPU [$cpu]
|
||||||
|
--targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos]
|
||||||
|
--cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
default() # set variable unless already set
|
||||||
|
{
|
||||||
|
local v
|
||||||
|
eval v=\"\$$1\"
|
||||||
|
test -z "$v" && eval $1=\"$2\"
|
||||||
|
}
|
||||||
|
|
||||||
|
default_conf() # add to confvars unless already present
|
||||||
|
{
|
||||||
|
local v=${1%=*}
|
||||||
|
test "${confvars%$v*}" = "${confvars}" && confvars="$confvars $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if test -z "$source_path" -o "$source_path" = "." ; then
|
||||||
|
source_path=$(pwd)
|
||||||
|
source_path_used="no"
|
||||||
|
else
|
||||||
|
source_path_used="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific
|
||||||
|
buildos=$(uname)
|
||||||
|
|
||||||
|
case $buildos in
|
||||||
|
Windows_NT|MINGW*|MSYS*|CYGWIN*)
|
||||||
|
buildos="WIN32"
|
||||||
|
;;
|
||||||
|
Linux)
|
||||||
|
if test "$(uname -o)" = "Android"; then
|
||||||
|
buildos=Android
|
||||||
|
if test -n "$TERMUX_VERSION"; then
|
||||||
|
buildos=Termux
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test "$mingw32" = "yes"; then
|
||||||
|
default targetos WIN32
|
||||||
|
else
|
||||||
|
default targetos "$buildos"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cpu_sys=$(uname -m)
|
||||||
|
default cpu "$cpu_sys"
|
||||||
|
cpu_set="$cpu"
|
||||||
|
|
||||||
|
# check for crpss build
|
||||||
|
if test "$cpu_set" != "$cpu_sys" \
|
||||||
|
-o "$targetos" != "$buildos" \
|
||||||
|
-o -n "$cross_prefix" ; then
|
||||||
|
build_cross="yes"
|
||||||
|
cc="${cross_prefix}${cc}"
|
||||||
|
ar="${cross_prefix}${ar}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$cpu" in
|
case "$cpu" in
|
||||||
@ -262,109 +316,101 @@ case "$cpu" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "$mingw32" = "yes" ; then
|
case $targetos in
|
||||||
if test "$source_path_used" = "no"; then
|
Darwin)
|
||||||
source_path="."
|
dwarf=4
|
||||||
|
confvars="$confvars OSX"
|
||||||
|
DLLSUF=".dylib"
|
||||||
|
if test -z "$build_cross"; then
|
||||||
|
cc=`command -v cc`
|
||||||
|
cc=`readlink $cc || echo clang`
|
||||||
|
tcc_usrinclude="`xcrun --show-sdk-path`/usr/include"
|
||||||
|
if test "${confvars%new_macho*}" = "${confvars}"; then
|
||||||
|
# if new_macho was not specified and (known) ver <= 10, use old (=no)
|
||||||
|
osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z
|
||||||
|
osxver=${osxver%%.*} # major version (or empty on sw_vers error)
|
||||||
|
[ "${osxver:-11}" -ge 11 ] || confvars="$confvars new_macho=no"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
test -z "$prefix" && prefix="C:/Program Files/tcc"
|
# on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely
|
||||||
test -z "$tccdir" && tccdir="${prefix}" && tccdir_auto="yes"
|
if test "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then
|
||||||
test -z "$bindir" && bindir="${tccdir}"
|
CFLAGS="$CFLAGS -arch $cpu"
|
||||||
test -z "$docdir" && docdir="${tccdir}/doc"
|
LDFLAGS="$LDFLAGS -arch $cpu"
|
||||||
test -z "$libdir" && libdir="${tccdir}/libtcc"
|
fi
|
||||||
|
;;
|
||||||
|
DragonFly|OpenBSD|FreeBSD|NetBSD)
|
||||||
|
confvars="$confvars BSD ldl=no"
|
||||||
|
;;
|
||||||
|
Android|Termux)
|
||||||
|
if test "$targetos" = "Termux"; then
|
||||||
|
targetos=Android
|
||||||
|
default sysroot "/data/data/com.termux/files/usr"
|
||||||
|
else
|
||||||
|
default sysroot "/usr"
|
||||||
|
fi
|
||||||
|
default prefix "${sysroot}"
|
||||||
|
confvars="$confvars Android new-dtags rpath=no"
|
||||||
|
test "${cpu}" != "i386" && confvars="$confvars pie"
|
||||||
|
default_conf "static=no"
|
||||||
|
if test "${cpu}" = "arm"; then
|
||||||
|
default triplet "arm-linux-androideabi"
|
||||||
|
cpuver=7
|
||||||
|
else
|
||||||
|
default triplet "${cpu_set}-linux-android"
|
||||||
|
fi
|
||||||
|
test "${cpu%64}" != "${cpu}" && S="64" || S=""
|
||||||
|
default tcc_sysincludepaths "{B}/include:{R}/include:{R}/include/${triplet}"
|
||||||
|
default tcc_libpaths "{B}:{R}/lib:/system/lib${S}"
|
||||||
|
default tcc_crtprefix "{R}/lib"
|
||||||
|
default tcc_elfinterp "/system/bin/linker${S}"
|
||||||
|
default tcc_switches "-Wl,-rpath=$sysroot/lib,-section-alignment=0x1000"
|
||||||
|
;;
|
||||||
|
WIN32)
|
||||||
|
mingw32="yes"
|
||||||
confvars="$confvars WIN32"
|
confvars="$confvars WIN32"
|
||||||
|
default prefix "C:/Program Files/tcc"
|
||||||
|
default tccdir "${prefix}"
|
||||||
|
default bindir "${tccdir}"
|
||||||
|
default docdir "${tccdir}/doc"
|
||||||
|
default libdir "${tccdir}/libtcc"
|
||||||
|
test "$tccdir" = "$bindir" && tccdir_auto="yes"
|
||||||
LIBSUF=".lib"
|
LIBSUF=".lib"
|
||||||
EXESUF=".exe"
|
EXESUF=".exe"
|
||||||
DLLSUF=".dll"
|
DLLSUF=".dll"
|
||||||
else
|
if test "$source_path_used" = "no"; then
|
||||||
if test -z "$prefix" ; then
|
source_path="."
|
||||||
prefix="/usr/local"
|
|
||||||
fi
|
fi
|
||||||
if test -z "$sharedir" ; then
|
;;
|
||||||
sharedir="${prefix}/share"
|
*)
|
||||||
fi
|
;;
|
||||||
if test x"$execprefix" = x""; then
|
esac
|
||||||
execprefix="${prefix}"
|
|
||||||
fi
|
|
||||||
if test x"$libdir" = x""; then
|
|
||||||
libdir="${execprefix}/lib"
|
|
||||||
fi
|
|
||||||
if test x"$bindir" = x""; then
|
|
||||||
bindir="${execprefix}/bin"
|
|
||||||
fi
|
|
||||||
if test x"$docdir" = x""; then
|
|
||||||
docdir="${sharedir}/doc"
|
|
||||||
fi
|
|
||||||
if test x"$mandir" = x""; then
|
|
||||||
mandir="${sharedir}/man"
|
|
||||||
fi
|
|
||||||
if test x"$infodir" = x""; then
|
|
||||||
infodir="${sharedir}/info"
|
|
||||||
fi
|
|
||||||
if test x"$tccdir" = x""; then
|
|
||||||
tccdir="${libdir}/tcc"
|
|
||||||
fi
|
|
||||||
if test x"$includedir" = x""; then
|
|
||||||
includedir="${prefix}/include"
|
|
||||||
fi
|
|
||||||
fi # mingw32
|
|
||||||
|
|
||||||
if test x"$show_help" = "xyes" ; then
|
if test "$mingw32" = "no"; then
|
||||||
cat << EOF
|
default prefix "/usr/local"
|
||||||
Usage: configure [options]
|
default execprefix "${prefix}"
|
||||||
Options: [defaults in brackets after descriptions]
|
default libdir "${execprefix}/lib"
|
||||||
|
default bindir "${execprefix}/bin"
|
||||||
Standard options:
|
default tccdir "${libdir}/tcc"
|
||||||
--help print this message
|
default includedir "${prefix}/include"
|
||||||
--prefix=PREFIX install in PREFIX [$prefix]
|
default sharedir "${prefix}/share"
|
||||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
default docdir "${sharedir}/doc"
|
||||||
[same as prefix]
|
default mandir "${sharedir}/man"
|
||||||
--bindir=DIR user executables in DIR [EPREFIX/bin]
|
default infodir "${sharedir}/info"
|
||||||
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
|
|
||||||
--tccdir=DIR installation directory [EPREFIX/lib/tcc]
|
|
||||||
--includedir=DIR C header files in DIR [PREFIX/include]
|
|
||||||
--sharedir=DIR documentation root DIR [PREFIX/share]
|
|
||||||
--docdir=DIR documentation in DIR [SHAREDIR/doc/tcc]
|
|
||||||
--mandir=DIR man documentation in DIR [SHAREDIR/man]
|
|
||||||
--infodir=DIR info documentation in DIR [SHAREDIR/info]
|
|
||||||
|
|
||||||
Advanced options (experts only):
|
|
||||||
--source-path=PATH path of source code [$source_path]
|
|
||||||
--cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
|
|
||||||
--sysroot=PREFIX prepend PREFIX to library/include paths [$sysroot]
|
|
||||||
--cc=CC use C compiler CC [$cc]
|
|
||||||
--ar=AR create archives using AR [$ar]
|
|
||||||
--extra-cflags= specify compiler flags [$CFLAGS]
|
|
||||||
--extra-ldflags= specify linker options [$LDFLAGS]
|
|
||||||
--cpu=CPU CPU [$cpu]
|
|
||||||
|
|
||||||
--debug include debug info with resulting binaries
|
|
||||||
--disable-static make libtcc.so instead of libtcc.a
|
|
||||||
--enable-static make libtcc.a instead of libtcc.dll (win32)
|
|
||||||
--disable-rpath disable use of -rpath with libtcc.so
|
|
||||||
--with-libgcc use libgcc_s.so.1 instead of libtcc1.a
|
|
||||||
--with-selinux use mmap for executable memory (tcc -run)
|
|
||||||
--enable-cross build cross compilers (see also 'make help')
|
|
||||||
|
|
||||||
--sysincludepaths=... specify system include paths, colon separated
|
|
||||||
--libpaths=... specify system library paths, colon separated
|
|
||||||
--crtprefix=... specify locations of crt?.o, colon separated
|
|
||||||
--elfinterp=... specify elf interpreter
|
|
||||||
--triplet=... specify system library/include directory triplet
|
|
||||||
--tcc-switches=... specify implicit switches passed to tcc
|
|
||||||
|
|
||||||
--config-uClibc,-musl enable system specific configurations
|
|
||||||
--config-mingw32 build on windows using msys, busybox, etc.
|
|
||||||
--config-backtrace=no disable stack backtraces (with -run or -bt)
|
|
||||||
--config-bcheck=no disable bounds checker (-b)
|
|
||||||
--config-predefs=no do not compile tccdefs.h, instead just include
|
|
||||||
--config-new_macho=no|yes Force apple object format (autodetect osx <= 10)
|
|
||||||
--config-codesign Use codesign on apple to sign executables
|
|
||||||
--dwarf=x Use dwarf debug info instead of stabs (x=2..5)
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$cross_prefix" ; then
|
# set default CFLAGS
|
||||||
|
default CFLAGS "-Wall -O2"
|
||||||
|
|
||||||
|
if test "$mingw32" = "yes" -a "$cc_name" = "gcc"; then
|
||||||
|
# avoid mingw dependencies such as 'libgcc_s_dw2-1.dll'
|
||||||
|
default LDFLAGS "-static"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$show_help" = "xyes" ; then
|
||||||
|
show_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$build_cross"; then
|
||||||
CONFTEST=./conftest$EXESUF
|
CONFTEST=./conftest$EXESUF
|
||||||
if ! $cc -o $CONFTEST $source_path/conftest.c ; then
|
if ! $cc -o $CONFTEST $source_path/conftest.c ; then
|
||||||
echo "configure: error: '$cc' failed to compile conftest.c."
|
echo "configure: error: '$cc' failed to compile conftest.c."
|
||||||
@ -376,13 +422,11 @@ if test -z "$cross_prefix" ; then
|
|||||||
_triplet="$($CONFTEST triplet)"
|
_triplet="$($CONFTEST triplet)"
|
||||||
fi
|
fi
|
||||||
if test "$mingw32" = "no" ; then
|
if test "$mingw32" = "no" ; then
|
||||||
|
|
||||||
if test -z "$triplet" -a -n "$_triplet"; then
|
if test -z "$triplet" -a -n "$_triplet"; then
|
||||||
if test -f "/usr/lib/$_triplet/crti.o" -o -n "$use_triplet" ; then
|
if test -f "/usr/lib/$_triplet/crti.o"; then
|
||||||
triplet="$_triplet"
|
triplet="$_triplet"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$triplet"; then
|
if test -z "$triplet"; then
|
||||||
if test $cpu = "x86_64" -o $cpu = "arm64" -o $cpu = "riscv64" ; then
|
if test $cpu = "x86_64" -o $cpu = "arm64" -o $cpu = "riscv64" ; then
|
||||||
if test -f "/usr/lib64/crti.o" ; then
|
if test -f "/usr/lib64/crti.o" ; then
|
||||||
@ -390,21 +434,6 @@ if test -z "$cross_prefix" ; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$cpu" = "arm" ; then
|
|
||||||
if test "${triplet%eabihf}" != "$triplet" ; then
|
|
||||||
confvars="$confvars arm_eabihf arm_vfp"
|
|
||||||
elif test "${triplet%eabi}" != "$triplet" ; then
|
|
||||||
confvars="$confvars arm_eabi arm_vfp"
|
|
||||||
elif test "${_triplet%eabihf}" != "$_triplet" ; then
|
|
||||||
confvars="$confvars arm_eabihf arm_vfp"
|
|
||||||
elif test "${_triplet%eabi}" != "$_triplet" ; then
|
|
||||||
confvars="$confvars arm_eabi arm_vfp"
|
|
||||||
elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
|
|
||||||
confvars="$confvars arm_vfp"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$suggest" = "yes"; then
|
if test "$suggest" = "yes"; then
|
||||||
if test -f "/lib/ld-uClibc.so.0" ; then
|
if test -f "/lib/ld-uClibc.so.0" ; then
|
||||||
echo "Perhaps you want ./configure --config-uClibc"
|
echo "Perhaps you want ./configure --config-uClibc"
|
||||||
@ -413,23 +442,43 @@ if test -z "$cross_prefix" ; then
|
|||||||
echo "Perhaps you want ./configure --config-musl"
|
echo "Perhaps you want ./configure --config-musl"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else # mingw32 = yes
|
|
||||||
if test "$cc_name" = "gcc"; then
|
|
||||||
# avoid mingw dependencies such as 'libgcc_s_dw2-1.dll'
|
|
||||||
test -z "$LDFLAGS" && LDFLAGS="-static"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# if cross compiling, cannot launch a program, so make a static guess
|
# can only make guesses about compiler and target
|
||||||
|
if test "${cc%tcc*}" != "$cc"; then
|
||||||
|
cc_name="tcc"
|
||||||
|
elif test "${cc%clang*}" != "$cc"; then
|
||||||
|
cc_name="clang"
|
||||||
|
fi
|
||||||
case $cpu in
|
case $cpu in
|
||||||
ppc|mips|s390) bigendian=yes;;
|
ppc|mips|s390) bigendian=yes;;
|
||||||
esac
|
esac
|
||||||
|
case $targetos in
|
||||||
|
Linux)
|
||||||
|
default triplet "$cpu_set-linux-gnu"
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$bigendian" = "yes" ; then
|
if test "$bigendian" = "yes" ; then
|
||||||
confvars="$confvars BIGENDIAN"
|
confvars="$confvars BIGENDIAN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$cpu" = "arm"; then
|
||||||
|
if test "${triplet%eabihf}" != "$triplet" ; then
|
||||||
|
confvars="$confvars arm_eabihf arm_vfp"
|
||||||
|
elif test "${triplet%eabi}" != "$triplet" ; then
|
||||||
|
confvars="$confvars arm_eabi arm_vfp"
|
||||||
|
elif test -z "$build_cross"; then
|
||||||
|
if test "${_triplet%eabihf}" != "$_triplet" ; then
|
||||||
|
confvars="$confvars arm_eabihf arm_vfp"
|
||||||
|
elif test "${_triplet%eabi}" != "$_triplet" ; then
|
||||||
|
confvars="$confvars arm_eabi arm_vfp"
|
||||||
|
elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then
|
||||||
|
confvars="$confvars arm_vfp"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# a final configuration tuning
|
# a final configuration tuning
|
||||||
if test "$cc_name" != "tcc"; then
|
if test "$cc_name" != "tcc"; then
|
||||||
OPT1="-Wdeclaration-after-statement -fno-strict-aliasing"
|
OPT1="-Wdeclaration-after-statement -fno-strict-aliasing"
|
||||||
@ -438,7 +487,7 @@ if test "$cc_name" != "tcc"; then
|
|||||||
OPT2="$OPT2 -Wstringop-truncation"
|
OPT2="$OPT2 -Wstringop-truncation"
|
||||||
if test "$cc_name" = "clang"; then
|
if test "$cc_name" = "clang"; then
|
||||||
OPT1="$OPT1 -fheinous-gnu-extensions"
|
OPT1="$OPT1 -fheinous-gnu-extensions"
|
||||||
OPT2="$OPT2 -Wstring-plus-int"
|
OPT2="$OPT2 -Wstring-plus-int -Wdeprecated-declarations"
|
||||||
fi
|
fi
|
||||||
$cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1
|
$cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1
|
||||||
for o in $OPT1; do # enable these options
|
for o in $OPT1; do # enable these options
|
||||||
@ -470,6 +519,11 @@ echo "C compiler $cc ($gcc_major.$gcc_minor)"
|
|||||||
echo "Target OS $targetos"
|
echo "Target OS $targetos"
|
||||||
echo "CPU $cpu"
|
echo "CPU $cpu"
|
||||||
fcho "Triplet " "$triplet"
|
fcho "Triplet " "$triplet"
|
||||||
|
fcho "Libs " "$tcc_libpaths"
|
||||||
|
fcho "Sysinclude " "$tcc_sysincludepaths"
|
||||||
|
fcho "Crt " "$tcc_crtprefix"
|
||||||
|
fcho "Elfinterp " "$tcc_elfinterp"
|
||||||
|
fcho "Switches " "$tcc_switches"
|
||||||
fcho "Config " "${confvars# }"
|
fcho "Config " "${confvars# }"
|
||||||
echo "Creating config.mak and config.h"
|
echo "Creating config.mak and config.h"
|
||||||
|
|
||||||
@ -530,6 +584,7 @@ print_mak TCC_CPU_VERSION "$cpuver" num
|
|||||||
|
|
||||||
echo "ARCH=$cpu" >> config.mak
|
echo "ARCH=$cpu" >> config.mak
|
||||||
echo "TARGETOS=$targetos" >> config.mak
|
echo "TARGETOS=$targetos" >> config.mak
|
||||||
|
echo "BUILDOS=$buildos" >> config.mak
|
||||||
|
|
||||||
predefs="1"
|
predefs="1"
|
||||||
for v in $confvars ; do
|
for v in $confvars ; do
|
||||||
|
14
conftest.c
14
conftest.c
@ -1,8 +1,8 @@
|
|||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
#if C2STR
|
|
||||||
|
|
||||||
/* with -D C2STR: convert tccdefs.h to C-strings */
|
/* with -D C2STR: convert tccdefs.h to C-strings */
|
||||||
|
|
||||||
|
#if C2STR
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -166,14 +166,16 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
#elif 1
|
|
||||||
|
|
||||||
/* get some information from the host compiler for configure */
|
/* get some information from the host compiler for configure */
|
||||||
|
|
||||||
|
#elif 1
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
int _CRT_glob = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define architecture */
|
/* Define architecture */
|
||||||
@ -233,10 +235,6 @@ int main(int argc, char **argv)
|
|||||||
# define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
|
# define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
int _CRT_glob = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
11
tcc-doc.texi
11
tcc-doc.texi
@ -364,10 +364,11 @@ bounds (@pxref{Bounds}). @option{-g} is implied.
|
|||||||
|
|
||||||
@item -bt[N]
|
@item -bt[N]
|
||||||
Display N callers in stack traces. This is useful with @option{-g} or @option{-b}.
|
Display N callers in stack traces. This is useful with @option{-g} or @option{-b}.
|
||||||
With executables, additional support for stack traces is included.
|
When activated, @code{__TCC_BACKTRACE__} is defined.
|
||||||
|
|
||||||
A function @code{ int tcc_backtrace(const char *fmt, ...); } is provided
|
With executables, additional support for stack traces is included. A function
|
||||||
to trigger a stack trace with a message on demand.
|
@code{ int tcc_backtrace(const char *fmt, ...); }
|
||||||
|
is provided to trigger a stack trace with a message on demand.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@ -937,7 +938,7 @@ Here are some examples of caught errors:
|
|||||||
@end example
|
@end example
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
TCC defines @code{__BOUNDS_CHECKING_ON} if activated.
|
TCC defines @code{__TCC_BCHECK__} if activated.
|
||||||
|
|
||||||
There are five environment variables that can be used to control the behavior:
|
There are five environment variables that can be used to control the behavior:
|
||||||
@itemize
|
@itemize
|
||||||
@ -984,7 +985,7 @@ for bounds checking errors.
|
|||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@example
|
@example
|
||||||
#if defined(__TINYC__) && __BOUNDS_CHECKING_ON
|
#ifdef __TCC_BCHECK__
|
||||||
extern void __bounds_checking (int x);
|
extern void __bounds_checking (int x);
|
||||||
# define BOUNDS_CHECKING_OFF __bounds_checking(1)
|
# define BOUNDS_CHECKING_OFF __bounds_checking(1)
|
||||||
# define BOUNDS_CHECKING_ON __bounds_checking(-1)
|
# define BOUNDS_CHECKING_ON __bounds_checking(-1)
|
||||||
|
@ -10,7 +10,7 @@ VPATH = $(SRC)
|
|||||||
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
|
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
|
||||||
TESTS = $(call files,c) $(call files,S)
|
TESTS = $(call files,c) $(call files,S)
|
||||||
|
|
||||||
all test testspp.all testcpp.all: $(sort $(TESTS))
|
all test testspp.all: $(sort $(TESTS))
|
||||||
|
|
||||||
DIFF_OPTS = -Nu -b
|
DIFF_OPTS = -Nu -b
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ FILTER = 2>&1 | sed 's,$(SRC)/,,g'
|
|||||||
diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
|
diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
|
||||||
&& rm -f $*.output
|
&& rm -f $*.output
|
||||||
|
|
||||||
testspp.% testcpp.%: %.test ;
|
testspp.%: %.test ;
|
||||||
|
|
||||||
# automatically generate .expect files with gcc:
|
# automatically generate .expect files with gcc:
|
||||||
%.expect: # %.c
|
%.expect: # %.c
|
||||||
|
@ -124,7 +124,7 @@ endif
|
|||||||
# Filter source directory in warnings/errors (out-of-tree builds)
|
# Filter source directory in warnings/errors (out-of-tree builds)
|
||||||
FILTER = 2>&1 | sed -e 's,$(SRC)/,,g'
|
FILTER = 2>&1 | sed -e 's,$(SRC)/,,g'
|
||||||
|
|
||||||
all test tests2.all testc2.all: $(filter-out $(SKIP),$(TESTS))
|
all test tests2.all: $(filter-out $(SKIP),$(TESTS))
|
||||||
@$(MAKE) clean --no-print-directory -s
|
@$(MAKE) clean --no-print-directory -s
|
||||||
|
|
||||||
%.test: %.c %.expect
|
%.test: %.c %.expect
|
||||||
@ -138,15 +138,15 @@ T3 = $(FILTER) >$*.output 2>&1 || true \
|
|||||||
&& rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
|
&& rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
|
||||||
|
|
||||||
# run single test and update .expect file, e.g. "make tests2.37+"
|
# run single test and update .expect file, e.g. "make tests2.37+"
|
||||||
tests2.%+ testc2.%+:
|
tests2.%+:
|
||||||
@$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory
|
@$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory
|
||||||
|
|
||||||
# just run tcc to see the output, e.g. "make tests2.37-"
|
# just run tcc to see the output, e.g. "make tests2.37-"
|
||||||
tests2.%- testc2.%-:
|
tests2.%-:
|
||||||
@$(MAKE) $(call F1,$*) T3= --no-print-directory
|
@$(MAKE) $(call F1,$*) T3= --no-print-directory
|
||||||
|
|
||||||
# run single test, e.g. "make tests2.37"
|
# run single test, e.g. "make tests2.37"
|
||||||
tests2.% testc2.%:
|
tests2.%:
|
||||||
@$(MAKE) $(call F1,$*) --no-print-directory
|
@$(MAKE) $(call F1,$*) --no-print-directory
|
||||||
|
|
||||||
F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test)
|
F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test)
|
||||||
|
@ -7,7 +7,8 @@ setlocal
|
|||||||
if (%1)==(-clean) goto :cleanup
|
if (%1)==(-clean) goto :cleanup
|
||||||
set CC=gcc
|
set CC=gcc
|
||||||
set /p VERSION= < ..\VERSION
|
set /p VERSION= < ..\VERSION
|
||||||
set INST=
|
set TCCDIR=
|
||||||
|
set BINDIR=
|
||||||
set DOC=no
|
set DOC=no
|
||||||
set EXES_ONLY=no
|
set EXES_ONLY=no
|
||||||
goto :a0
|
goto :a0
|
||||||
@ -23,7 +24,8 @@ goto :a2
|
|||||||
:a1
|
:a1
|
||||||
if (%1)==(-t) set T=%2&& goto :a2
|
if (%1)==(-t) set T=%2&& goto :a2
|
||||||
if (%1)==(-v) set VERSION=%~2&& goto :a2
|
if (%1)==(-v) set VERSION=%~2&& goto :a2
|
||||||
if (%1)==(-i) set INST=%2&& goto :a2
|
if (%1)==(-i) set TCCDIR=%2&& goto :a2
|
||||||
|
if (%1)==(-b) set BINDIR=%2&& goto :a2
|
||||||
if (%1)==(-d) set DOC=yes&& goto :a3
|
if (%1)==(-d) set DOC=yes&& goto :a3
|
||||||
if (%1)==(-x) set EXES_ONLY=yes&& goto :a3
|
if (%1)==(-x) set EXES_ONLY=yes&& goto :a3
|
||||||
if (%1)==() goto :p1
|
if (%1)==() goto :p1
|
||||||
@ -35,6 +37,7 @@ echo -c "prog options" use prog with options to compile tcc
|
|||||||
echo -t 32/64 force 32/64 bit default target
|
echo -t 32/64 force 32/64 bit default target
|
||||||
echo -v "version" set tcc version
|
echo -v "version" set tcc version
|
||||||
echo -i tccdir install tcc into tccdir
|
echo -i tccdir install tcc into tccdir
|
||||||
|
echo -b bindir but install tcc.exe and libtcc.dll into bindir
|
||||||
echo -d create tcc-doc.html too (needs makeinfo)
|
echo -d create tcc-doc.html too (needs makeinfo)
|
||||||
echo -x just create the executables
|
echo -x just create the executables
|
||||||
echo -clean delete all previously produced files and directories
|
echo -clean delete all previously produced files and directories
|
||||||
@ -87,18 +90,24 @@ if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
|
|||||||
if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
|
if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
|
||||||
:p2
|
:p2
|
||||||
if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static
|
if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static
|
||||||
|
if (%BINDIR%)==() set BINDIR=%TCCDIR%
|
||||||
|
|
||||||
set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
|
set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
|
||||||
set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
|
set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
|
||||||
set P32=i386-win32
|
set P32=i386-win32
|
||||||
set P64=x86_64-win32
|
set P64=x86_64-win32
|
||||||
|
|
||||||
if %T%==64 goto :t64
|
if %T%==64 goto :t64
|
||||||
set D=%D32%
|
set D=%D32%
|
||||||
|
set P=%P32%
|
||||||
set DX=%D64%
|
set DX=%D64%
|
||||||
set PX=%P64%
|
set PX=%P64%
|
||||||
set TX=64
|
set TX=64
|
||||||
goto :p3
|
goto :p3
|
||||||
|
|
||||||
:t64
|
:t64
|
||||||
set D=%D64%
|
set D=%D64%
|
||||||
|
set P=%P64%
|
||||||
set DX=%D32%
|
set DX=%D32%
|
||||||
set PX=%P32%
|
set PX=%P32%
|
||||||
set TX=32
|
set TX=32
|
||||||
@ -111,17 +120,16 @@ for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b
|
|||||||
for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b
|
for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b
|
||||||
git.exe diff --quiet
|
git.exe diff --quiet
|
||||||
if %ERRORLEVEL%==1 set GITHASH=%GITHASH%*
|
if %ERRORLEVEL%==1 set GITHASH=%GITHASH%*
|
||||||
set DEF_GITHASH=-DTCC_GITHASH="""%GITHASH%"""
|
|
||||||
:git_done
|
:git_done
|
||||||
|
|
||||||
@echo on
|
@echo on
|
||||||
|
|
||||||
:config.h
|
:config.h
|
||||||
echo>..\config.h #define TCC_VERSION "%VERSION%"
|
echo>..\config.h #define TCC_VERSION "%VERSION%"
|
||||||
echo>> ..\config.h #ifdef TCC_TARGET_X86_64
|
if not (%GITHASH%)==() echo>> ..\config.h #define TCC_GITHASH "%GITHASH%"
|
||||||
echo>> ..\config.h #define TCC_LIBTCC1 "libtcc1-64.a"
|
@if not (%BINDIR%)==(%TCCDIR%) echo>> ..\config.h #define CONFIG_TCCDIR "%TCCDIR:\=/%"
|
||||||
echo>> ..\config.h #else
|
if %TX%==64 echo>> ..\config.h #ifdef TCC_TARGET_X86_64
|
||||||
echo>> ..\config.h #define TCC_LIBTCC1 "libtcc1-32.a"
|
if %TX%==32 echo>> ..\config.h #ifdef TCC_TARGET_I386
|
||||||
|
echo>> ..\config.h #define CONFIG_TCC_CROSSPREFIX "%PX%-"
|
||||||
echo>> ..\config.h #endif
|
echo>> ..\config.h #endif
|
||||||
|
|
||||||
for %%f in (*tcc.exe *tcc.dll) do @del %%f
|
for %%f in (*tcc.exe *tcc.dll) do @del %%f
|
||||||
@ -135,7 +143,7 @@ for %%f in (*tcc.exe *tcc.dll) do @del %%f
|
|||||||
@if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c
|
@if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c
|
||||||
%CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL
|
%CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL
|
||||||
@if errorlevel 1 goto :the_end
|
@if errorlevel 1 goto :the_end
|
||||||
%CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0" %DEF_GITHASH%
|
%CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0"
|
||||||
%CC% -o %PX%-tcc.exe ..\tcc.c %DX%
|
%CC% -o %PX%-tcc.exe ..\tcc.c %DX%
|
||||||
:compiler_done
|
:compiler_done
|
||||||
@if (%EXES_ONLY%)==(yes) goto :files_done
|
@if (%EXES_ONLY%)==(yes) goto :files_done
|
||||||
@ -151,15 +159,9 @@ copy>nul tcc-win32.txt doc
|
|||||||
if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def
|
if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def
|
||||||
@if errorlevel 1 goto :the_end
|
@if errorlevel 1 goto :the_end
|
||||||
|
|
||||||
:libtcc1.a
|
:lib
|
||||||
call :makelib %T%
|
call :make_lib %T% || goto :the_end
|
||||||
@if errorlevel 1 goto :the_end
|
@if exist %PX%-tcc.exe call :make_lib %TX% %PX%- || goto :the_end
|
||||||
@if exist %PX%-tcc.exe call :makelib %TX%
|
|
||||||
@if errorlevel 1 goto :the_end
|
|
||||||
.\tcc -m%T% -c ../lib/bcheck.c -o lib/bcheck.o -bt
|
|
||||||
.\tcc -m%T% -c ../lib/bt-exe.c -o lib/bt-exe.o
|
|
||||||
.\tcc -m%T% -c ../lib/bt-log.c -o lib/bt-log.o
|
|
||||||
.\tcc -m%T% -c ../lib/bt-dll.c -o lib/bt-dll.o
|
|
||||||
|
|
||||||
:tcc-doc.html
|
:tcc-doc.html
|
||||||
@if not (%DOC%)==(yes) goto :doc-done
|
@if not (%DOC%)==(yes) goto :doc-done
|
||||||
@ -171,27 +173,32 @@ cmd /c makeinfo --html --no-split ../tcc-doc.texi -o doc/tcc-doc.html
|
|||||||
for %%f in (*.o *.def) do @del %%f
|
for %%f in (*.o *.def) do @del %%f
|
||||||
|
|
||||||
:copy-install
|
:copy-install
|
||||||
@if (%INST%)==() goto :the_end
|
@if (%TCCDIR%)==() goto :the_end
|
||||||
if not exist %INST% mkdir %INST%
|
if not exist %BINDIR% mkdir %BINDIR%
|
||||||
for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %INST%\%%f
|
for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %BINDIR%\%%f
|
||||||
@if not exist %INST%\lib mkdir %INST%\lib
|
if not exist %TCCDIR% mkdir %TCCDIR%
|
||||||
for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %INST%\%%f
|
@if not exist %TCCDIR%\lib mkdir %TCCDIR%\lib
|
||||||
for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %INST%\%%f
|
for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %TCCDIR%\%%f
|
||||||
|
for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %TCCDIR%\%%f
|
||||||
|
|
||||||
:the_end
|
:the_end
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
|
||||||
:makelib
|
:make_lib
|
||||||
.\tcc -m%1 -c ../lib/libtcc1.c
|
.\tcc -B. -m%1 -c ../lib/libtcc1.c
|
||||||
.\tcc -m%1 -c lib/crt1.c
|
.\tcc -B. -m%1 -c lib/crt1.c
|
||||||
.\tcc -m%1 -c lib/crt1w.c
|
.\tcc -B. -m%1 -c lib/crt1w.c
|
||||||
.\tcc -m%1 -c lib/wincrt1.c
|
.\tcc -B. -m%1 -c lib/wincrt1.c
|
||||||
.\tcc -m%1 -c lib/wincrt1w.c
|
.\tcc -B. -m%1 -c lib/wincrt1w.c
|
||||||
.\tcc -m%1 -c lib/dllcrt1.c
|
.\tcc -B. -m%1 -c lib/dllcrt1.c
|
||||||
.\tcc -m%1 -c lib/dllmain.c
|
.\tcc -B. -m%1 -c lib/dllmain.c
|
||||||
.\tcc -m%1 -c lib/chkstk.S
|
.\tcc -B. -m%1 -c lib/chkstk.S
|
||||||
.\tcc -m%1 -c ../lib/alloca.S
|
.\tcc -B. -m%1 -c ../lib/alloca.S
|
||||||
.\tcc -m%1 -c ../lib/alloca-bt.S
|
.\tcc -B. -m%1 -c ../lib/alloca-bt.S
|
||||||
.\tcc -m%1 -c ../lib/stdatomic.c
|
.\tcc -B. -m%1 -c ../lib/stdatomic.c
|
||||||
.\tcc -m%1 -ar lib/libtcc1-%1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o
|
.\tcc -B. -m%1 -ar lib/%2libtcc1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o
|
||||||
|
.\tcc -B. -m%1 -c ../lib/bcheck.c -o lib/%2bcheck.o -bt
|
||||||
|
.\tcc -B. -m%1 -c ../lib/bt-exe.c -o lib/%2bt-exe.o
|
||||||
|
.\tcc -B. -m%1 -c ../lib/bt-log.c -o lib/%2bt-log.o
|
||||||
|
.\tcc -B. -m%1 -c ../lib/bt-dll.c -o lib/%2bt-dll.o
|
||||||
exit /B %ERRORLEVEL%
|
exit /B %ERRORLEVEL%
|
||||||
|
Loading…
Reference in New Issue
Block a user