aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-12-14 17:18:03 +0100
committerAkim Demaille <akim@lrde.epita.fr>2012-12-18 10:06:20 +0100
commit3f09b90d211a86c1d002a786a5ffc34b72fba780 (patch)
tree83cf6a8b7031af509712a70ff92f69a4366e0861 /tests
parentd815896d4c07acbf12ca4b57b2ad530d85147de4 (diff)
downloadtinycc-3f09b90d211a86c1d002a786a5ffc34b72fba780.tar.gz
tinycc-3f09b90d211a86c1d002a786a5ffc34b72fba780.tar.bz2
build: fix VPATH builds
* configure (fn_dirname): New. Use it to ensure the creation of proper symlinks to Makefiles. (config.mak): Define top_builddir and top_srcdir. (CPPFLAGS): Be sure to find the headers. * Makefile, lib/Makefile, tests/Makefile, tests2/Makefile: Adjust to set VPATH properly. Fix confusion between top_builddir and top_srcdir.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 116178f..c183342 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -4,6 +4,7 @@
TOP = ..
include $(TOP)/Makefile
+VPATH = $(top_srcdir)/tests
# what tests to run
TESTS = libtest \
@@ -56,7 +57,7 @@ endif
# run local version of tcc with local libraries and includes
TCC = ../tcc -B.. $(NATIVE_DEFINES)
ifdef CONFIG_WIN32
- TCC := $(TCC) -I $(TOP)/win32/include -L$(TOP)
+ TCC := $(TCC) -I $(top_srcdir)/win32/include -L$(top_build)
endif
RUN_TCC = $(NATIVE_DEFINES) -run -DONE_SOURCE ../tcc.c -B..
DISAS=objdump -d
@@ -77,8 +78,8 @@ libtest: libtcc_test$(EXESUF) $(LIBTCC1)
@echo ------------ $@ ------------
./libtcc_test$(EXESUF) lib_path=..
-libtcc_test$(EXESUF): libtcc_test.c ../$(LIBTCC)
- $(CC) -o $@ $^ -I.. $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)
+libtcc_test$(EXESUF): libtcc_test.c $(top_builddir)/$(LIBTCC)
+ $(CC) -o $@ $^ $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)
# test.ref - generate using gcc
# copy only tcclib.h so GCC's stddef and stdarg will be used
@@ -169,9 +170,9 @@ btest: boundtest.c ../bcheck.o
speedtest: ex2 ex3
@echo ------------ $@ ------------
time ./ex2 1238 2 3 4 10 13 4
- time $(TCC) -run ../examples/ex2.c 1238 2 3 4 10 13 4
+ time $(TCC) -run $(top_srcdir)/examples/ex2.c 1238 2 3 4 10 13 4
time ./ex3 35
- time $(TCC) -run ../examples/ex3.c 35
+ time $(TCC) -run $(top_srcdir)/examples/ex3.c 35
weaktest: test.ref
$(TCC) -c tcctest.c -o weaktest.tcc.o $(CPPFLAGS) $(CFLAGS)
@@ -180,7 +181,7 @@ weaktest: test.ref
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%: ../examples/ex%.c
+ex%: $(top_srcdir)/examples/ex%.c
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
# tiny assembler testing