build: revert Makefiles to 0.9.26 state (mostly)
Except - that libtcc1.a is now installed in subdirs i386/ etc. - the support for arm and arm64 - some of the "Darwin" fixes - tests are mosly unchanged Also - removed the "legacy links for cross compilers" (was total mess) - removed "out-of-tree" build support (was broken anyway)
This commit is contained in:
109
tests/Makefile
109
tests/Makefile
@ -4,12 +4,8 @@
|
||||
|
||||
TOP = ..
|
||||
include $(TOP)/Makefile
|
||||
SRCDIR = $(top_srcdir)/tests
|
||||
VPATH = $(SRCDIR) $(top_srcdir)
|
||||
|
||||
# clear CFLAGS and LDFLAGS
|
||||
CFLAGS :=
|
||||
LDFLAGS :=
|
||||
VPATH = $(TOP)/tests $(TOP)
|
||||
CFLAGS = -I$(TOP)
|
||||
|
||||
# what tests to run
|
||||
TESTS = \
|
||||
@ -19,14 +15,11 @@ TESTS = \
|
||||
test3 \
|
||||
abitest \
|
||||
vla_test-run \
|
||||
tests2-dir pp-dir
|
||||
tests2-dir \
|
||||
pp-dir
|
||||
|
||||
BTESTS = test1b test3b btest
|
||||
|
||||
ifdef CONFIG_CROSS
|
||||
TESTS += hello-cross
|
||||
endif
|
||||
|
||||
# test4 -- problem with -static
|
||||
# asmtest -- minor differences with gcc
|
||||
# btest -- works on i386 (including win32)
|
||||
@ -48,62 +41,40 @@ ifeq ($(CONFIG_arm_eabi),yes)
|
||||
TESTS := $(filter-out test3,$(TESTS))
|
||||
endif
|
||||
|
||||
ifdef DISABLE_STATIC
|
||||
export LD_LIBRARY_PATH:=$(CURDIR)/..
|
||||
endif
|
||||
|
||||
ifeq ($(TARGETOS),Darwin)
|
||||
CFLAGS+=-Wl,-flat_namespace,-undefined,warning
|
||||
export MACOSX_DEPLOYMENT_TARGET:=10.2
|
||||
NATIVE_DEFINES+=-D_ANSI_SOURCE
|
||||
endif
|
||||
|
||||
# run local version of tcc with local libraries and includes
|
||||
TCCFLAGS = -B$(TOP) -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include -L$(TOP)
|
||||
TCCFLAGS = -B$(TOP) -I$(TOP)
|
||||
ifdef CONFIG_WIN32
|
||||
TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir) -I$(top_srcdir)/include -L$(TOP)
|
||||
TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP)
|
||||
PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll
|
||||
endif
|
||||
XTCCFLAGS = -B$(TOP) -B$(top_srcdir)/win32 -I$(TOP) -I$(top_srcdir) -I$(top_srcdir)/include
|
||||
|
||||
TCC = $(TOP)/tcc $(TCCFLAGS)
|
||||
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(top_srcdir)/tcc.c $(TCCFLAGS)
|
||||
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS)
|
||||
|
||||
ifeq ($(TARGETOS),Darwin)
|
||||
CFLAGS += -Wl,-flat_namespace,-undefined,warning
|
||||
TCCFLAGS += -D_ANSI_SOURCE
|
||||
export MACOSX_DEPLOYMENT_TARGET:=10.2
|
||||
endif
|
||||
|
||||
DISAS = objdump -d
|
||||
|
||||
# libtcc test
|
||||
ifdef LIBTCC1
|
||||
ifdef CONFIG_WIN32
|
||||
LIBTCC1:=$(TOP)/win32/libtcc/libtcc.a
|
||||
else
|
||||
LIBTCC1:=$(TOP)/$(LIBTCC1)
|
||||
endif
|
||||
endif
|
||||
|
||||
all test : $(TESTS)
|
||||
all test : clean-s $(TESTS)
|
||||
|
||||
hello-exe: ../examples/ex1.c
|
||||
@echo ------------ $@ ------------
|
||||
$(TCC) $< -o hello$(EXESUF) || ($(TOP)/tcc -vv; exit 1) && ./hello$(EXESUF)
|
||||
|
||||
hello-cross: ../examples/ex1.c
|
||||
@echo ------------ $@ ------------
|
||||
for XTCC in $(PROGS_CROSS) ; \
|
||||
do echo -n "Test of $$XTCC... "; \
|
||||
out=$$($(TOP)/$$XTCC $(XTCCFLAGS) -c $< 2>&1); \
|
||||
test $$? -ne 0 && { echo "Failed\n$$out\n" ; $(TOP)/$$XTCC -vv; exit 1; } ; \
|
||||
echo "Success"; \
|
||||
done
|
||||
|
||||
hello-run: ../examples/ex1.c
|
||||
@echo ------------ $@ ------------
|
||||
$(TCC) -run $<
|
||||
|
||||
libtest: libtcc_test$(EXESUF) $(LIBTCC1)
|
||||
libtest: libtcc_test$(EXESUF)
|
||||
@echo ------------ $@ ------------
|
||||
./libtcc_test$(EXESUF) $(TCCFLAGS)
|
||||
|
||||
libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
|
||||
$(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
||||
libtcc_test$(EXESUF): libtcc_test.c $(LIBTCC)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
%-dir:
|
||||
@echo ------------ $@ ------------
|
||||
@ -111,8 +82,8 @@ libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
|
||||
|
||||
# test.ref - generate using cc
|
||||
test.ref: tcctest.c
|
||||
$(CC) -o tcctest.cc $< -I$(top_srcdir) $(CPPFLAGS) -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99 -O0 -fno-omit-frame-pointer $(LDFLAGS)
|
||||
./tcctest.cc > $@
|
||||
$(CC) -o tcctest.gcc $< $(NATIVE_DEFINES) $(CFLAGS) -w -O0 -std=gnu99 -fno-omit-frame-pointer
|
||||
./tcctest.gcc > $@
|
||||
|
||||
# auto test
|
||||
test1 test1b: tcctest.c test.ref
|
||||
@ -183,19 +154,19 @@ btest: boundtest.c
|
||||
speedtest: ex2 ex3
|
||||
@echo ------------ $@ ------------
|
||||
time ./ex2 1238 2 3 4 10 13 4
|
||||
time $(TCC) -run $(top_srcdir)/examples/ex2.c 1238 2 3 4 10 13 4
|
||||
time $(TCC) -run $(TOP)/examples/ex2.c 1238 2 3 4 10 13 4
|
||||
time ./ex3 35
|
||||
time $(TCC) -run $(top_srcdir)/examples/ex3.c 35
|
||||
time $(TCC) -run $(TOP)/examples/ex3.c 35
|
||||
|
||||
weaktest: tcctest.c test.ref
|
||||
$(TCC) -c $< -o weaktest.tcc.o $(CPPFLAGS) $(CFLAGS)
|
||||
$(CC) -c $< -o weaktest.cc.o -I. $(CPPFLAGS) -w $(CFLAGS)
|
||||
$(TCC) -c $< -o weaktest.tcc.o
|
||||
$(CC) -c $< -o weaktest.gcc.o -I. $(CFLAGS)
|
||||
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.cc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.cc.o.txt
|
||||
diff weaktest.cc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK"
|
||||
objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt
|
||||
diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK"
|
||||
|
||||
ex%: $(top_srcdir)/examples/ex%.c
|
||||
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
|
||||
ex%: $(TOP)/examples/ex%.c
|
||||
$(CC) -o $@ $< $(CFLAGS)
|
||||
|
||||
# tiny assembler testing
|
||||
asmtest.ref: asmtest.S
|
||||
@ -210,24 +181,27 @@ asmtest: asmtest.ref
|
||||
|
||||
# Check that code generated by libtcc is binary compatible with
|
||||
# that generated by CC
|
||||
abitest-cc$(EXESUF): abitest.c $(top_builddir)/$(LIBTCC)
|
||||
$(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS) -I$(top_srcdir)
|
||||
abitest-cc$(EXESUF): abitest.c $(LIBTCC)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) -w
|
||||
|
||||
abitest-tcc$(EXESUF): abitest.c libtcc.c
|
||||
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) -DONE_SOURCE $(LIBS) $(LDFLAGS) -I$(top_srcdir)
|
||||
$(TCC) -o $@ $^ $(NATIVE_DEFINES) -DONE_SOURCE $(LIBS)
|
||||
|
||||
ABITESTS := abitest-cc$(EXESUF)
|
||||
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
||||
ABITESTS += abitest-tcc$(EXESUF)
|
||||
ABITESTS += abitest-tcc$(EXESUF)
|
||||
endif
|
||||
|
||||
abitest: $(ABITESTS)
|
||||
@echo ------------ $@ ------------
|
||||
./abitest-cc$(EXESUF) $(TCCFLAGS)
|
||||
if [ "$(CONFIG_arm_eabi)" != "yes" ]; then ./abitest-tcc$(EXESUF) $(TCCFLAGS); fi
|
||||
ifneq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
||||
./abitest-tcc$(EXESUF) $(TCCFLAGS)
|
||||
endif
|
||||
|
||||
vla_test$(EXESUF): vla_test.c
|
||||
$(TCC) -o $@ $^ $(CPPFLAGS) $(CFLAGS)
|
||||
$(TCC) -o $@ $^
|
||||
|
||||
vla_test-run: vla_test$(EXESUF)
|
||||
@echo ------------ $@ ------------
|
||||
./vla_test$(EXESUF)
|
||||
@ -249,8 +223,11 @@ cache: tcc_g
|
||||
|
||||
# clean
|
||||
clean:
|
||||
rm -f *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.cc *.gcc \
|
||||
*-cc *-gcc *-tcc *.exe hello libtcc_test vla_test tcctest[1234] ex? tcc_g
|
||||
$(MAKE) -C tests2 $@
|
||||
$(MAKE) -C pp $@
|
||||
rm -vf *~ *.o *.a *.bin *.i *.ref *.out *.out? *.out?b *.cc \
|
||||
*-cc *-tcc *.exe \
|
||||
hello libtcc_test vla_test tcctest[1234] ex? tcc_g
|
||||
|
||||
# silent clean, used before running tests
|
||||
clean-s:
|
||||
@$(MAKE) -s --no-print-directory clean
|
||||
|
||||
Reference in New Issue
Block a user