mirror of
https://github.com/frida/tinycc
synced 2024-12-18 03:12:44 +03:00
make SILENT=yes
This allows to run make more silently. Also, turns off debug info for binaries by default, but adds a switch to get it back easily ./configure --debug
This commit is contained in:
parent
92236bfe1d
commit
7bb5454ef3
140
Makefile
140
Makefile
@ -8,9 +8,11 @@ ifndef TOP
|
|||||||
INCLUDED = no
|
INCLUDED = no
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(TOP)/config.mak
|
ifeq ($(findstring $(MAKECMDGOALS),clean distclean),)
|
||||||
|
include $(TOP)/config.mak
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (-$(CC)-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-gcc-4--)
|
ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--)
|
||||||
CFLAGS += -D_FORTIFY_SOURCE=0
|
CFLAGS += -D_FORTIFY_SOURCE=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -60,6 +62,11 @@ ifdef CONFIG_OSX
|
|||||||
TCCFLAGS += -D_ANSI_SOURCE
|
TCCFLAGS += -D_ANSI_SOURCE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# cross compiler targets to build
|
||||||
|
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
||||||
|
TCC_X += riscv64
|
||||||
|
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
|
||||||
|
|
||||||
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)
|
||||||
LDFLAGS_P = $(LDFLAGS)
|
LDFLAGS_P = $(LDFLAGS)
|
||||||
@ -86,16 +93,11 @@ ifeq ($(INCLUDED),no)
|
|||||||
# running top Makefile
|
# running top Makefile
|
||||||
|
|
||||||
PROGS = tcc$(EXESUF)
|
PROGS = tcc$(EXESUF)
|
||||||
TCCLIBS = $(LIBTCC1) $(LIBTCC) $(LIBTCCDEF)
|
TCCLIBS = $(LIBTCCDEF) $(LIBTCC) $(LIBTCC1)
|
||||||
TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
|
TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
|
||||||
|
|
||||||
all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
||||||
|
|
||||||
# cross compiler targets to build
|
|
||||||
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
|
||||||
TCC_X += riscv64
|
|
||||||
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
|
|
||||||
|
|
||||||
# cross libtcc1.a targets to build
|
# cross libtcc1.a targets to build
|
||||||
LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
|
LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
|
||||||
LIBTCC1_X += riscv64
|
LIBTCC1_X += riscv64
|
||||||
@ -109,8 +111,8 @@ cross: $(LIBTCC1_CROSS) $(PROGS_CROSS)
|
|||||||
# build specific cross compiler & lib
|
# build specific cross compiler & lib
|
||||||
cross-%: %-tcc$(EXESUF) %-libtcc1.a ;
|
cross-%: %-tcc$(EXESUF) %-libtcc1.a ;
|
||||||
|
|
||||||
install: ; @$(MAKE) --no-print-directory install$(CFGWIN)
|
install: ; @$(MAKE) --no-print-directory install$(CFGWIN)
|
||||||
install-strip: ; @$(MAKE) --no-print-directory install$(CFGWIN) CONFIG_strip=yes
|
install-strip: ; @$(MAKE) --no-print-directory install$(CFGWIN) CONFIG_strip=yes
|
||||||
uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFGWIN)
|
uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFGWIN)
|
||||||
|
|
||||||
ifdef CONFIG_cross
|
ifdef CONFIG_cross
|
||||||
@ -193,35 +195,43 @@ TCC_FILES = $(X)tcc.o $(LIBTCC_OBJ)
|
|||||||
$(TCC_FILES) : DEFINES += -DONE_SOURCE=0
|
$(TCC_FILES) : DEFINES += -DONE_SOURCE=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_strip),no)
|
||||||
|
CFLAGS += -g
|
||||||
|
LDFLAGS += -g
|
||||||
|
else
|
||||||
|
CONFIG_strip = yes
|
||||||
|
LDFLAGS += -s
|
||||||
|
endif
|
||||||
|
|
||||||
# target specific object rule
|
# target specific object rule
|
||||||
$(X)%.o : %.c $(LIBTCC_INC)
|
$(X)%.o : %.c $(LIBTCC_INC)
|
||||||
$(CC) -o $@ -c $< $(DEFINES) $(CFLAGS)
|
$S$(CC) -o $@ -c $< $(DEFINES) $(CFLAGS)
|
||||||
|
|
||||||
# additional dependencies
|
# additional dependencies
|
||||||
$(X)tcc.o : tcctools.c
|
$(X)tcc.o : tcctools.c
|
||||||
|
|
||||||
# Host Tiny C Compiler
|
# Host Tiny C Compiler
|
||||||
tcc$(EXESUF): tcc.o $(LIBTCC)
|
tcc$(EXESUF): tcc.o $(LIBTCC)
|
||||||
$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) $(LINK_LIBTCC)
|
$S$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) $(LINK_LIBTCC)
|
||||||
|
|
||||||
# Cross Tiny C Compilers
|
# Cross Tiny C Compilers
|
||||||
%-tcc$(EXESUF): FORCE
|
%-tcc$(EXESUF): FORCE
|
||||||
@$(MAKE) --no-print-directory $@ CROSS_TARGET=$* ONE_SOURCE=$(or $(ONE_SOURCE),yes)
|
@$(MAKE) --no-print-directory $@ CROSS_TARGET=$* ONE_SOURCE=$(or $(ONE_SOURCE),yes)
|
||||||
|
|
||||||
$(CROSS_TARGET)-tcc$(EXESUF): $(TCC_FILES)
|
$(CROSS_TARGET)-tcc$(EXESUF): $(TCC_FILES)
|
||||||
$(CC) -o $@ $^ $(LIBS) $(LDFLAGS)
|
$S$(CC) -o $@ $^ $(LIBS) $(LDFLAGS)
|
||||||
|
|
||||||
# profiling version
|
# profiling version
|
||||||
tcc_p$(EXESUF): $($T_FILES)
|
tcc_p$(EXESUF): $($T_FILES)
|
||||||
$(CC) -o $@ $< $(DEFINES) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
|
$S$(CC) -o $@ $< $(DEFINES) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
|
||||||
|
|
||||||
# static libtcc library
|
# static libtcc library
|
||||||
libtcc.a: $(LIBTCC_OBJ)
|
libtcc.a: $(LIBTCC_OBJ)
|
||||||
$(AR) rcs $@ $^
|
$S$(AR) rcs $@ $^
|
||||||
|
|
||||||
# dynamic libtcc library
|
# dynamic libtcc library
|
||||||
libtcc.so: $(LIBTCC_OBJ)
|
libtcc.so: $(LIBTCC_OBJ)
|
||||||
$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
|
$S$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
libtcc.so: CFLAGS+=-fPIC
|
libtcc.so: CFLAGS+=-fPIC
|
||||||
libtcc.so: LDFLAGS+=-fPIC
|
libtcc.so: LDFLAGS+=-fPIC
|
||||||
@ -231,12 +241,12 @@ libtcc.dylib: $(LIBTCC_OBJ)
|
|||||||
|
|
||||||
# windows dynamic libtcc library
|
# windows dynamic libtcc library
|
||||||
libtcc.dll : $(LIBTCC_OBJ)
|
libtcc.dll : $(LIBTCC_OBJ)
|
||||||
$(CC) -shared -o $@ $^ $(LDFLAGS)
|
$S$(CC) -shared -o $@ $^ $(LDFLAGS)
|
||||||
libtcc.dll : DEFINES += -DLIBTCC_AS_DLL
|
libtcc.dll : DEFINES += -DLIBTCC_AS_DLL
|
||||||
|
|
||||||
# import file for windows libtcc.dll
|
# import file for windows libtcc.dll
|
||||||
libtcc.def : libtcc.dll tcc$(EXESUF)
|
libtcc.def : libtcc.dll tcc$(EXESUF)
|
||||||
$(XTCC) -impdef $< -o $@
|
$S$(XTCC) -impdef $< -o $@
|
||||||
XTCC ?= ./tcc$(EXESUF)
|
XTCC ?= ./tcc$(EXESUF)
|
||||||
|
|
||||||
# TinyCC runtime libraries
|
# TinyCC runtime libraries
|
||||||
@ -250,18 +260,22 @@ libtcc1.a : tcc$(EXESUF) FORCE
|
|||||||
.PRECIOUS: %-libtcc1.a
|
.PRECIOUS: %-libtcc1.a
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
run-if = $(if $(shell which $1),$S $1 $2)
|
||||||
|
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# documentation and man page
|
# documentation and man page
|
||||||
tcc-doc.html: tcc-doc.texi
|
tcc-doc.html: tcc-doc.texi
|
||||||
makeinfo --no-split --html --number-sections -o $@ $< || true
|
$(call run-if,makeinfo,--no-split --html --number-sections -o $@ $<)
|
||||||
|
|
||||||
tcc.1: tcc-doc.texi
|
|
||||||
$(TOPSRC)/texi2pod.pl $< tcc.pod \
|
|
||||||
&& pod2man --section=1 --center="Tiny C Compiler" --release="$(VERSION)" tcc.pod >tmp.1 \
|
|
||||||
&& mv tmp.1 $@ || rm -f tmp.1
|
|
||||||
|
|
||||||
tcc-doc.info: tcc-doc.texi
|
tcc-doc.info: tcc-doc.texi
|
||||||
makeinfo $< || true
|
$(call run-if,makeinfo,$< || true)
|
||||||
|
|
||||||
|
tcc.1 : tcc-doc.pod
|
||||||
|
$(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \
|
||||||
|
--release="$(VERSION)" $< >$@ && rm -f $<)
|
||||||
|
%.pod : %.texi
|
||||||
|
$(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@)
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# install
|
# install
|
||||||
@ -272,11 +286,13 @@ STRIP_yes = -s
|
|||||||
|
|
||||||
LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS))
|
LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS))
|
||||||
LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(LIBTCC1_CROSS))
|
LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(LIBTCC1_CROSS))
|
||||||
IB = $(if $1,mkdir -p $2 && $(INSTALLBIN) $1 $2)
|
IB = $(if $1,$(IM) mkdir -p $2 && $(INSTALLBIN) $1 $2)
|
||||||
IBw = $(call IB,$(wildcard $1),$2)
|
IBw = $(call IB,$(wildcard $1),$2)
|
||||||
IF = $(if $1,mkdir -p $2 && $(INSTALL) $1 $2)
|
IF = $(if $1,$(IM) mkdir -p $2 && $(INSTALL) $1 $2)
|
||||||
IFw = $(call IF,$(wildcard $1),$2)
|
IFw = $(call IF,$(wildcard $1),$2)
|
||||||
IR = mkdir -p $2 && cp -r $1/. $2
|
IR = $(IM) mkdir -p $2 && cp -r $1/. $2
|
||||||
|
IM = $(info -> $2 : $1)@
|
||||||
|
|
||||||
B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o
|
B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o
|
||||||
|
|
||||||
# install progs & libs
|
# install progs & libs
|
||||||
@ -301,7 +317,7 @@ uninstall-unx:
|
|||||||
@rm -fv "$(libdir)/libtcc.a" "$(libdir)/libtcc.so" "$(includedir)/libtcc.h"
|
@rm -fv "$(libdir)/libtcc.a" "$(libdir)/libtcc.so" "$(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 -r "$(tccdir)"
|
@rm -frv "$(tccdir)"
|
||||||
|
|
||||||
# install progs & libs on windows
|
# install progs & libs on windows
|
||||||
install-win:
|
install-win:
|
||||||
@ -320,17 +336,16 @@ ifneq "$(wildcard $(LIBTCC1_U))" ""
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# the msys-git shell works to configure && make except it does not have install
|
# the msys-git shell works to configure && make except it does not have install
|
||||||
ifeq "$(and $(CONFIG_WIN32),$(shell which install >/dev/null 2>&1 || echo no))" "no"
|
ifeq ($(CONFIG_WIN32)-$(shell which install || echo no),yes-no)
|
||||||
install-win : INSTALL = cp
|
install-win : INSTALL = cp
|
||||||
install-win : INSTALLBIN = cp
|
install-win : INSTALLBIN = cp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# uninstall on windows
|
# uninstall on windows
|
||||||
uninstall-win:
|
uninstall-win:
|
||||||
@rm -fv $(foreach P,$(PROGS) $(PROGS_CROSS) libtcc.dll,"$(bindir)/$P")
|
@rm -fv $(foreach P,libtcc.dll $(PROGS) *-tcc.exe,"$(bindir)/$P")
|
||||||
@rm -fv $(foreach F,tcc-doc.html tcc-win32.txt,"$(docdir)/$F")
|
@rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P"/*)
|
||||||
@rm -fv $(foreach F,libtcc.h libtcc.def libtcc.a,"$(libdir)/$F")
|
@rm -frv $(foreach P,doc examples include lib libtcc,"$(tccdir)/$P")
|
||||||
rm -r "$(tccdir)"
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# other stuff
|
# other stuff
|
||||||
@ -343,8 +358,9 @@ ETAGS : ; etags $(TAGFILES)
|
|||||||
# create release tarball from *current* git branch (including tcc-doc.html
|
# create release tarball from *current* git branch (including tcc-doc.html
|
||||||
# and converting two files to CRLF)
|
# and converting two files to CRLF)
|
||||||
TCC-VERSION = tcc-$(VERSION)
|
TCC-VERSION = tcc-$(VERSION)
|
||||||
|
TCC-VERSION = tinycc-mob-$(shell git rev-parse --short=7 HEAD)
|
||||||
tar: tcc-doc.html
|
tar: tcc-doc.html
|
||||||
mkdir $(TCC-VERSION)
|
mkdir -p $(TCC-VERSION)
|
||||||
( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )
|
( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f )
|
||||||
cp tcc-doc.html $(TCC-VERSION)
|
cp tcc-doc.html $(TCC-VERSION)
|
||||||
for f in tcc-win32.txt build-tcc.bat ; do \
|
for f in tcc-win32.txt build-tcc.bat ; do \
|
||||||
@ -359,22 +375,22 @@ config.mak:
|
|||||||
|
|
||||||
# run all tests
|
# run all tests
|
||||||
test:
|
test:
|
||||||
$(MAKE) -C tests
|
@$(MAKE) -C tests
|
||||||
# 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 $@
|
||||||
|
|
||||||
testspp.%:
|
testspp.%:
|
||||||
$(MAKE) -C tests/pp $@
|
@$(MAKE) -C tests/pp $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f tcc$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tcc.pod
|
@rm -f tcc$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tcc.pod
|
||||||
rm -f *~ *.o *.a *.so* *.out *.log lib*.def *.exe *.dll a.out tags TAGS *.dylib
|
@rm -f *.o *.a *.so* *.out *.log lib*.def *.exe *.dll a.out tags TAGS *.dylib
|
||||||
@$(MAKE) -C lib $@
|
@$(MAKE) -s -C lib $@
|
||||||
@$(MAKE) -C tests $@
|
@$(MAKE) -s -C tests $@
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f config.h config.mak config.texi tcc.1 tcc-doc.info tcc-doc.html
|
@rm -fv config.h config.mak config.texi tcc.1 tcc-doc.info tcc-doc.html
|
||||||
|
|
||||||
.PHONY: all clean test tar tags ETAGS distclean install uninstall FORCE
|
.PHONY: all clean test tar tags ETAGS distclean install uninstall FORCE
|
||||||
|
|
||||||
@ -385,39 +401,37 @@ help:
|
|||||||
@echo "make cross"
|
@echo "make cross"
|
||||||
@echo " build cross compilers (from one source)"
|
@echo " build cross compilers (from one source)"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make ONE_SOURCE=yes / no"
|
@echo "make ONE_SOURCE=no/yes SILENT=no/yes"
|
||||||
@echo " force building from one source / separate objects"
|
@echo " force building from separate/one object(s), less/more silently"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make cross-TARGET"
|
@echo "make cross-TARGET"
|
||||||
@echo " build one specific cross compiler for 'TARGET', as in"
|
@echo " build one specific cross compiler for 'TARGET'. Currently supported:"
|
||||||
@echo " $(TCC_X)"
|
@echo " $(wordlist 1,6,$(TCC_X))"
|
||||||
@echo ""
|
@echo " $(wordlist 7,99,$(TCC_X))"
|
||||||
@echo "Custom configuration:"
|
|
||||||
@echo " The makefile includes a file 'config-extra.mak' if it is present."
|
|
||||||
@echo " This file may contain some custom configuration. For example:"
|
|
||||||
@echo ""
|
|
||||||
@echo " NATIVE_DEFINES += -D..."
|
|
||||||
@echo ""
|
|
||||||
@echo " Or for example to configure the search paths for a cross-compiler"
|
|
||||||
@echo " that expects the linux files in <tccdir>/i386-linux:"
|
|
||||||
@echo ""
|
|
||||||
@echo " ROOT-i386 = {B}/i386-linux"
|
|
||||||
@echo " CRT-i386 = {B}/i386-linux/usr/lib"
|
|
||||||
@echo " LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"
|
|
||||||
@echo " INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"
|
|
||||||
@echo " DEF-i386 += -D__linux__"
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make test"
|
@echo "make test"
|
||||||
@echo " run all tests"
|
@echo " run all tests"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "make tests2.all / make tests2.37 / make tests2.37+"
|
@echo "make tests2.all / 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"
|
||||||
|
@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 ""
|
||||||
@echo "Other supported make targets:"
|
@echo "Other supported make targets:"
|
||||||
@echo " install install-strip tags ETAGS tar clean distclean help"
|
@echo " install install-strip doc clean tags ETAGS tar distclean help"
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@echo "Custom configuration:"
|
||||||
|
@echo " The makefile includes a file 'config-extra.mak' if it is present."
|
||||||
|
@echo " This file may contain some custom configuration. For example:"
|
||||||
|
@echo " NATIVE_DEFINES += -D..."
|
||||||
|
@echo " Or for example to configure the search paths for a cross-compiler"
|
||||||
|
@echo " that expects the linux files in <tccdir>/i386-linux:"
|
||||||
|
@echo " ROOT-i386 = {B}/i386-linux"
|
||||||
|
@echo " CRT-i386 = {B}/i386-linux/usr/lib"
|
||||||
|
@echo " LIB-i386 = {B}/i386-linux/lib:{B}/i386-linux/usr/lib"
|
||||||
|
@echo " INC-i386 = {B}/lib/include:{B}/i386-linux/usr/include"
|
||||||
|
@echo " DEF-i386 += -D__linux__"
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
endif # ($(INCLUDED),no)
|
endif # ($(INCLUDED),no)
|
||||||
|
44
configure
vendored
44
configure
vendored
@ -55,7 +55,7 @@ case $targetos in
|
|||||||
confvars="$confvars OSX"
|
confvars="$confvars OSX"
|
||||||
DLLSUF=".dylib"
|
DLLSUF=".dylib"
|
||||||
;;
|
;;
|
||||||
MINGW*|MSYS*|CYGWIN*)
|
Windows_NT|MINGW*|MSYS*|CYGWIN*)
|
||||||
mingw32=yes
|
mingw32=yes
|
||||||
;;
|
;;
|
||||||
DragonFly|OpenBSD|FreeBSD|NetBSD)
|
DragonFly|OpenBSD|FreeBSD|NetBSD)
|
||||||
@ -135,6 +135,8 @@ for opt do
|
|||||||
;;
|
;;
|
||||||
--strip-binaries) confvars="$confvars strip"
|
--strip-binaries) confvars="$confvars strip"
|
||||||
;;
|
;;
|
||||||
|
--debug) confvars="$confvars strip=no"
|
||||||
|
;;
|
||||||
--with-libgcc) confvars="$confvars libgcc"
|
--with-libgcc) confvars="$confvars libgcc"
|
||||||
;;
|
;;
|
||||||
--with-selinux) confvars="$confvars selinux"
|
--with-selinux) confvars="$confvars selinux"
|
||||||
@ -154,40 +156,9 @@ cc="${cross_prefix}${cc}"
|
|||||||
ar="${cross_prefix}${ar}"
|
ar="${cross_prefix}${ar}"
|
||||||
strip="${cross_prefix}${strip}"
|
strip="${cross_prefix}${strip}"
|
||||||
|
|
||||||
|
|
||||||
PPIF_TEMPLATE="
|
|
||||||
int ppif(void) {
|
|
||||||
#if %s
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
PPIF_FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
"
|
|
||||||
|
|
||||||
# Succeeds when preprocessor condition `#if $1` is true.
|
|
||||||
# if $2 is not empty, prints to stderr `checking whether $2... <yes/no>`
|
|
||||||
# Works also when $cc is a cross compiler to any foreign platform.
|
|
||||||
# E.g. ppif "defined(__GNUC__) && (GCC_MAJOR >= 3)"
|
|
||||||
# or ppif "defined(_WIN32)" "target is Windows"
|
|
||||||
ppif() {
|
|
||||||
[ -z "${2-}" ] || printf "checking whether %s... " "$2" >&2
|
|
||||||
printf "$PPIF_TEMPLATE" "$1" > ppif.c \
|
|
||||||
&& $cc -o ppif.o -c ppif.c 2>/dev/null
|
|
||||||
ppif_rv=$?
|
|
||||||
rm ppif.c ppif.o 2>/dev/null
|
|
||||||
[ -z "${2-}" ] || { [ 0 = $ppif_rv ] && echo yes || echo no; } >&2
|
|
||||||
return $ppif_rv
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if test -z "$cpu" ; then
|
if test -z "$cpu" ; then
|
||||||
if test -n "$ARCH" ; then
|
if test -n "$ARCH" ; then
|
||||||
cpu="$ARCH"
|
cpu="$ARCH"
|
||||||
elif ppif "defined(__x86_64__)"; then
|
|
||||||
cpu="x86_64"
|
|
||||||
elif ppif "defined(__i386__)"; then
|
|
||||||
cpu="i386"
|
|
||||||
else
|
else
|
||||||
cpu=`uname -m`
|
cpu=`uname -m`
|
||||||
fi
|
fi
|
||||||
@ -243,14 +214,14 @@ esac
|
|||||||
|
|
||||||
# Checking for CFLAGS
|
# Checking for CFLAGS
|
||||||
if test -z "$CFLAGS"; then
|
if test -z "$CFLAGS"; then
|
||||||
CFLAGS="-Wall -g -O2"
|
CFLAGS="-Wall -O2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$mingw32" = "yes" ; then
|
if test "$mingw32" = "yes" ; then
|
||||||
if test "$source_path_used" = "no"; then
|
if test "$source_path_used" = "no"; then
|
||||||
source_path="."
|
source_path="."
|
||||||
fi
|
fi
|
||||||
if test "$cc" = gcc; then
|
if test "${cc%% *}" = "gcc"; then
|
||||||
test -z "$LDFLAGS" && LDFLAGS="-static"
|
test -z "$LDFLAGS" && LDFLAGS="-static"
|
||||||
fi
|
fi
|
||||||
test -z "$prefix" && prefix="C:/Program Files/tcc"
|
test -z "$prefix" && prefix="C:/Program Files/tcc"
|
||||||
@ -324,6 +295,7 @@ Advanced options (experts only):
|
|||||||
--extra-ldflags= specify linker options []
|
--extra-ldflags= specify linker options []
|
||||||
--cpu=CPU CPU [$cpu]
|
--cpu=CPU CPU [$cpu]
|
||||||
--strip-binaries strip symbol tables from resulting binaries
|
--strip-binaries strip symbol tables from resulting binaries
|
||||||
|
--debug include debug info with resulting binaries
|
||||||
--disable-static make libtcc.so instead of libtcc.a
|
--disable-static make libtcc.so instead of libtcc.a
|
||||||
--enable-static make libtcc.a instead of libtcc.dll (win32)
|
--enable-static make libtcc.a instead of libtcc.dll (win32)
|
||||||
--disable-rpath disable use of -rpath with the above
|
--disable-rpath disable use of -rpath with the above
|
||||||
@ -519,6 +491,10 @@ if test "$source_path_used" = "yes" ; then
|
|||||||
else
|
else
|
||||||
echo 'TOPSRC=$(TOP)' >>config.mak
|
echo 'TOPSRC=$(TOP)' >>config.mak
|
||||||
fi
|
fi
|
||||||
|
cat >>$TMPH <<EOF
|
||||||
|
#define GCC_MAJOR $gcc_major
|
||||||
|
#define GCC_MINOR $gcc_minor
|
||||||
|
EOF
|
||||||
|
|
||||||
diff $TMPH config.h >/dev/null 2>&1
|
diff $TMPH config.h >/dev/null 2>&1
|
||||||
if test $? -ne 0 ; then
|
if test $? -ne 0 ; then
|
||||||
|
@ -15,6 +15,7 @@ XFLAGS-unx = -B$(TOPSRC)
|
|||||||
XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
XFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include
|
||||||
XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
|
XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
|
||||||
XCFG = $(or $(findstring -win,$T),-unx)
|
XCFG = $(or $(findstring -win,$T),-unx)
|
||||||
|
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
||||||
|
|
||||||
# in order to use gcc, tyoe: make <target>-libtcc1-usegcc=yes
|
# in order to use gcc, tyoe: make <target>-libtcc1-usegcc=yes
|
||||||
arm-libtcc1-usegcc ?= no
|
arm-libtcc1-usegcc ?= no
|
||||||
@ -66,16 +67,16 @@ ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra))
|
|||||||
all: $(ALL)
|
all: $(ALL)
|
||||||
|
|
||||||
$(TOP)/$(X)libtcc1.a : $(OBJ-libtcc1)
|
$(TOP)/$(X)libtcc1.a : $(OBJ-libtcc1)
|
||||||
$(XAR) rcs $@ $^
|
$S$(XAR) rcs $@ $^
|
||||||
|
|
||||||
$(X)%.o : %.c
|
$(X)%.o : %.c
|
||||||
$(XCC) -c $< -o $@ $(XFLAGS)
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
||||||
|
|
||||||
$(X)%.o : %.S
|
$(X)%.o : %.S
|
||||||
$(XCC) -c $< -o $@ $(XFLAGS)
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
||||||
|
|
||||||
$(TOP)/%.o : %.c
|
$(TOP)/%.o : %.c
|
||||||
$(XCC) -c $< -o $@ $(XFLAGS)
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
||||||
|
|
||||||
$(TOP)/bcheck.o : XFLAGS += -g
|
$(TOP)/bcheck.o : XFLAGS += -g
|
||||||
$(TOP)/bt-exe.o : $(TOP)/tccrun.c
|
$(TOP)/bt-exe.o : $(TOP)/tccrun.c
|
||||||
|
2
tcc.c
2
tcc.c
@ -158,6 +158,8 @@ static const char version[] =
|
|||||||
"ARM"
|
"ARM"
|
||||||
#elif defined TCC_TARGET_ARM64
|
#elif defined TCC_TARGET_ARM64
|
||||||
"AArch64"
|
"AArch64"
|
||||||
|
#elif defined TCC_TARGET_RISCV64
|
||||||
|
"riscv64"
|
||||||
#endif
|
#endif
|
||||||
#ifdef TCC_ARM_HARDFLOAT
|
#ifdef TCC_ARM_HARDFLOAT
|
||||||
" Hard Float"
|
" Hard Float"
|
||||||
|
1
tcc.h
1
tcc.h
@ -46,6 +46,7 @@ extern long double strtold (const char *__nptr, char **__endptr);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <io.h> /* open, close etc. */
|
# include <io.h> /* open, close etc. */
|
||||||
# include <direct.h> /* getcwd */
|
# include <direct.h> /* getcwd */
|
||||||
|
@ -23,8 +23,7 @@ TESTS = \
|
|||||||
tests2-dir \
|
tests2-dir \
|
||||||
pp-dir
|
pp-dir
|
||||||
|
|
||||||
BTESTS = btest test2b
|
BTESTS = btest test1b
|
||||||
|
|
||||||
# test4_static -- Not all relocation types are implemented yet.
|
# test4_static -- Not all relocation types are implemented yet.
|
||||||
# asmtest / asmtest2 -- minor differences with gcc
|
# asmtest / asmtest2 -- minor differences with gcc
|
||||||
|
|
||||||
@ -36,9 +35,6 @@ endif
|
|||||||
ifeq ($(ARCH),x86_64)
|
ifeq ($(ARCH),x86_64)
|
||||||
TESTS += $(BTESTS)
|
TESTS += $(BTESTS)
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_WIN32
|
|
||||||
TESTS += $(BTESTS)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_OSX # -run only
|
ifdef CONFIG_OSX # -run only
|
||||||
TESTS := hello-run libtest tests2-dir pp-dir
|
TESTS := hello-run libtest tests2-dir pp-dir
|
||||||
@ -52,12 +48,9 @@ endif
|
|||||||
ifeq (,$(filter i386 x86_64,$(ARCH)))
|
ifeq (,$(filter i386 x86_64,$(ARCH)))
|
||||||
TESTS := $(filter-out dlltest asm-c-connect-test,$(TESTS))
|
TESTS := $(filter-out dlltest asm-c-connect-test,$(TESTS))
|
||||||
endif
|
endif
|
||||||
ifndef CONFIG_cross
|
|
||||||
TESTS := $(filter-out cross-%,$(TESTS))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT) # for libtcc_test to find libtcc.dll
|
ifeq ($(OS),Windows_NT) # for libtcc_test to find libtcc.dll
|
||||||
PATH := $(CURDIR)/$(TOP)$(if $(findstring :\,$(PATH)),;,:)$(PATH)
|
PATH := $(CURDIR)/$(TOP)$(if $(findstring ;,$(PATH)),;,:)$(PATH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ARCH),arm)
|
ifeq ($(ARCH),arm)
|
||||||
@ -75,11 +68,10 @@ endif
|
|||||||
RUN_TCC = $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS)
|
RUN_TCC = $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS)
|
||||||
DISAS = objdump -d
|
DISAS = objdump -d
|
||||||
DUMPTCC = (set -x; $(TOP)/tcc -vv; ldd $(TOP)/tcc; exit 1)
|
DUMPTCC = (set -x; $(TOP)/tcc -vv; ldd $(TOP)/tcc; exit 1)
|
||||||
Q = # >/dev/null 2>&1
|
|
||||||
|
|
||||||
all test :
|
all test :
|
||||||
$(MAKE) clean-s
|
@$(MAKE) --no-print-directory -s clean
|
||||||
$(MAKE) $(TESTS)
|
@$(MAKE) --no-print-directory -s -r $(TESTS)
|
||||||
|
|
||||||
hello-exe: ../examples/ex1.c
|
hello-exe: ../examples/ex1.c
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
@ -93,7 +85,10 @@ libtes%: libtcc_tes%$(EXESUF)
|
|||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
./libtcc_tes$*$(EXESUF) $(TOPSRC)/tcc.c $(TCCFLAGS) $(NATIVE_DEFINES)
|
./libtcc_tes$*$(EXESUF) $(TOPSRC)/tcc.c $(TCCFLAGS) $(NATIVE_DEFINES)
|
||||||
|
|
||||||
libtcc_tes%$(EXESUF): libtcc_tes%.c $(LIBTCC)
|
libtcc_test$(EXESUF): libtcc_test.c $(LIBTCC)
|
||||||
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||||
|
|
||||||
|
libtcc_test_mt$(EXESUF): libtcc_test_mt.c $(LIBTCC)
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||||
|
|
||||||
%-dir:
|
%-dir:
|
||||||
@ -108,19 +103,19 @@ test.ref: tcctest.c
|
|||||||
# auto test
|
# auto test
|
||||||
test1 test1b: tcctest.c test.ref
|
test1 test1b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) -w -run $< > test.out1 $Q
|
$(TCC) $(RUN_TCC) -w -run $< > test.out1
|
||||||
@diff -u test.ref test.out1 && echo "$(AUTO_TEST) OK"
|
@diff -u test.ref test.out1 && echo "$(AUTO_TEST) OK"
|
||||||
|
|
||||||
# iterated test2 (compile tcc then compile tcctest.c !)
|
# iterated test2 (compile tcc then compile tcctest.c !)
|
||||||
test2 test2b: tcctest.c test.ref
|
test2 test2b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) $(RUN_TCC) $(RUN_TCC) -w -run $< > test.out2 $Q
|
$(TCC) $(RUN_TCC) $(RUN_TCC) -w -run $< > test.out2
|
||||||
@diff -u test.ref test.out2 && echo "$(AUTO_TEST)2 OK"
|
@diff -u test.ref test.out2 && echo "$(AUTO_TEST)2 OK"
|
||||||
|
|
||||||
# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
|
# iterated test3 (compile tcc then compile tcc then compile tcctest.c !)
|
||||||
test3 test3b: tcctest.c test.ref
|
test3 test3b: tcctest.c test.ref
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -w -run $< > test.out3 $Q
|
$(TCC) $(RUN_TCC) $(RUN_TCC) $(RUN_TCC) -w -run $< > test.out3
|
||||||
@diff -u test.ref test.out3 && echo "$(AUTO_TEST)3 OK"
|
@diff -u test.ref test.out3 && echo "$(AUTO_TEST)3 OK"
|
||||||
|
|
||||||
AUTO_TEST = Auto Test
|
AUTO_TEST = Auto Test
|
||||||
@ -145,6 +140,7 @@ test4: tcctest.c test.ref
|
|||||||
@if diff -u test.ref test4.out ; then echo "BCheck $(AUTO_TEST) OK"; fi
|
@if diff -u test.ref test4.out ; then echo "BCheck $(AUTO_TEST) OK"; fi
|
||||||
|
|
||||||
test4_static: tcctest.c test.ref
|
test4_static: tcctest.c test.ref
|
||||||
|
@echo ------------ $@ ------------
|
||||||
# static output.
|
# static output.
|
||||||
$(TCC) -static -o tcctest2 $<
|
$(TCC) -static -o tcctest2 $<
|
||||||
./tcctest2 > test2.out
|
./tcctest2 > test2.out
|
||||||
@ -170,6 +166,7 @@ memtest:
|
|||||||
$(CC) $(CFLAGS) $(NATIVE_DEFINES) -DMEM_DEBUG=2 $(TOPSRC)/tcc.c $(LIBS) -o memtest-tcc$(EXESUF)
|
$(CC) $(CFLAGS) $(NATIVE_DEFINES) -DMEM_DEBUG=2 $(TOPSRC)/tcc.c $(LIBS) -o memtest-tcc$(EXESUF)
|
||||||
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c $(LIBS)
|
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) $(TOPSRC)/tcc.c $(LIBS)
|
||||||
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS) -w $(TOPSRC)/tests/tcctest.c
|
./memtest-tcc$(EXESUF) $(TCCFLAGS) $(NATIVE_DEFINES) -run $(TOPSRC)/tcc.c $(TCCFLAGS) -w $(TOPSRC)/tests/tcctest.c
|
||||||
|
@echo OK
|
||||||
|
|
||||||
# memory and bound check auto test
|
# memory and bound check auto test
|
||||||
BOUNDS_OK = 1 4 8 10 14 16
|
BOUNDS_OK = 1 4 8 10 14 16
|
||||||
@ -178,17 +175,17 @@ BOUNDS_FAIL= 2 5 6 7 9 11 12 13 15 17
|
|||||||
btest: boundtest.c
|
btest: boundtest.c
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
@for i in $(BOUNDS_OK); do \
|
@for i in $(BOUNDS_OK); do \
|
||||||
if $(TCC) -b -run $< $$i ; then \
|
if $(TCC) -b -run $< $$i >/dev/null 2>&1 ; then \
|
||||||
echo "- Test $$i succeeded as expected" ; \
|
echo "Test $$i succeeded as expected" ; \
|
||||||
else\
|
else\
|
||||||
echo "- Failed positive test $$i" ; exit 1 ; \
|
echo "Failed positive test $$i" ; exit 1 ; \
|
||||||
fi ;\
|
fi ;\
|
||||||
done ;\
|
done ;\
|
||||||
for i in $(BOUNDS_FAIL); do \
|
for i in $(BOUNDS_FAIL); do \
|
||||||
if $(TCC) -b -bt1 -run $< $$i ; then \
|
if $(TCC) -b -bt1 -run $< $$i >/dev/null 2>&1 ; then \
|
||||||
echo "- Failed negative test $$i" ; exit 1 ;\
|
echo "Failed negative test $$i" ; exit 1 ;\
|
||||||
else\
|
else\
|
||||||
echo "- Test $$i failed as expected" ; \
|
echo "Test $$i failed as expected" ; \
|
||||||
fi ;\
|
fi ;\
|
||||||
done ;\
|
done ;\
|
||||||
echo Bound test OK
|
echo Bound test OK
|
||||||
@ -202,6 +199,7 @@ speedtest: ex2 ex3
|
|||||||
time $(TCC) -run $(TOPSRC)/examples/ex3.c 35
|
time $(TCC) -run $(TOPSRC)/examples/ex3.c 35
|
||||||
|
|
||||||
weaktest: tcctest.c test.ref
|
weaktest: tcctest.c test.ref
|
||||||
|
@echo ------------ $@ ------------
|
||||||
$(TCC) -c $< -o weaktest.tcc.o
|
$(TCC) -c $< -o weaktest.tcc.o
|
||||||
$(CC) -c $< -o weaktest.gcc.o $(NATIVE_DEFINES) $(CFLAGS) -w -O0 -std=gnu99 -fno-omit-frame-pointer
|
$(CC) -c $< -o weaktest.gcc.o $(NATIVE_DEFINES) $(CFLAGS) -w -O0 -std=gnu99 -fno-omit-frame-pointer
|
||||||
objdump -t weaktest.tcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.tcc.o.txt
|
objdump -t weaktest.tcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.tcc.o.txt
|
||||||
@ -227,22 +225,19 @@ asmtest2: MAYBE_RUN_TCC = $(RUN_TCC)
|
|||||||
|
|
||||||
# Check that code generated by libtcc is binary compatible with
|
# Check that code generated by libtcc is binary compatible with
|
||||||
# that generated by CC
|
# that generated by CC
|
||||||
abitest-cc$(EXESUF): abitest.c $(LIBTCC)
|
abitest-cc.exe: abitest.c $(LIBTCC)
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w
|
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w
|
||||||
|
|
||||||
abitest-tcc$(EXESUF): abitest.c libtcc.c
|
abitest-tcc.exe: abitest.c libtcc.c
|
||||||
$(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS)
|
$(TCC) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
ABITESTS := abitest-cc$(EXESUF)
|
abitest-% : abitest-%.exe
|
||||||
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
|
||||||
ABITESTS += abitest-tcc$(EXESUF)
|
|
||||||
endif
|
|
||||||
|
|
||||||
abitest: $(ABITESTS)
|
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
./abitest-cc$(EXESUF) $(TCCFLAGS)
|
./$< $(TCCFLAGS)
|
||||||
|
|
||||||
|
abitest: abitest-cc
|
||||||
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
||||||
./abitest-tcc$(EXESUF) $(TCCFLAGS)
|
abitest: abitest-tcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
vla_test$(EXESUF): vla_test.c
|
vla_test$(EXESUF): vla_test.c
|
||||||
@ -265,22 +260,18 @@ asm-c-connect-test: asm-c-connect$(EXESUF) asm-c-connect-sep$(EXESUF)
|
|||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
./asm-c-connect$(EXESUF) > asm-c-connect.out1 && cat asm-c-connect.out1
|
./asm-c-connect$(EXESUF) > asm-c-connect.out1 && cat asm-c-connect.out1
|
||||||
./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
|
./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
|
||||||
@diff -u asm-c-connect.out1 asm-c-connect.out2 && echo "ok"
|
@diff -u asm-c-connect.out1 asm-c-connect.out2 || (echo "error"; exit 1)
|
||||||
|
|
||||||
|
TCC_YY = $(foreach T,$(TCC_X),$(if $(wildcard $(TOP)/$T-tcc$(EXESUF)),$T))
|
||||||
|
|
||||||
cross-test :
|
cross-test :
|
||||||
|
$(if $(strip $(TCC_YY)),\
|
||||||
|
$(MAKE) $(foreach T,$(TCC_YY),cross-$T.test) --no-print-directory,:)
|
||||||
|
|
||||||
|
cross-%.test :
|
||||||
@echo ------------ $@ ------------
|
@echo ------------ $@ ------------
|
||||||
$(TOP)/i386-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
$(TOP)/$*-tcc$(EXESUF) -v $(TCCFLAGS-$(if $(findstring win,$*),win,unx))\
|
||||||
$(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/examples/ex3.c && echo "ok"
|
-c $(TOPSRC)/examples/ex3.c
|
||||||
$(TOP)/x86_64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/arm-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/arm64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/riscv64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/c67-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok"
|
|
||||||
$(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
|
|
||||||
$(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
|
|
||||||
$(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/win32/examples/hello_win.c && echo "ok"
|
|
||||||
|
|
||||||
# targets for development
|
# targets for development
|
||||||
%.bin: %.c tcc
|
%.bin: %.c tcc
|
||||||
@ -306,6 +297,3 @@ clean:
|
|||||||
@$(MAKE) -C tests2 $@
|
@$(MAKE) -C tests2 $@
|
||||||
@$(MAKE) -C pp $@
|
@$(MAKE) -C pp $@
|
||||||
|
|
||||||
# silent clean, used before running tests
|
|
||||||
clean-s:
|
|
||||||
@$(MAKE) -s --no-print-directory clean
|
|
||||||
|
@ -264,13 +264,13 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
printf("----- libtest : mixed calls -------\n"), fflush(stdout);
|
printf("mixed calls\n "), fflush(stdout);
|
||||||
t = getclock_ms();
|
t = getclock_ms();
|
||||||
state_test();
|
state_test();
|
||||||
printf("\n(%u ms)\n", getclock_ms() - t);
|
printf("\n(%u ms)\n", getclock_ms() - t);
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("----- libtest : threads ------------\n"), fflush(stdout);
|
printf("threads\n "), fflush(stdout);
|
||||||
t = getclock_ms();
|
t = getclock_ms();
|
||||||
for (n = 0; n < M; ++n)
|
for (n = 0; n < M; ++n)
|
||||||
create_thread(thread_test_simple, n);
|
create_thread(thread_test_simple, n);
|
||||||
@ -278,7 +278,7 @@ int main(int argc, char **argv)
|
|||||||
printf("\n(%u ms)\n", getclock_ms() - t);
|
printf("\n(%u ms)\n", getclock_ms() - t);
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("----- libtest : tcc in threads -----\n"), fflush(stdout);
|
printf("tcc in threads\n "), fflush(stdout);
|
||||||
t = getclock_ms();
|
t = getclock_ms();
|
||||||
for (n = 0; n < M; ++n)
|
for (n = 0; n < M; ++n)
|
||||||
create_thread(thread_test_complex, n);
|
create_thread(thread_test_complex, n);
|
||||||
@ -286,7 +286,7 @@ int main(int argc, char **argv)
|
|||||||
printf("\n(%u ms)\n", getclock_ms() - t);
|
printf("\n(%u ms)\n", getclock_ms() - t);
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
printf("----- compilation of tcc -----------\n"), fflush(stdout);
|
printf("compiling tcc 10 times\n"), fflush(stdout);
|
||||||
t = getclock_ms();
|
t = getclock_ms();
|
||||||
time_tcc(10, argv[1]);
|
time_tcc(10, argv[1]);
|
||||||
printf("(%u ms)\n", (getclock_ms() - t) / 10), fflush(stdout);
|
printf("(%u ms)\n", (getclock_ms() - t) / 10), fflush(stdout);
|
||||||
|
@ -2396,7 +2396,11 @@ int fib(int n)
|
|||||||
return fib(n-1) + fib(n-2);
|
return fib(n-1) + fib(n-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__ == 3
|
||||||
|
# define aligned_function 0
|
||||||
|
#else
|
||||||
void __attribute__((aligned(16))) aligned_function(int i) {}
|
void __attribute__((aligned(16))) aligned_function(int i) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
void funcptr_test()
|
void funcptr_test()
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,8 @@ GEN-ALWAYS =
|
|||||||
# 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: $(filter-out $(SKIP),$(TESTS)) ;
|
all test tests2.all: $(filter-out $(SKIP),$(TESTS))
|
||||||
|
@$(MAKE) clean --no-print-directory -s
|
||||||
|
|
||||||
%.test: %.c %.expect
|
%.test: %.c %.expect
|
||||||
@echo Test: $*...
|
@echo Test: $*...
|
||||||
@ -140,5 +141,5 @@ MS-CC = cl
|
|||||||
$(sort $(GEN-ALWAYS) $(UPDATE)) : force
|
$(sort $(GEN-ALWAYS) $(UPDATE)) : force
|
||||||
force:
|
force:
|
||||||
|
|
||||||
clean tests2.clean :
|
clean :
|
||||||
rm -f fred.txt *.output a.exe *.dll *.so *.def $(GEN-ALWAYS)
|
rm -f fred.txt *.output a.exe *.dll *.so *.def $(GEN-ALWAYS)
|
||||||
|
Loading…
Reference in New Issue
Block a user