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
Unified · Split
| @@ -1,68 +1,32 @@ | |||
| 1 | name: build and run tests | 1 | name: build and run tests |
| 2 | |||
| 2 | on: | 3 | on: |
| 3 | push: | 4 | push: |
| 4 | branches: [ mob ] | 5 | branches: [ mob ] |
| 5 | pull_request: | 6 | |
| 6 | branches: [ mob ] | ||
| 7 | jobs: | 7 | jobs: |
| 8 | build-release-linux-i686-amd64: | 8 | test-x86_64-linux: |
| 9 | name: tinycc master linux/amd64 | ||
| 10 | runs-on: ubuntu-20.04 | 9 | runs-on: ubuntu-20.04 |
| 11 | steps: | 10 | steps: |
| 12 | - uses: actions/checkout@v2 | 11 | - uses: actions/checkout@v3 |
| 13 | - name: Install dependencies | 12 | - name: make & test tcc |
| 14 | run: sudo apt-get install -y | 13 | run: ./configure && make && make test -k |
| 15 | gcc | ||
| 16 | # see what's available in /usr/bin | ||
| 17 | - name: see what's available | ||
| 18 | run: ls -l /usr/bin | ||
| 19 | # build project amd64 | ||
| 20 | - name: build amd64 | ||
| 21 | run: | | ||
| 22 | ./configure | ||
| 23 | make | ||
| 24 | # run tests | ||
| 25 | - name: run test_exs amd64 | ||
| 26 | run: | | ||
| 27 | make test | ||
| 28 | 14 | ||
| 29 | build-release-osx-amd64: | 15 | test-x86_64-osx: |
| 30 | name: tinycc master osx/amd64 | ||
| 31 | runs-on: macos-11 | 16 | runs-on: macos-11 |
| 32 | steps: | 17 | steps: |
| 33 | - uses: actions/checkout@v2 | 18 | - uses: actions/checkout@v3 |
| 34 | # see what's available in /usr/bin | 19 | - name: make & test tcc |
| 35 | - name: see what's available | 20 | run: ./configure && make && make test -k |
| 36 | run: ls -l /usr/bin | ||
| 37 | # build project amd64 | ||
| 38 | - name: build amd64 | ||
| 39 | run: | | ||
| 40 | ./configure | ||
| 41 | make | ||
| 42 | # run tests | ||
| 43 | - name: run test_exs amd64 | ||
| 44 | run: | | ||
| 45 | make test | ||
| 46 | 21 | ||
| 47 | build-release-windows-amd64-on-windows: | 22 | test-x86_64-win32: |
| 48 | name: tinycc master windows/amd64 on Windows | 23 | runs-on: windows-2019 |
| 49 | runs-on: windows-latest | ||
| 50 | steps: | 24 | steps: |
| 51 | - uses: actions/checkout@v2 | 25 | - uses: actions/checkout@v3 |
| 52 | - uses: msys2/setup-msys2@v2 | 26 | - name: make & test tcc |
| 53 | # build project amd64 | 27 | shell: cmd |
| 54 | - name: build amd64 | ||
| 55 | run: | | ||
| 56 | msys2 -c './configure' | ||
| 57 | make | ||
| 58 | # silency failing tests | ||
| 59 | - name: silence 96_nodata_wanted | ||
| 60 | run: | | ||
| 61 | pushd .\tests\tests2 | ||
| 62 | Get-Content .\96_nodata_wanted.expect -TotalCount 2 | Out-File .\96_nodata_wanted.expect2 -Encoding default | ||
| 63 | mv .\96_nodata_wanted.expect2 .\96_nodata_wanted.expect -force | ||
| 64 | popd | ||
| 65 | # run tests | ||
| 66 | - name: run test_exs amd64 | ||
| 67 | run: | | 28 | run: | |
| 68 | make test | 29 | set MSYS2_PATH_TYPE=inherit |
| 30 | set MSYSTEM=MINGW64 | ||
| 31 | set CHERE_INVOKING=yes | ||
| 32 | C:\msys64\usr\bin\bash -l -c "./configure && make && make test -k" | ||
| @@ -31,9 +31,9 @@ tags · 30 unmodified lines | |||
| 31 | TAGS | 31 | TAGS |
| 32 | tcc.1 | 32 | tcc.1 |
| 33 | *.pod | 33 | *.pod |
| 34 | *.tcov | ||
| 34 | tcc-doc.html | 35 | tcc-doc.html |
| 35 | tcc-doc.info | 36 | tcc-doc.info |
| 36 | tcc_c.tcov | ||
| 37 | 37 | ||
| 38 | win32/doc | 38 | win32/doc |
| 39 | win32/examples/libtcc_test.c | 39 | win32/examples/libtcc_test.c |
| @@ -1,19 +1,26 @@ | |||
| 1 | version 0.9.28: | 1 | version 0.9.28: |
| 2 | 2 | ||
| 3 | User interface: | 3 | User interface: |
| 4 | - new tcc -ar x and t flags (herman ten brugge) | 4 | - -b : bounds checker much improved (herman ten brugge) |
| 5 | - -bt : support for standalone backtraces also (grischka) | ||
| 6 | - -gdwarf : debug format (herman ten brugge) | ||
| 7 | - -M, -MM, and -MMD (Arthur Williams) | ||
| 8 | - -W[no-]error=<option> (Steffen Nurpmeso) | ||
| 5 | 9 | ||
| 6 | Platforms: | 10 | Platforms: |
| 7 | - new RISC-V (riscv64) target | 11 | - new RISC-V (riscv64) target (Michael Matz) |
| 8 | - native macOS support for x86_64/arm64 (Herman ten Brugge) | 12 | - native macOS support for x86_64 (Michael Matz, Herman ten Brugge) |
| 13 | - arm and riscv64 assemblers (Danny Milosavljevic) | ||
| 14 | - Android support with position independent executables (grischka) | ||
| 9 | 15 | ||
| 10 | Features: | 16 | Features: |
| 11 | - Improved support for C11 | 17 | - _Static_assert() (matthias) |
| 12 | - C11 _Static_assert support (matthias) | 18 | - __attribute__ ((cleanup(func))) (matthias) |
| 19 | - stdatomic (Dmitry Selyutin) | ||
| 20 | - asm goto ("jmp %l[label]" : : : : label) (Michael Matz) | ||
| 13 | 21 | ||
| 14 | Fixes: | 22 | Fixes: |
| 15 | - fix preprocessor line (#line) directive (Herman ten Brugge) | 23 | - ... many, see git shortlog release_0_9_27...release_0_9_27 |
| 16 | Many more! see also git shortlog release_0_9_27...HEAD | ||
| 17 | 24 | ||
| 18 | Version 0.9.27: | 25 | Version 0.9.27: |
| 19 | 26 | ||
| @@ -30,13 +30,19 @@ ifdef CONFIG_WIN32 · 29 unmodified lines | |||
| 30 | LIBTCC = libtcc$(DLLSUF) | 30 | LIBTCC = libtcc$(DLLSUF) |
| 31 | LIBTCCDEF = libtcc.def | 31 | LIBTCCDEF = libtcc.def |
| 32 | endif | 32 | endif |
| 33 | ifneq ($(CONFIG_debug),yes) | ||
| 34 | LDFLAGS += -s | ||
| 35 | endif | ||
| 33 | NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32) | 36 | NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32) |
| 34 | else | 37 | else |
| 35 | CFG = -unx | 38 | CFG = -unx |
| 36 | LIBS=-lm -lpthread | 39 | LIBS+=-lm |
| 37 | ifneq ($(CONFIG_ldl),no) | 40 | ifneq ($(CONFIG_ldl),no) |
| 38 | LIBS+=-ldl | 41 | LIBS+=-ldl |
| 39 | endif | 42 | endif |
| 43 | ifneq ($(CONFIG_pthread),no) | ||
| 44 | LIBS+=-lpthread | ||
| 45 | endif | ||
| 40 | # make libtcc as static or dynamic library? | 46 | # make libtcc as static or dynamic library? |
| 41 | ifeq ($(CONFIG_static),no) | 47 | ifeq ($(CONFIG_static),no) |
| 42 | LIBTCC=libtcc$(DLLSUF) | 48 | LIBTCC=libtcc$(DLLSUF) |
| @@ -68,11 +74,8 @@ endif · 25 unmodified lines | |||
| 68 | TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) | 74 | TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) |
| 69 | TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) | 75 | TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) |
| 70 | TCCFLAGS = $(TCCFLAGS$(CFG)) | 76 | TCCFLAGS = $(TCCFLAGS$(CFG)) |
| 71 | ifdef USE_TCC_C | 77 | TCC_LOCAL = $(TOP)/tcc$(EXESUF) |
| 72 | TCC = $(TOP)/tcc_c$(EXESUF) $(TCCFLAGS) | 78 | TCC = $(TCC_LOCAL) $(TCCFLAGS) |
| 73 | else | ||
| 74 | TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS) | ||
| 75 | endif | ||
| 76 | 79 | ||
| 77 | CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE | 80 | CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE |
| 78 | LIBS_P = $(LIBS) | 81 | LIBS_P = $(LIBS) |
| @@ -181,11 +184,8 @@ DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"") · 102 unmodified lines | |||
| 181 | DEFINES += $(DEF-$(or $(findstring win,$T),unx)) | 184 | DEFINES += $(DEF-$(or $(findstring win,$T),unx)) |
| 182 | 185 | ||
| 183 | ifneq ($(X),) | 186 | ifneq ($(X),) |
| 184 | ifeq ($(CONFIG_WIN32),yes) | ||
| 185 | DEF-win += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" | ||
| 186 | DEF-unx += -DCONFIG_TCC_CROSSPREFIX="\"lib/$X\"" | ||
| 187 | else | ||
| 188 | DEF-all += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" | 187 | DEF-all += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" |
| 188 | ifneq ($(CONFIG_WIN32),yes) | ||
| 189 | DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" | 189 | DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" |
| 190 | endif | 190 | endif |
| 191 | endif | 191 | endif |
| @@ -249,17 +249,14 @@ endif · 57 unmodified lines | |||
| 249 | 249 | ||
| 250 | GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no) | 250 | GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no) |
| 251 | ifneq ($(GITHASH),no) | 251 | ifneq ($(GITHASH),no) |
| 252 | GITHASH:=$(shell git log -1 --pretty='format:%cs $(GITHASH)@%h')$(shell git diff --quiet || echo '*') | 252 | GITHASH:=$(shell git log -1 --date=short --pretty='format:%cd $(GITHASH)@%h') |
| 253 | DEF_GITHASH:= -DTCC_GITHASH="\"$(GITHASH)\"" | 253 | GITMODF:=$(shell git diff --quiet || echo '*') |
| 254 | DEF_GITHASH:= -DTCC_GITHASH="\"$(GITHASH)$(GITMODF)\"" | ||
| 254 | endif | 255 | endif |
| 255 | 256 | ||
| 256 | ifeq ($(CONFIG_debug),yes) | 257 | ifeq ($(CONFIG_debug),yes) |
| 257 | CFLAGS += -g | 258 | CFLAGS += -g |
| 258 | LDFLAGS += -g | 259 | LDFLAGS += -g |
| 259 | else | ||
| 260 | ifndef CONFIG_OSX | ||
| 261 | LDFLAGS += -s | ||
| 262 | endif | ||
| 263 | endif | 260 | endif |
| 264 | 261 | ||
| 265 | # convert "include/tccdefs.h" to "tccdefs_.h" | 262 | # convert "include/tccdefs.h" to "tccdefs_.h" |
| @@ -335,7 +332,11 @@ libtcc1.a : tcc$(EXESUF) FORCE · 69 unmodified lines | |||
| 335 | .PRECIOUS: %-libtcc1.a | 332 | .PRECIOUS: %-libtcc1.a |
| 336 | FORCE: | 333 | FORCE: |
| 337 | 334 | ||
| 338 | run-if = $(if $(shell command -v $1),$S $1 $2) | 335 | # WHICH = which $1 2>/dev/null |
| 336 | # some versions of gnu-make do not recognize 'command' as a shell builtin | ||
| 337 | WHICH = sh -c 'command -v $1' | ||
| 338 | |||
| 339 | run-if = $(if $(shell $(call WHICH,$1)),$S $1 $2) | ||
| 339 | S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) | 340 | S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) |
| 340 | 341 | ||
| 341 | # -------------------------------------------------------------------------- | 342 | # -------------------------------------------------------------------------- |
| @@ -348,7 +349,7 @@ tcc-doc.info: tcc-doc.texi · 6 unmodified lines | |||
| 348 | 349 | ||
| 349 | tcc.1 : tcc-doc.pod | 350 | tcc.1 : tcc-doc.pod |
| 350 | $(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \ | 351 | $(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \ |
| 351 | --release="$(VERSION)" $< >$@ && rm -f $<) | 352 | --release="$(VERSION)" $< >$@) |
| 352 | %.pod : %.texi | 353 | %.pod : %.texi |
| 353 | $(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@) | 354 | $(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@) |
| 354 | 355 | ||
| @@ -392,8 +393,9 @@ endif · 37 unmodified lines | |||
| 392 | 393 | ||
| 393 | # uninstall | 394 | # uninstall |
| 394 | uninstall-unx: | 395 | uninstall-unx: |
| 395 | @rm -fv $(foreach P,$(PROGS) $(PROGS_CROSS),"$(bindir)/$P") | 396 | @rm -fv $(addprefix "$(bindir)/",$(PROGS) $(PROGS_CROSS)) |
| 396 | @rm -fv "$(libdir)/libtcc.a" "$(libdir)/libtcc.so" "$(libdir)/libtcc.dylib" "$(includedir)/libtcc.h" | 397 | @rm -fv $(addprefix "$(libdir)/", libtcc*.a libtcc*.so libtcc.dylib,$P) |
| 398 | @rm -fv $(addprefix "$(includedir)/", libtcc.h) | ||
| 397 | @rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info" | 399 | @rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info" |
| 398 | @rm -fv "$(docdir)/tcc-doc.html" | 400 | @rm -fv "$(docdir)/tcc-doc.html" |
| 399 | @rm -frv "$(tccdir)" | 401 | @rm -frv "$(tccdir)" |
| @@ -415,17 +417,19 @@ ifneq "$(wildcard $(LIBTCC1_U))" "" · 15 unmodified lines | |||
| 415 | $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/lib/include") | 417 | $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/lib/include") |
| 416 | endif | 418 | endif |
| 417 | 419 | ||
| 418 | # the msys-git shell works to configure && make except it does not have install | ||
| 419 | ifeq ($(CONFIG_WIN32)-$(shell command -v install || echo no),yes-no) | ||
| 420 | install-win : INSTALL = cp | ||
| 421 | install-win : INSTALLBIN = cp | ||
| 422 | endif | ||
| 423 | |||
| 424 | # uninstall on windows | 420 | # uninstall on windows |
| 425 | uninstall-win: | 421 | uninstall-win: |
| 426 | @rm -fv $(foreach P,libtcc.dll $(PROGS) *-tcc.exe,"$(bindir)"/$P) | 422 | @rm -fv $(addprefix "$(bindir)/", libtcc*.dll $(PROGS) *-tcc.exe) |
| 427 | @rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P"/*) | 423 | @rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P/*") |
| 428 | @rm -frv $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P") | 424 | @rm -frv $(addprefix "$(tccdir)/", doc examples include lib libtcc) |
| 425 | |||
| 426 | # the msys-git shell works to configure && make except it does not have install | ||
| 427 | ifeq ($(OS),Windows_NT) | ||
| 428 | ifeq ($(shell $(call WHICH,install) || echo no),no) | ||
| 429 | INSTALL = cp | ||
| 430 | INSTALLBIN = cp | ||
| 431 | endif | ||
| 432 | endif | ||
| 429 | 433 | ||
| 430 | # -------------------------------------------------------------------------- | 434 | # -------------------------------------------------------------------------- |
| 431 | # other stuff | 435 | # other stuff |
| @@ -459,66 +463,50 @@ test: · 27 unmodified lines | |||
| 459 | # run test(s) from tests2 subdir (see make help) | 463 | # run test(s) from tests2 subdir (see make help) |
| 460 | tests2.%: | 464 | tests2.%: |
| 461 | @$(MAKE) -C tests/tests2 $@ | 465 | @$(MAKE) -C tests/tests2 $@ |
| 462 | 466 | # run test(s) from testspp subdir (see make help) | |
| 463 | testspp.%: | 467 | testspp.%: |
| 464 | @$(MAKE) -C tests/pp $@ | 468 | @$(MAKE) -C tests/pp $@ |
| 465 | 469 | # run tests with code coverage | |
| 466 | # run all tests with code coverage | 470 | tcov-tes% : tcc_c$(EXESUF) |
| 471 | @rm -f $<.tcov | ||
| 472 | @$(MAKE) --no-print-directory TCC_LOCAL=$(CURDIR)/$< tes$* | ||
| 467 | tcc_c$(EXESUF): $($T_FILES) | 473 | tcc_c$(EXESUF): $($T_FILES) |
| 468 | @${TCC} -o $@ -ftest-coverage $< $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS) | 474 | $S$(TCC) tcc.c -o $@ -ftest-coverage $(DEFINES) |
| 469 | testc: tcc_c$(EXESUF) | ||
| 470 | @rm -f tcc_c.tcov | ||
| 471 | @USE_TCC_C=yes $(MAKE) -C tests | ||
| 472 | testc2.%: tcc_c$(EXESUF) | ||
| 473 | @rm -f tcc_c.tcov | ||
| 474 | @USE_TCC_C=yes $(MAKE) -C tests/tests2 $@ | ||
| 475 | testcpp.%: tcc_c$(EXESUF) | ||
| 476 | @rm -f tcc_c.tcov | ||
| 477 | @USE_TCC_C=yes $(MAKE) -C tests/pp $@ | ||
| 478 | 475 | ||
| 479 | clean: | 476 | clean: |
| 480 | @rm -f tcc$(EXESUF) tcc_c$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tags ETAGS *.pod | 477 | @rm -f tcc$(EXESUF) tcc_c$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) |
| 481 | @rm -f *.o *.a *.so* *.out *.log lib*.def *.exe *.dll a.out *.dylib *_.h | 478 | @rm -f tags ETAGS *.o *.a *.so* *.out *.log lib*.def *.exe *.dll |
| 479 | @rm -f a.out *.dylib *_.h *.pod *.tcov | ||
| 482 | @$(MAKE) -s -C lib $@ | 480 | @$(MAKE) -s -C lib $@ |
| 483 | @$(MAKE) -s -C tests $@ | 481 | @$(MAKE) -s -C tests $@ |
| 484 | 482 | ||
| 485 | distclean: clean | 483 | distclean: clean |
| 486 | @rm -f config.h config.mak config.texi | 484 | @rm -vf config.h config.mak config.texi |
| 487 | @rm -f $(TCCDOCS) | 485 | @rm -vf $(TCCDOCS) |
| 488 | 486 | ||
| 489 | .PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE | 487 | .PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE |
| 490 | 488 | ||
| 491 | help: | 489 | help: |
| 492 | @echo "make" | 490 | @echo "make" |
| 493 | @echo " build native compiler (from separate objects)" | 491 | @echo " build native compiler (from separate objects)" |
| 494 | @echo "" | ||
| 495 | @echo "make cross" | 492 | @echo "make cross" |
| 496 | @echo " build cross compilers (from one source)" | 493 | @echo " build cross compilers (from one source)" |
| 497 | @echo "" | ||
| 498 | @echo "make ONE_SOURCE=no/yes SILENT=no/yes" | 494 | @echo "make ONE_SOURCE=no/yes SILENT=no/yes" |
| 499 | @echo " force building from separate/one object(s), less/more silently" | 495 | @echo " force building from separate/one object(s), less/more silently" |
| 500 | @echo "" | ||
| 501 | @echo "make cross-TARGET" | 496 | @echo "make cross-TARGET" |
| 502 | @echo " build one specific cross compiler for 'TARGET'. Currently supported:" | 497 | @echo " build one specific cross compiler for 'TARGET'. Currently supported:" |
| 503 | @echo " $(wordlist 1,6,$(TCC_X))" | 498 | @echo " $(wordlist 1,8,$(TCC_X))" |
| 504 | @echo " $(wordlist 7,99,$(TCC_X))" | 499 | @echo " $(wordlist 9,99,$(TCC_X))" |
| 505 | @echo "" | ||
| 506 | @echo "make test" | 500 | @echo "make test" |
| 507 | @echo " run all tests" | 501 | @echo " run all tests" |
| 508 | @echo "" | 502 | @echo "make tests2.all / make tests2.37 / make tests2.37+" |
| 509 | @echo "make tests2.all / make tests2.37 / make tests2.37+ / make tests2.37-" | 503 | @echo " run all/single test(s) from tests2, optionally update .expect" |
| 510 | @echo " run all/single test(s) from tests2, optionally update .expect, display" | ||
| 511 | @echo "" | ||
| 512 | @echo "make testspp.all / make testspp.17" | 504 | @echo "make testspp.all / make testspp.17" |
| 513 | @echo " run all/single test(s) from tests/pp" | 505 | @echo " run all/single test(s) from tests/pp" |
| 514 | @echo "" | 506 | @echo "make tcov-test / tcov-tests2... / tcov-testspp..." |
| 515 | @echo "make testc / testc2.all / testc2.37 / testc2.37+ / testc2.37-" | 507 | @echo " run tests as above with code coverage. After test(s) see tcc_c$(EXESUF).tcov" |
| 516 | @echo "make testcpp.all / make testcpp.17" | ||
| 517 | @echo " run tests with code coverage. After test(s) see tcc_c.tcov" | ||
| 518 | @echo "" | ||
| 519 | @echo "Other supported make targets:" | 508 | @echo "Other supported make targets:" |
| 520 | @echo " install install-strip doc clean tags ETAGS tar distclean help" | 509 | @echo " install install-strip doc clean tags ETAGS tar distclean help" |
| 521 | @echo "" | ||
| 522 | @echo "Custom configuration:" | 510 | @echo "Custom configuration:" |
| 523 | @echo " The makefile includes a file 'config-extra.mak' if it is present." | 511 | @echo " The makefile includes a file 'config-extra.mak' if it is present." |
| 524 | @echo " This file may contain some custom configuration. For example:" | 512 | @echo " This file may contain some custom configuration. For example:" |
| @@ -1,7 +1,8 @@ | |||
| 1 | TODO list: | 1 | TODO list: |
| 2 | 2 | ||
| 3 | Releases: | 3 | Releases: |
| 4 | - release tcc on a regular basis (which interval? 3 months?) | 4 | |
| 5 | - release tcc on a regular basis | ||
| 5 | 6 | ||
| 6 | Bugs: | 7 | Bugs: |
| 7 | 8 | ||
| @@ -7,6 +7,7 @@ bigz An infinite precision Z & Q library. · 6 unmodified lines | |||
| 7 | gawk GNU awk. | 7 | gawk GNU awk. |
| 8 | gmp Library for arbitrary precision arithmetic. | 8 | gmp Library for arbitrary precision arithmetic. |
| 9 | gnumake GNU makefile. | 9 | gnumake GNU makefile. |
| 10 | gnu mes using tinycc to bootstrap a system | ||
| 10 | mpfr Multiple-precision floating-point library. | 11 | mpfr Multiple-precision floating-point library. |
| 11 | mpc Complex floating-point library with exact rounding. | 12 | mpc Complex floating-point library with exact rounding. |
| 12 | mpv A free, open source, and cross-platform media player. | 13 | mpv A free, open source, and cross-platform media player. |
| @@ -18,3 +19,50 @@ tcc Tiny CC which compiles itself. · 5 unmodified lines | |||
| 18 | zlib Lossless data-compression library. | 19 | zlib Lossless data-compression library. |
| 19 | 20 | ||
| 20 | (*) This list is ordered by name. | 21 | (*) This list is ordered by name. |
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | Forks & Experiments | ||
| 26 | ------------------- | ||
| 27 | |||
| 28 | arm-thumb target | ||
| 29 | by Erlend Sveen <erlend.sveen@hotmail.com> | ||
| 30 | https://git.erlendjs.no/erlendjs/tinycc.git | ||
| 31 | |||
| 32 | riscv32 target | ||
| 33 | by Sam Ellicott <sellicott@cedarville.edu> | ||
| 34 | https://github.com/sellicott/tcc-riscv32.git | ||
| 35 | |||
| 36 | Transputer target | ||
| 37 | by David Smith <agentdavo@mac.com> | ||
| 38 | https://github.com/agentdavo/tinycc-transputer | ||
| 39 | |||
| 40 | tcc-65816 - Tiny C Compiler for 65816 CPU (based on V0.9.23) from SNES-SDK | ||
| 41 | https://github.com/nArnoSNES/tcc-65816 | ||
| 42 | |||
| 43 | PE-UEFI arm64 | ||
| 44 | by Andrei Warkentin <andrey.warkentin@gmail.com> | ||
| 45 | https://github.com/andreiw/tinycc/ | ||
| 46 | |||
| 47 | TCCLS - global register allocator (proof of concept) | ||
| 48 | by Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | ||
| 49 | https://bitbucket.org/theStack/tccls_poc.git | ||
| 50 | |||
| 51 | softfloat | ||
| 52 | by Giovanni Mascellani <gio@debian.org> | ||
| 53 | https://gitlab.com/giomasce/tinycc.git | ||
| 54 | |||
| 55 | optimize 386 | ||
| 56 | by Jason Hood <jadoxa@yahoo.com.au> | ||
| 57 | |||
| 58 | tcctcl : tcl binding | ||
| 59 | https://code.google.com/archive/p/tcltcc/ | ||
| 60 | |||
| 61 | tcc4tcl : tcl binding | ||
| 62 | https://chiselapp.com/user/rkeene/repository/tcc4tcl/index | ||
| 63 | |||
| 64 | lua-tcc : allows a Lua script to compile C code | ||
| 65 | https://github.com/javierguerragiraldez/lua-tcc | ||
| 66 | |||
| 67 | tcclua : semi-high-level bindings for `libtcc` | ||
| 68 | https://github.com/nucular/tcclua/blob/master/tcc.lua | ||
| @@ -1 +1 @@ | |||
| 1 | 0.9.27 | 1 | 0.9.28rc |
| @@ -47,70 +47,19 @@ gcc_major=0 · 46 unmodified lines | |||
| 47 | gcc_minor=0 | 47 | gcc_minor=0 |
| 48 | cc_name="gcc" | 48 | cc_name="gcc" |
| 49 | ar_set= | 49 | ar_set= |
| 50 | darwin= | 50 | cpu= |
| 51 | cpuver= | 51 | cpuver= |
| 52 | dwarf= | 52 | dwarf= |
| 53 | targetos= | ||
| 54 | build_cross= | ||
| 53 | 55 | ||
| 54 | # use CC from environment when set | 56 | # use CC/AR from environment when set |
| 55 | test -n "$CC" && cc="$CC" | 57 | test -n "$CC" && cc="$CC" |
| 56 | 58 | test -n "$AR" && ar="$AR" | |
| 57 | # OS specific | ||
| 58 | cpu=`uname -m` | ||
| 59 | cpu_sys="$cpu" | ||
| 60 | targetos=`uname` | ||
| 61 | if test "$targetos" = "Linux" ; then | ||
| 62 | test "$(uname -o)" = "Android" && targetos=Android | ||
| 63 | fi | ||
| 64 | |||
| 65 | case $targetos in | ||
| 66 | Darwin) | ||
| 67 | darwin=yes | ||
| 68 | dwarf=4 | ||
| 69 | confvars="$confvars OSX" | ||
| 70 | cc=`command -v cc` | ||
| 71 | cc=`readlink $cc || echo clang` | ||
| 72 | tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" | ||
| 73 | DLLSUF=".dylib" | ||
| 74 | case $* in *--config-new_macho*) ;; *) | ||
| 75 | # if new_macho was not specified and (known) ver <= 10, use old (=no) | ||
| 76 | osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z | ||
| 77 | osxver=${osxver%%.*} # major version (or empty on sw_vers error) | ||
| 78 | [ "${osxver:-11}" -ge 11 ] || confvars="$confvars new_macho=no" | ||
| 79 | esac | ||
| 80 | ;; | ||
| 81 | Windows_NT|MINGW*|MSYS*|CYGWIN*) | ||
| 82 | mingw32=yes | ||
| 83 | targetos=WIN32 | ||
| 84 | ;; | ||
| 85 | DragonFly|OpenBSD|FreeBSD|NetBSD) | ||
| 86 | confvars="$confvars BSD ldl=no" | ||
| 87 | ;; | ||
| 88 | Android) | ||
| 89 | confvars="$confvars Android pie new-dtags" | ||
| 90 | if test -n "$TERMUX_VERSION"; then | ||
| 91 | prefix="$PREFIX" # "/data/data/com.termux/files/usr" | ||
| 92 | sysroot="$PREFIX" | ||
| 93 | test "$cpu" = "aarch64" -o "$cpu" = "x86_64" && S="64" || S="" | ||
| 94 | tcc_sysincludepaths="{B}/include:{R}/include/\\\"CONFIG_TRIPLET\\\":{R}/include" | ||
| 95 | tcc_libpaths="{B}:{R}/lib:/system/lib${S}" | ||
| 96 | tcc_crtprefix="{R}/lib" | ||
| 97 | tcc_elfinterp="/system/bin/linker${S}" | ||
| 98 | use_triplet="yes" | ||
| 99 | tcc_switches="-Wl,-rpath=$sysroot/lib,-section-alignment=0x1000" | ||
| 100 | fi | ||
| 101 | ;; | ||
| 102 | *) | ||
| 103 | ;; | ||
| 104 | esac | ||
| 105 | 59 | ||
| 106 | # find source path | 60 | # find source path |
| 107 | source_path=${0%configure} | 61 | source_path=${0%configure} |
| 108 | source_path=${source_path%/} | 62 | source_path=${source_path%/} |
| 109 | source_path_used="yes" | ||
| 110 | if test -z "$source_path" -o "$source_path" = "." ; then | ||
| 111 | source_path=`pwd` | ||
| 112 | source_path_used="no" | ||
| 113 | fi | ||
| 114 | 63 | ||
| 115 | for opt do | 64 | for opt do |
| 116 | eval opt=\"$opt\" | 65 | eval opt=\"$opt\" |
| @@ -137,6 +86,8 @@ for opt do · 20 unmodified lines | |||
| 137 | ;; | 86 | ;; |
| 138 | --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2-` | 87 | --sysroot=*) sysroot=`echo $opt | cut -d '=' -f 2-` |
| 139 | ;; | 88 | ;; |
| 89 | --targetos=*) targetos=`echo $opt | cut -d '=' -f 2-` | ||
| 90 | ;; | ||
| 140 | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2-` | 91 | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2-` |
| 141 | ;; | 92 | ;; |
| 142 | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2-` | 93 | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2-` |
| @@ -192,16 +143,119 @@ for opt do · 49 unmodified lines | |||
| 192 | esac | 143 | esac |
| 193 | done | 144 | done |
| 194 | 145 | ||
| 195 | cc="${cross_prefix}${cc}" | 146 | show_help() { |
| 196 | ar="${cross_prefix}${ar}" | 147 | cat << EOF |
| 148 | Usage: configure [options] | ||
| 149 | Options: [defaults in brackets after descriptions] | ||
| 150 | |||
| 151 | Standard options: | ||
| 152 | --help print this message | ||
| 153 | --prefix=PREFIX install in PREFIX [$prefix] | ||
| 154 | --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX | ||
| 155 | [same as prefix] | ||
| 156 | --bindir=DIR user executables in DIR [EPREFIX/bin] | ||
| 157 | --libdir=DIR object code libraries in DIR [EPREFIX/lib] | ||
| 158 | --tccdir=DIR installation directory [EPREFIX/lib/tcc] | ||
| 159 | --includedir=DIR C header files in DIR [PREFIX/include] | ||
| 160 | --sharedir=DIR documentation root DIR [PREFIX/share] | ||
| 161 | --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc] | ||
| 162 | --mandir=DIR man documentation in DIR [SHAREDIR/man] | ||
| 163 | --infodir=DIR info documentation in DIR [SHAREDIR/info] | ||
| 164 | |||
| 165 | Advanced options (experts only): | ||
| 166 | --source-path=PATH path of source code [$source_path] | ||
| 167 | --sysroot=PREFIX prepend PREFIX to library/include paths [$sysroot] | ||
| 168 | --cc=CC use C compiler CC [$cc] | ||
| 169 | --ar=AR create archives using AR [$ar] | ||
| 170 | --extra-cflags= specify compiler flags [$CFLAGS] | ||
| 171 | --extra-ldflags= specify linker options [$LDFLAGS] | ||
| 172 | |||
| 173 | --debug include debug info with resulting binaries | ||
| 174 | --disable-static make libtcc.so instead of libtcc.a | ||
| 175 | --enable-static make libtcc.a instead of libtcc.dll (win32) | ||
| 176 | --disable-rpath disable use of -rpath with libtcc.so | ||
| 177 | --with-libgcc use libgcc_s.so.1 instead of libtcc1.a | ||
| 178 | --with-selinux use mmap for executable memory (tcc -run) | ||
| 179 | --enable-cross build cross compilers (see also 'make help') | ||
| 197 | 180 | ||
| 198 | # Checking for CFLAGS | 181 | --sysincludepaths=... specify system include paths, colon separated |
| 199 | test -z "$CFLAGS" && CFLAGS="-Wall -O2" | 182 | --libpaths=... specify system library paths, colon separated |
| 183 | --crtprefix=... specify locations of crt?.o, colon separated | ||
| 184 | --elfinterp=... specify elf interpreter | ||
| 185 | --triplet=... specify system library/include directory triplet | ||
| 186 | --tcc-switches=... specify implicit switches passed to tcc | ||
| 187 | |||
| 188 | --config-uClibc,-musl enable system specific configurations | ||
| 189 | --config-mingw32 build on windows using msys, busybox, etc. | ||
| 190 | --config-backtrace=no disable stack backtraces (with -run or -bt) | ||
| 191 | --config-bcheck=no disable bounds checker (-b) | ||
| 192 | --config-predefs=no do not compile tccdefs.h, instead just include | ||
| 193 | --config-new_macho=no|yes Force apple object format (autodetect osx <= 10) | ||
| 194 | --config-codesign Use codesign on apple to sign executables | ||
| 195 | --dwarf=x Use dwarf debug info instead of stabs (x=2..5) | ||
| 196 | |||
| 197 | Cross build options (experimental): | ||
| 198 | --cpu=CPU target CPU [$cpu] | ||
| 199 | --targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos] | ||
| 200 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | ||
| 201 | EOF | ||
| 202 | exit 1 | ||
| 203 | } | ||
| 204 | |||
| 205 | default() # set variable unless already set | ||
| 206 | { | ||
| 207 | local v | ||
| 208 | eval v=\"\$$1\" | ||
| 209 | test -z "$v" && eval $1=\"$2\" | ||
| 210 | } | ||
| 211 | |||
| 212 | default_conf() # add to confvars unless already present | ||
| 213 | { | ||
| 214 | local v=${1%=*} | ||
| 215 | test "${confvars%$v*}" = "${confvars}" && confvars="$confvars $1" | ||
| 216 | } | ||
| 217 | |||
| 218 | if test -z "$source_path" -o "$source_path" = "." ; then | ||
| 219 | source_path=$(pwd) | ||
| 220 | source_path_used="no" | ||
| 221 | else | ||
| 222 | source_path_used="yes" | ||
| 223 | fi | ||
| 224 | |||
| 225 | # OS specific | ||
| 226 | buildos=$(uname) | ||
| 227 | |||
| 228 | case $buildos in | ||
| 229 | Windows_NT|MINGW*|MSYS*|CYGWIN*) | ||
| 230 | buildos="WIN32" | ||
| 231 | ;; | ||
| 232 | Linux) | ||
| 233 | if test "$(uname -o)" = "Android"; then | ||
| 234 | buildos=Android | ||
| 235 | if test -n "$TERMUX_VERSION"; then | ||
| 236 | buildos=Termux | ||
| 237 | fi | ||
| 238 | fi | ||
| 239 | ;; | ||
| 240 | esac | ||
| 241 | |||
| 242 | if test "$mingw32" = "yes"; then | ||
| 243 | default targetos WIN32 | ||
| 244 | else | ||
| 245 | default targetos "$buildos" | ||
| 246 | fi | ||
| 200 | 247 | ||
| 201 | # on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely | 248 | cpu_sys=$(uname -m) |
| 202 | if test "$darwin" = "yes" -a "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then | 249 | default cpu "$cpu_sys" |
| 203 | CFLAGS="$CFLAGS -arch $cpu" | 250 | cpu_set="$cpu" |
| 204 | LDFLAGS="$LDFLAGS -arch $cpu" | 251 | |
| 252 | # check for crpss build | ||
| 253 | if test "$cpu_set" != "$cpu_sys" \ | ||
| 254 | -o "$targetos" != "$buildos" \ | ||
| 255 | -o -n "$cross_prefix" ; then | ||
| 256 | build_cross="yes" | ||
| 257 | cc="${cross_prefix}${cc}" | ||
| 258 | ar="${cross_prefix}${ar}" | ||
| 205 | fi | 259 | fi |
| 206 | 260 | ||
| 207 | case "$cpu" in | 261 | case "$cpu" in |
| @@ -262,109 +316,101 @@ case "$cpu" in · 54 unmodified lines | |||
| 262 | ;; | 316 | ;; |
| 263 | esac | 317 | esac |
| 264 | 318 | ||
| 265 | if test "$mingw32" = "yes" ; then | 319 | case $targetos in |
| 266 | if test "$source_path_used" = "no"; then | 320 | Darwin) |
| 267 | source_path="." | 321 | dwarf=4 |
| 322 | confvars="$confvars OSX" | ||
| 323 | DLLSUF=".dylib" | ||
| 324 | if test -z "$build_cross"; then | ||
| 325 | cc=`command -v cc` | ||
| 326 | cc=`readlink $cc || echo clang` | ||
| 327 | tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" | ||
| 328 | if test "${confvars%new_macho*}" = "${confvars}"; then | ||
| 329 | # if new_macho was not specified and (known) ver <= 10, use old (=no) | ||
| 330 | osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z | ||
| 331 | osxver=${osxver%%.*} # major version (or empty on sw_vers error) | ||
| 332 | [ "${osxver:-11}" -ge 11 ] || confvars="$confvars new_macho=no" | ||
| 333 | fi | ||
| 334 | fi | ||
| 335 | # on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely | ||
| 336 | if test "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then | ||
| 337 | CFLAGS="$CFLAGS -arch $cpu" | ||
| 338 | LDFLAGS="$LDFLAGS -arch $cpu" | ||
| 268 | fi | 339 | fi |
| 269 | test -z "$prefix" && prefix="C:/Program Files/tcc" | 340 | ;; |
| 270 | test -z "$tccdir" && tccdir="${prefix}" && tccdir_auto="yes" | 341 | DragonFly|OpenBSD|FreeBSD|NetBSD) |
| 271 | test -z "$bindir" && bindir="${tccdir}" | 342 | confvars="$confvars BSD ldl=no" |
| 272 | test -z "$docdir" && docdir="${tccdir}/doc" | 343 | ;; |
| 273 | test -z "$libdir" && libdir="${tccdir}/libtcc" | 344 | Android|Termux) |
| 345 | if test "$targetos" = "Termux"; then | ||
| 346 | targetos=Android | ||
| 347 | default sysroot "/data/data/com.termux/files/usr" | ||
| 348 | else | ||
| 349 | default sysroot "/usr" | ||
| 350 | fi | ||
| 351 | default prefix "${sysroot}" | ||
| 352 | confvars="$confvars Android new-dtags rpath=no" | ||
| 353 | test "${cpu}" != "i386" && confvars="$confvars pie" | ||
| 354 | default_conf "static=no" | ||
| 355 | if test "${cpu}" = "arm"; then | ||
| 356 | default triplet "arm-linux-androideabi" | ||
| 357 | cpuver=7 | ||
| 358 | else | ||
| 359 | default triplet "${cpu_set}-linux-android" | ||
| 360 | fi | ||
| 361 | test "${cpu%64}" != "${cpu}" && S="64" || S="" | ||
| 362 | default tcc_sysincludepaths "{B}/include:{R}/include:{R}/include/${triplet}" | ||
| 363 | default tcc_libpaths "{B}:{R}/lib:/system/lib${S}" | ||
| 364 | default tcc_crtprefix "{R}/lib" | ||
| 365 | default tcc_elfinterp "/system/bin/linker${S}" | ||
| 366 | default tcc_switches "-Wl,-rpath=$sysroot/lib,-section-alignment=0x1000" | ||
| 367 | ;; | ||
| 368 | WIN32) | ||
| 369 | mingw32="yes" | ||
| 274 | confvars="$confvars WIN32" | 370 | confvars="$confvars WIN32" |
| 371 | default prefix "C:/Program Files/tcc" | ||
| 372 | default tccdir "${prefix}" | ||
| 373 | default bindir "${tccdir}" | ||
| 374 | default docdir "${tccdir}/doc" | ||
| 375 | default libdir "${tccdir}/libtcc" | ||
| 376 | test "$tccdir" = "$bindir" && tccdir_auto="yes" | ||
| 275 | LIBSUF=".lib" | 377 | LIBSUF=".lib" |
| 276 | EXESUF=".exe" | 378 | EXESUF=".exe" |
| 277 | DLLSUF=".dll" | 379 | DLLSUF=".dll" |
| 278 | else | 380 | if test "$source_path_used" = "no"; then |
| 279 | if test -z "$prefix" ; then | 381 | source_path="." |
| 280 | prefix="/usr/local" | ||
| 281 | fi | ||
| 282 | if test -z "$sharedir" ; then | ||
| 283 | sharedir="${prefix}/share" | ||
| 284 | fi | ||
| 285 | if test x"$execprefix" = x""; then | ||
| 286 | execprefix="${prefix}" | ||
| 287 | fi | ||
| 288 | if test x"$libdir" = x""; then | ||
| 289 | libdir="${execprefix}/lib" | ||
| 290 | fi | ||
| 291 | if test x"$bindir" = x""; then | ||
| 292 | bindir="${execprefix}/bin" | ||
| 293 | fi | ||
| 294 | if test x"$docdir" = x""; then | ||
| 295 | docdir="${sharedir}/doc" | ||
| 296 | fi | ||
| 297 | if test x"$mandir" = x""; then | ||
| 298 | mandir="${sharedir}/man" | ||
| 299 | fi | ||
| 300 | if test x"$infodir" = x""; then | ||
| 301 | infodir="${sharedir}/info" | ||
| 302 | fi | ||
| 303 | if test x"$tccdir" = x""; then | ||
| 304 | tccdir="${libdir}/tcc" | ||
| 305 | fi | ||
| 306 | if test x"$includedir" = x""; then | ||
| 307 | includedir="${prefix}/include" | ||
| 308 | fi | 382 | fi |
| 309 | fi # mingw32 | 383 | ;; |
| 310 | 384 | *) | |
| 311 | if test x"$show_help" = "xyes" ; then | 385 | ;; |
| 312 | cat << EOF | 386 | esac |
| 313 | Usage: configure [options] | ||
| 314 | Options: [defaults in brackets after descriptions] | ||
| 315 | |||
| 316 | Standard options: | ||
| 317 | --help print this message | ||
| 318 | --prefix=PREFIX install in PREFIX [$prefix] | ||
| 319 | --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX | ||
| 320 | [same as prefix] | ||
| 321 | --bindir=DIR user executables in DIR [EPREFIX/bin] | ||
| 322 | --libdir=DIR object code libraries in DIR [EPREFIX/lib] | ||
| 323 | --tccdir=DIR installation directory [EPREFIX/lib/tcc] | ||
| 324 | --includedir=DIR C header files in DIR [PREFIX/include] | ||
| 325 | --sharedir=DIR documentation root DIR [PREFIX/share] | ||
| 326 | --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc] | ||
| 327 | --mandir=DIR man documentation in DIR [SHAREDIR/man] | ||
| 328 | --infodir=DIR info documentation in DIR [SHAREDIR/info] | ||
| 329 | 387 | ||
| 330 | Advanced options (experts only): | 388 | if test "$mingw32" = "no"; then |
| 331 | --source-path=PATH path of source code [$source_path] | 389 | default prefix "/usr/local" |
| 332 | --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] | 390 | default execprefix "${prefix}" |
| 333 | --sysroot=PREFIX prepend PREFIX to library/include paths [$sysroot] | 391 | default libdir "${execprefix}/lib" |
| 334 | --cc=CC use C compiler CC [$cc] | 392 | default bindir "${execprefix}/bin" |
| 335 | --ar=AR create archives using AR [$ar] | 393 | default tccdir "${libdir}/tcc" |
| 336 | --extra-cflags= specify compiler flags [$CFLAGS] | 394 | default includedir "${prefix}/include" |
| 337 | --extra-ldflags= specify linker options [$LDFLAGS] | 395 | default sharedir "${prefix}/share" |
| 338 | --cpu=CPU CPU [$cpu] | 396 | default docdir "${sharedir}/doc" |
| 397 | default mandir "${sharedir}/man" | ||
| 398 | default infodir "${sharedir}/info" | ||
| 399 | fi | ||
| 339 | 400 | ||
| 340 | --debug include debug info with resulting binaries | 401 | # set default CFLAGS |
| 341 | --disable-static make libtcc.so instead of libtcc.a | 402 | default CFLAGS "-Wall -O2" |
| 342 | --enable-static make libtcc.a instead of libtcc.dll (win32) | ||
| 343 | --disable-rpath disable use of -rpath with libtcc.so | ||
| 344 | --with-libgcc use libgcc_s.so.1 instead of libtcc1.a | ||
| 345 | --with-selinux use mmap for executable memory (tcc -run) | ||
| 346 | --enable-cross build cross compilers (see also 'make help') | ||
| 347 | 403 | ||
| 348 | --sysincludepaths=... specify system include paths, colon separated | 404 | if test "$mingw32" = "yes" -a "$cc_name" = "gcc"; then |
| 349 | --libpaths=... specify system library paths, colon separated | 405 | # avoid mingw dependencies such as 'libgcc_s_dw2-1.dll' |
| 350 | --crtprefix=... specify locations of crt?.o, colon separated | 406 | default LDFLAGS "-static" |
| 351 | --elfinterp=... specify elf interpreter | 407 | fi |
| 352 | --triplet=... specify system library/include directory triplet | ||
| 353 | --tcc-switches=... specify implicit switches passed to tcc | ||
| 354 | 408 | ||
| 355 | --config-uClibc,-musl enable system specific configurations | 409 | if test x"$show_help" = "xyes" ; then |
| 356 | --config-mingw32 build on windows using msys, busybox, etc. | 410 | show_help |
| 357 | --config-backtrace=no disable stack backtraces (with -run or -bt) | ||
| 358 | --config-bcheck=no disable bounds checker (-b) | ||
| 359 | --config-predefs=no do not compile tccdefs.h, instead just include | ||
| 360 | --config-new_macho=no|yes Force apple object format (autodetect osx <= 10) | ||
| 361 | --config-codesign Use codesign on apple to sign executables | ||
| 362 | --dwarf=x Use dwarf debug info instead of stabs (x=2..5) | ||
| 363 | EOF | ||
| 364 | exit 1 | ||
| 365 | fi | 411 | fi |
| 366 | 412 | ||
| 367 | if test -z "$cross_prefix" ; then | 413 | if test -z "$build_cross"; then |
| 368 | CONFTEST=./conftest$EXESUF | 414 | CONFTEST=./conftest$EXESUF |
| 369 | if ! $cc -o $CONFTEST $source_path/conftest.c ; then | 415 | if ! $cc -o $CONFTEST $source_path/conftest.c ; then |
| 370 | echo "configure: error: '$cc' failed to compile conftest.c." | 416 | echo "configure: error: '$cc' failed to compile conftest.c." |
| @@ -376,13 +422,11 @@ if test -z "$cross_prefix" ; then · 5 unmodified lines | |||
| 376 | _triplet="$($CONFTEST triplet)" | 422 | _triplet="$($CONFTEST triplet)" |
| 377 | fi | 423 | fi |
| 378 | if test "$mingw32" = "no" ; then | 424 | if test "$mingw32" = "no" ; then |
| 379 | |||
| 380 | if test -z "$triplet" -a -n "$_triplet"; then | 425 | if test -z "$triplet" -a -n "$_triplet"; then |
| 381 | if test -f "/usr/lib/$_triplet/crti.o" -o -n "$use_triplet" ; then | 426 | if test -f "/usr/lib/$_triplet/crti.o"; then |
| 382 | triplet="$_triplet" | 427 | triplet="$_triplet" |
| 383 | fi | 428 | fi |
| 384 | fi | 429 | fi |
| 385 | |||
| 386 | if test -z "$triplet"; then | 430 | if test -z "$triplet"; then |
| 387 | if test $cpu = "x86_64" -o $cpu = "arm64" -o $cpu = "riscv64" ; then | 431 | if test $cpu = "x86_64" -o $cpu = "arm64" -o $cpu = "riscv64" ; then |
| 388 | if test -f "/usr/lib64/crti.o" ; then | 432 | if test -f "/usr/lib64/crti.o" ; then |
| @@ -390,21 +434,6 @@ if test -z "$cross_prefix" ; then · 1 unmodified line | |||
| 390 | fi | 434 | fi |
| 391 | fi | 435 | fi |
| 392 | fi | 436 | fi |
| 393 | |||
| 394 | if test "$cpu" = "arm" ; then | ||
| 395 | if test "${triplet%eabihf}" != "$triplet" ; then | ||
| 396 | confvars="$confvars arm_eabihf arm_vfp" | ||
| 397 | elif test "${triplet%eabi}" != "$triplet" ; then | ||
| 398 | confvars="$confvars arm_eabi arm_vfp" | ||
| 399 | elif test "${_triplet%eabihf}" != "$_triplet" ; then | ||
| 400 | confvars="$confvars arm_eabihf arm_vfp" | ||
| 401 | elif test "${_triplet%eabi}" != "$_triplet" ; then | ||
| 402 | confvars="$confvars arm_eabi arm_vfp" | ||
| 403 | elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then | ||
| 404 | confvars="$confvars arm_vfp" | ||
| 405 | fi | ||
| 406 | fi | ||
| 407 | |||
| 408 | if test "$suggest" = "yes"; then | 437 | if test "$suggest" = "yes"; then |
| 409 | if test -f "/lib/ld-uClibc.so.0" ; then | 438 | if test -f "/lib/ld-uClibc.so.0" ; then |
| 410 | echo "Perhaps you want ./configure --config-uClibc" | 439 | echo "Perhaps you want ./configure --config-uClibc" |
| @@ -413,23 +442,43 @@ if test -z "$cross_prefix" ; then · 2 unmodified lines | |||
| 413 | echo "Perhaps you want ./configure --config-musl" | 442 | echo "Perhaps you want ./configure --config-musl" |
| 414 | fi | 443 | fi |
| 415 | fi | 444 | fi |
| 416 | else # mingw32 = yes | ||
| 417 | if test "$cc_name" = "gcc"; then | ||
| 418 | # avoid mingw dependencies such as 'libgcc_s_dw2-1.dll' | ||
| 419 | test -z "$LDFLAGS" && LDFLAGS="-static" | ||
| 420 | fi | ||
| 421 | fi | 445 | fi |
| 422 | else | 446 | else |
| 423 | # if cross compiling, cannot launch a program, so make a static guess | 447 | # can only make guesses about compiler and target |
| 448 | if test "${cc%tcc*}" != "$cc"; then | ||
| 449 | cc_name="tcc" | ||
| 450 | elif test "${cc%clang*}" != "$cc"; then | ||
| 451 | cc_name="clang" | ||
| 452 | fi | ||
| 424 | case $cpu in | 453 | case $cpu in |
| 425 | ppc|mips|s390) bigendian=yes;; | 454 | ppc|mips|s390) bigendian=yes;; |
| 426 | esac | 455 | esac |
| 456 | case $targetos in | ||
| 457 | Linux) | ||
| 458 | default triplet "$cpu_set-linux-gnu" | ||
| 459 | esac | ||
| 427 | fi | 460 | fi |
| 428 | 461 | ||
| 429 | if test "$bigendian" = "yes" ; then | 462 | if test "$bigendian" = "yes" ; then |
| 430 | confvars="$confvars BIGENDIAN" | 463 | confvars="$confvars BIGENDIAN" |
| 431 | fi | 464 | fi |
| 432 | 465 | ||
| 466 | if test "$cpu" = "arm"; then | ||
| 467 | if test "${triplet%eabihf}" != "$triplet" ; then | ||
| 468 | confvars="$confvars arm_eabihf arm_vfp" | ||
| 469 | elif test "${triplet%eabi}" != "$triplet" ; then | ||
| 470 | confvars="$confvars arm_eabi arm_vfp" | ||
| 471 | elif test -z "$build_cross"; then | ||
| 472 | if test "${_triplet%eabihf}" != "$_triplet" ; then | ||
| 473 | confvars="$confvars arm_eabihf arm_vfp" | ||
| 474 | elif test "${_triplet%eabi}" != "$_triplet" ; then | ||
| 475 | confvars="$confvars arm_eabi arm_vfp" | ||
| 476 | elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then | ||
| 477 | confvars="$confvars arm_vfp" | ||
| 478 | fi | ||
| 479 | fi | ||
| 480 | fi | ||
| 481 | |||
| 433 | # a final configuration tuning | 482 | # a final configuration tuning |
| 434 | if test "$cc_name" != "tcc"; then | 483 | if test "$cc_name" != "tcc"; then |
| 435 | OPT1="-Wdeclaration-after-statement -fno-strict-aliasing" | 484 | OPT1="-Wdeclaration-after-statement -fno-strict-aliasing" |
| @@ -438,7 +487,7 @@ if test "$cc_name" != "tcc"; then · 2 unmodified lines | |||
| 438 | OPT2="$OPT2 -Wstringop-truncation" | 487 | OPT2="$OPT2 -Wstringop-truncation" |
| 439 | if test "$cc_name" = "clang"; then | 488 | if test "$cc_name" = "clang"; then |
| 440 | OPT1="$OPT1 -fheinous-gnu-extensions" | 489 | OPT1="$OPT1 -fheinous-gnu-extensions" |
| 441 | OPT2="$OPT2 -Wstring-plus-int" | 490 | OPT2="$OPT2 -Wstring-plus-int -Wdeprecated-declarations" |
| 442 | fi | 491 | fi |
| 443 | $cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1 | 492 | $cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1 |
| 444 | for o in $OPT1; do # enable these options | 493 | for o in $OPT1; do # enable these options |
| @@ -470,6 +519,11 @@ echo "C compiler $cc ($gcc_major.$gcc_minor)" · 25 unmodified lines | |||
| 470 | echo "Target OS $targetos" | 519 | echo "Target OS $targetos" |
| 471 | echo "CPU $cpu" | 520 | echo "CPU $cpu" |
| 472 | fcho "Triplet " "$triplet" | 521 | fcho "Triplet " "$triplet" |
| 522 | fcho "Libs " "$tcc_libpaths" | ||
| 523 | fcho "Sysinclude " "$tcc_sysincludepaths" | ||
| 524 | fcho "Crt " "$tcc_crtprefix" | ||
| 525 | fcho "Elfinterp " "$tcc_elfinterp" | ||
| 526 | fcho "Switches " "$tcc_switches" | ||
| 473 | fcho "Config " "${confvars# }" | 527 | fcho "Config " "${confvars# }" |
| 474 | echo "Creating config.mak and config.h" | 528 | echo "Creating config.mak and config.h" |
| 475 | 529 | ||
| @@ -530,6 +584,7 @@ print_mak TCC_CPU_VERSION "$cpuver" num · 54 unmodified lines | |||
| 530 | 584 | ||
| 531 | echo "ARCH=$cpu" >> config.mak | 585 | echo "ARCH=$cpu" >> config.mak |
| 532 | echo "TARGETOS=$targetos" >> config.mak | 586 | echo "TARGETOS=$targetos" >> config.mak |
| 587 | echo "BUILDOS=$buildos" >> config.mak | ||
| 533 | 588 | ||
| 534 | predefs="1" | 589 | predefs="1" |
| 535 | for v in $confvars ; do | 590 | for v in $confvars ; do |
| @@ -1,8 +1,8 @@ | |||
| 1 | /* ----------------------------------------------------------------------- */ | 1 | /* ----------------------------------------------------------------------- */ |
| 2 | #if C2STR | ||
| 3 | |||
| 4 | /* with -D C2STR: convert tccdefs.h to C-strings */ | 2 | /* with -D C2STR: convert tccdefs.h to C-strings */ |
| 5 | 3 | ||
| 4 | #if C2STR | ||
| 5 | |||
| 6 | #include <stdio.h> | 6 | #include <stdio.h> |
| 7 | #include <string.h> | 7 | #include <string.h> |
| 8 | 8 | ||
| @@ -166,14 +166,16 @@ int main(int argc, char **argv) · 157 unmodified lines | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /* ----------------------------------------------------------------------- */ | 168 | /* ----------------------------------------------------------------------- */ |
| 169 | #elif 1 | ||
| 170 | |||
| 171 | /* get some information from the host compiler for configure */ | 169 | /* get some information from the host compiler for configure */ |
| 172 | 170 | ||
| 171 | #elif 1 | ||
| 172 | |||
| 173 | #include <stdio.h> | 173 | #include <stdio.h> |
| 174 | 174 | ||
| 175 | #if defined(_WIN32) | 175 | #if defined(_WIN32) |
| 176 | #include <fcntl.h> | 176 | #include <fcntl.h> |
| 177 | #include <io.h> | ||
| 178 | int _CRT_glob = 0; | ||
| 177 | #endif | 179 | #endif |
| 178 | 180 | ||
| 179 | /* Define architecture */ | 181 | /* Define architecture */ |
| @@ -233,10 +235,6 @@ int main(int argc, char **argv) · 53 unmodified lines | |||
| 233 | # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI | 235 | # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI |
| 234 | #endif | 236 | #endif |
| 235 | 237 | ||
| 236 | #if defined(_WIN32) | ||
| 237 | int _CRT_glob = 0; | ||
| 238 | #endif | ||
| 239 | |||
| 240 | int main(int argc, char *argv[]) | 238 | int main(int argc, char *argv[]) |
| 241 | { | 239 | { |
| 242 | #if defined(_WIN32) | 240 | #if defined(_WIN32) |
| @@ -364,10 +364,11 @@ bounds (@pxref{Bounds}). @option{-g} is implied. · 363 unmodified lines | |||
| 364 | 364 | ||
| 365 | @item -bt[N] | 365 | @item -bt[N] |
| 366 | Display N callers in stack traces. This is useful with @option{-g} or @option{-b}. | 366 | Display N callers in stack traces. This is useful with @option{-g} or @option{-b}. |
| 367 | With executables, additional support for stack traces is included. | 367 | When activated, @code{__TCC_BACKTRACE__} is defined. |
| 368 | 368 | ||
| 369 | A function @code{ int tcc_backtrace(const char *fmt, ...); } is provided | 369 | With executables, additional support for stack traces is included. A function |
| 370 | to trigger a stack trace with a message on demand. | 370 | @code{ int tcc_backtrace(const char *fmt, ...); } |
| 371 | is provided to trigger a stack trace with a message on demand. | ||
| 371 | 372 | ||
| 372 | @end table | 373 | @end table |
| 373 | 374 | ||
| @@ -937,7 +938,7 @@ Here are some examples of caught errors: · 563 unmodified lines | |||
| 937 | @end example | 938 | @end example |
| 938 | @end table | 939 | @end table |
| 939 | 940 | ||
| 940 | TCC defines @code{__BOUNDS_CHECKING_ON} if activated. | 941 | TCC defines @code{__TCC_BCHECK__} if activated. |
| 941 | 942 | ||
| 942 | There are five environment variables that can be used to control the behavior: | 943 | There are five environment variables that can be used to control the behavior: |
| 943 | @itemize | 944 | @itemize |
| @@ -984,7 +985,7 @@ for bounds checking errors. · 40 unmodified lines | |||
| 984 | @end itemize | 985 | @end itemize |
| 985 | 986 | ||
| 986 | @example | 987 | @example |
| 987 | #if defined(__TINYC__) && __BOUNDS_CHECKING_ON | 988 | #ifdef __TCC_BCHECK__ |
| 988 | extern void __bounds_checking (int x); | 989 | extern void __bounds_checking (int x); |
| 989 | # define BOUNDS_CHECKING_OFF __bounds_checking(1) | 990 | # define BOUNDS_CHECKING_OFF __bounds_checking(1) |
| 990 | # define BOUNDS_CHECKING_ON __bounds_checking(-1) | 991 | # define BOUNDS_CHECKING_ON __bounds_checking(-1) |
| @@ -10,7 +10,7 @@ VPATH = $(SRC) · 9 unmodified lines | |||
| 10 | files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1))) | 10 | files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1))) |
| 11 | TESTS = $(call files,c) $(call files,S) | 11 | TESTS = $(call files,c) $(call files,S) |
| 12 | 12 | ||
| 13 | all test testspp.all testcpp.all: $(sort $(TESTS)) | 13 | all test testspp.all: $(sort $(TESTS)) |
| 14 | 14 | ||
| 15 | DIFF_OPTS = -Nu -b | 15 | DIFF_OPTS = -Nu -b |
| 16 | 16 | ||
| @@ -29,7 +29,7 @@ FILTER = 2>&1 | sed 's,$(SRC)/,,g' · 12 unmodified lines | |||
| 29 | diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ | 29 | diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ |
| 30 | && rm -f $*.output | 30 | && rm -f $*.output |
| 31 | 31 | ||
| 32 | testspp.% testcpp.%: %.test ; | 32 | testspp.%: %.test ; |
| 33 | 33 | ||
| 34 | # automatically generate .expect files with gcc: | 34 | # automatically generate .expect files with gcc: |
| 35 | %.expect: # %.c | 35 | %.expect: # %.c |
| @@ -124,7 +124,7 @@ endif · 123 unmodified lines | |||
| 124 | # Filter source directory in warnings/errors (out-of-tree builds) | 124 | # Filter source directory in warnings/errors (out-of-tree builds) |
| 125 | FILTER = 2>&1 | sed -e 's,$(SRC)/,,g' | 125 | FILTER = 2>&1 | sed -e 's,$(SRC)/,,g' |
| 126 | 126 | ||
| 127 | all test tests2.all testc2.all: $(filter-out $(SKIP),$(TESTS)) | 127 | all test tests2.all: $(filter-out $(SKIP),$(TESTS)) |
| 128 | @$(MAKE) clean --no-print-directory -s | 128 | @$(MAKE) clean --no-print-directory -s |
| 129 | 129 | ||
| 130 | %.test: %.c %.expect | 130 | %.test: %.c %.expect |
| @@ -138,15 +138,15 @@ T3 = $(FILTER) >$*.output 2>&1 || true \ · 7 unmodified lines | |||
| 138 | && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) | 138 | && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) |
| 139 | 139 | ||
| 140 | # run single test and update .expect file, e.g. "make tests2.37+" | 140 | # run single test and update .expect file, e.g. "make tests2.37+" |
| 141 | tests2.%+ testc2.%+: | 141 | tests2.%+: |
| 142 | @$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory | 142 | @$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory |
| 143 | 143 | ||
| 144 | # just run tcc to see the output, e.g. "make tests2.37-" | 144 | # just run tcc to see the output, e.g. "make tests2.37-" |
| 145 | tests2.%- testc2.%-: | 145 | tests2.%-: |
| 146 | @$(MAKE) $(call F1,$*) T3= --no-print-directory | 146 | @$(MAKE) $(call F1,$*) T3= --no-print-directory |
| 147 | 147 | ||
| 148 | # run single test, e.g. "make tests2.37" | 148 | # run single test, e.g. "make tests2.37" |
| 149 | tests2.% testc2.%: | 149 | tests2.%: |
| 150 | @$(MAKE) $(call F1,$*) --no-print-directory | 150 | @$(MAKE) $(call F1,$*) --no-print-directory |
| 151 | 151 | ||
| 152 | F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test) | 152 | F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test) |
| @@ -7,7 +7,8 @@ setlocal · 6 unmodified lines | |||
| 7 | if (%1)==(-clean) goto :cleanup | 7 | if (%1)==(-clean) goto :cleanup |
| 8 | set CC=gcc | 8 | set CC=gcc |
| 9 | set /p VERSION= < ..\VERSION | 9 | set /p VERSION= < ..\VERSION |
| 10 | set INST= | 10 | set TCCDIR= |
| 11 | set BINDIR= | ||
| 11 | set DOC=no | 12 | set DOC=no |
| 12 | set EXES_ONLY=no | 13 | set EXES_ONLY=no |
| 13 | goto :a0 | 14 | goto :a0 |
| @@ -23,7 +24,8 @@ goto :a2 · 9 unmodified lines | |||
| 23 | :a1 | 24 | :a1 |
| 24 | if (%1)==(-t) set T=%2&& goto :a2 | 25 | if (%1)==(-t) set T=%2&& goto :a2 |
| 25 | if (%1)==(-v) set VERSION=%~2&& goto :a2 | 26 | if (%1)==(-v) set VERSION=%~2&& goto :a2 |
| 26 | if (%1)==(-i) set INST=%2&& goto :a2 | 27 | if (%1)==(-i) set TCCDIR=%2&& goto :a2 |
| 28 | if (%1)==(-b) set BINDIR=%2&& goto :a2 | ||
| 27 | if (%1)==(-d) set DOC=yes&& goto :a3 | 29 | if (%1)==(-d) set DOC=yes&& goto :a3 |
| 28 | if (%1)==(-x) set EXES_ONLY=yes&& goto :a3 | 30 | if (%1)==(-x) set EXES_ONLY=yes&& goto :a3 |
| 29 | if (%1)==() goto :p1 | 31 | if (%1)==() goto :p1 |
| @@ -35,6 +37,7 @@ echo -c "prog options" use prog with options to compile tcc · 5 unmodified lines | |||
| 35 | echo -t 32/64 force 32/64 bit default target | 37 | echo -t 32/64 force 32/64 bit default target |
| 36 | echo -v "version" set tcc version | 38 | echo -v "version" set tcc version |
| 37 | echo -i tccdir install tcc into tccdir | 39 | echo -i tccdir install tcc into tccdir |
| 40 | echo -b bindir but install tcc.exe and libtcc.dll into bindir | ||
| 38 | echo -d create tcc-doc.html too (needs makeinfo) | 41 | echo -d create tcc-doc.html too (needs makeinfo) |
| 39 | echo -x just create the executables | 42 | echo -x just create the executables |
| 40 | echo -clean delete all previously produced files and directories | 43 | echo -clean delete all previously produced files and directories |
| @@ -87,18 +90,24 @@ if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64 · 46 unmodified lines | |||
| 87 | if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64 | 90 | if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64 |
| 88 | :p2 | 91 | :p2 |
| 89 | if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static | 92 | if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static |
| 93 | if (%BINDIR%)==() set BINDIR=%TCCDIR% | ||
| 94 | |||
| 90 | set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386 | 95 | set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386 |
| 91 | set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 | 96 | set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 |
| 92 | set P32=i386-win32 | 97 | set P32=i386-win32 |
| 93 | set P64=x86_64-win32 | 98 | set P64=x86_64-win32 |
| 99 | |||
| 94 | if %T%==64 goto :t64 | 100 | if %T%==64 goto :t64 |
| 95 | set D=%D32% | 101 | set D=%D32% |
| 102 | set P=%P32% | ||
| 96 | set DX=%D64% | 103 | set DX=%D64% |
| 97 | set PX=%P64% | 104 | set PX=%P64% |
| 98 | set TX=64 | 105 | set TX=64 |
| 99 | goto :p3 | 106 | goto :p3 |
| 107 | |||
| 100 | :t64 | 108 | :t64 |
| 101 | set D=%D64% | 109 | set D=%D64% |
| 110 | set P=%P64% | ||
| 102 | set DX=%D32% | 111 | set DX=%D32% |
| 103 | set PX=%P32% | 112 | set PX=%P32% |
| 104 | set TX=32 | 113 | set TX=32 |
| @@ -111,17 +120,16 @@ for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b · 6 unmodified lines | |||
| 111 | for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b | 120 | for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b |
| 112 | git.exe diff --quiet | 121 | git.exe diff --quiet |
| 113 | if %ERRORLEVEL%==1 set GITHASH=%GITHASH%* | 122 | if %ERRORLEVEL%==1 set GITHASH=%GITHASH%* |
| 114 | set DEF_GITHASH=-DTCC_GITHASH="""%GITHASH%""" | ||
| 115 | :git_done | 123 | :git_done |
| 116 | |||
| 117 | @echo on | 124 | @echo on |
| 118 | 125 | ||
| 119 | :config.h | 126 | :config.h |
| 120 | echo>..\config.h #define TCC_VERSION "%VERSION%" | 127 | echo>..\config.h #define TCC_VERSION "%VERSION%" |
| 121 | echo>> ..\config.h #ifdef TCC_TARGET_X86_64 | 128 | if not (%GITHASH%)==() echo>> ..\config.h #define TCC_GITHASH "%GITHASH%" |
| 122 | echo>> ..\config.h #define TCC_LIBTCC1 "libtcc1-64.a" | 129 | @if not (%BINDIR%)==(%TCCDIR%) echo>> ..\config.h #define CONFIG_TCCDIR "%TCCDIR:\=/%" |
| 123 | echo>> ..\config.h #else | 130 | if %TX%==64 echo>> ..\config.h #ifdef TCC_TARGET_X86_64 |
| 124 | echo>> ..\config.h #define TCC_LIBTCC1 "libtcc1-32.a" | 131 | if %TX%==32 echo>> ..\config.h #ifdef TCC_TARGET_I386 |
| 132 | echo>> ..\config.h #define CONFIG_TCC_CROSSPREFIX "%PX%-" | ||
| 125 | echo>> ..\config.h #endif | 133 | echo>> ..\config.h #endif |
| 126 | 134 | ||
| 127 | for %%f in (*tcc.exe *tcc.dll) do @del %%f | 135 | for %%f in (*tcc.exe *tcc.dll) do @del %%f |
| @@ -135,7 +143,7 @@ for %%f in (*tcc.exe *tcc.dll) do @del %%f · 7 unmodified lines | |||
| 135 | @if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c | 143 | @if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c |
| 136 | %CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL | 144 | %CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL |
| 137 | @if errorlevel 1 goto :the_end | 145 | @if errorlevel 1 goto :the_end |
| 138 | %CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0" %DEF_GITHASH% | 146 | %CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0" |
| 139 | %CC% -o %PX%-tcc.exe ..\tcc.c %DX% | 147 | %CC% -o %PX%-tcc.exe ..\tcc.c %DX% |
| 140 | :compiler_done | 148 | :compiler_done |
| 141 | @if (%EXES_ONLY%)==(yes) goto :files_done | 149 | @if (%EXES_ONLY%)==(yes) goto :files_done |
| @@ -151,15 +159,9 @@ copy>nul tcc-win32.txt doc · 9 unmodified lines | |||
| 151 | if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def | 159 | if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def |
| 152 | @if errorlevel 1 goto :the_end | 160 | @if errorlevel 1 goto :the_end |
| 153 | 161 | ||
| 154 | :libtcc1.a | 162 | :lib |
| 155 | call :makelib %T% | 163 | call :make_lib %T% || goto :the_end |
| 156 | @if errorlevel 1 goto :the_end | 164 | @if exist %PX%-tcc.exe call :make_lib %TX% %PX%- || goto :the_end |
| 157 | @if exist %PX%-tcc.exe call :makelib %TX% | ||
| 158 | @if errorlevel 1 goto :the_end | ||
| 159 | .\tcc -m%T% -c ../lib/bcheck.c -o lib/bcheck.o -bt | ||
| 160 | .\tcc -m%T% -c ../lib/bt-exe.c -o lib/bt-exe.o | ||
| 161 | .\tcc -m%T% -c ../lib/bt-log.c -o lib/bt-log.o | ||
| 162 | .\tcc -m%T% -c ../lib/bt-dll.c -o lib/bt-dll.o | ||
| 163 | 165 | ||
| 164 | :tcc-doc.html | 166 | :tcc-doc.html |
| 165 | @if not (%DOC%)==(yes) goto :doc-done | 167 | @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 · 5 unmodified lines | |||
| 171 | for %%f in (*.o *.def) do @del %%f | 173 | for %%f in (*.o *.def) do @del %%f |
| 172 | 174 | ||
| 173 | :copy-install | 175 | :copy-install |
| 174 | @if (%INST%)==() goto :the_end | 176 | @if (%TCCDIR%)==() goto :the_end |
| 175 | if not exist %INST% mkdir %INST% | 177 | if not exist %BINDIR% mkdir %BINDIR% |
| 176 | for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %INST%\%%f | 178 | for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %BINDIR%\%%f |
| 177 | @if not exist %INST%\lib mkdir %INST%\lib | 179 | if not exist %TCCDIR% mkdir %TCCDIR% |
| 178 | for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %INST%\%%f | 180 | @if not exist %TCCDIR%\lib mkdir %TCCDIR%\lib |
| 179 | for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %INST%\%%f | 181 | for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %TCCDIR%\%%f |
| 182 | for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %TCCDIR%\%%f | ||
| 180 | 183 | ||
| 181 | :the_end | 184 | :the_end |
| 182 | exit /B %ERRORLEVEL% | 185 | exit /B %ERRORLEVEL% |
| 183 | 186 | ||
| 184 | :makelib | 187 | :make_lib |
| 185 | .\tcc -m%1 -c ../lib/libtcc1.c | 188 | .\tcc -B. -m%1 -c ../lib/libtcc1.c |
| 186 | .\tcc -m%1 -c lib/crt1.c | 189 | .\tcc -B. -m%1 -c lib/crt1.c |
| 187 | .\tcc -m%1 -c lib/crt1w.c | 190 | .\tcc -B. -m%1 -c lib/crt1w.c |
| 188 | .\tcc -m%1 -c lib/wincrt1.c | 191 | .\tcc -B. -m%1 -c lib/wincrt1.c |
| 189 | .\tcc -m%1 -c lib/wincrt1w.c | 192 | .\tcc -B. -m%1 -c lib/wincrt1w.c |
| 190 | .\tcc -m%1 -c lib/dllcrt1.c | 193 | .\tcc -B. -m%1 -c lib/dllcrt1.c |
| 191 | .\tcc -m%1 -c lib/dllmain.c | 194 | .\tcc -B. -m%1 -c lib/dllmain.c |
| 192 | .\tcc -m%1 -c lib/chkstk.S | 195 | .\tcc -B. -m%1 -c lib/chkstk.S |
| 193 | .\tcc -m%1 -c ../lib/alloca.S | 196 | .\tcc -B. -m%1 -c ../lib/alloca.S |
| 194 | .\tcc -m%1 -c ../lib/alloca-bt.S | 197 | .\tcc -B. -m%1 -c ../lib/alloca-bt.S |
| 195 | .\tcc -m%1 -c ../lib/stdatomic.c | 198 | .\tcc -B. -m%1 -c ../lib/stdatomic.c |
| 196 | .\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 | 199 | .\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 |
| 200 | .\tcc -B. -m%1 -c ../lib/bcheck.c -o lib/%2bcheck.o -bt | ||
| 201 | .\tcc -B. -m%1 -c ../lib/bt-exe.c -o lib/%2bt-exe.o | ||
| 202 | .\tcc -B. -m%1 -c ../lib/bt-log.c -o lib/%2bt-log.o | ||
| 203 | .\tcc -B. -m%1 -c ../lib/bt-dll.c -o lib/%2bt-dll.o | ||
| 197 | exit /B %ERRORLEVEL% | 204 | exit /B %ERRORLEVEL% |