From 802e61bb121077c16e55cbab2f569cca3269c1fe Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 4 Nov 2009 13:44:29 -0800 Subject: Got "make tests" working in separate build directory, with .out files going to local tests/ tree. --- ChangeLog | 14 ++++++++++++++ Makefile | 20 ++++++++++++-------- configure | 4 ---- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2d3b0e5..14cf0b8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-10-22 Kaz Kylheku + + Got "make tests" working in separate build directory, + with .out files going to local tests/ tree. + + * Makefile (depend): Refer to depend.txr and dep.mk + using $top_srcdir; no need for symlinks. + Changed a few more ./txr references to use $(PROG). + (TESTS): Path munging to generate targets with local paths. + (%.ok): Fixed diff logic to compare between .expected file + in $(top_srcdir) and local .out file. + + * configure: Don't generate symlinks for tests and dep.mk. + 2009-10-22 Kaz Kylheku Got "make install" working. diff --git a/Makefile b/Makefile index 5d62c327..129e3288 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ $(PROG): $(OBJS) VPATH := $(top_srcdir) --include dep.mk +-include $(top_srcdir)/dep.mk lex.yy.c: parser.l $(LEX) $(LEX_DBG_FLAGS) $< @@ -55,23 +55,27 @@ distclean: clean rm -f config.make depend: $(PROG) - $(PROG) depend.txr > dep.mk + $(PROG) $(top_srcdir)/depend.txr > $(top_srcdir)/dep.mk -TESTS := $(patsubst %.txr,%.ok,$(shell find tests -name '*.txr' | sort)) +TESTS := $(patsubst $(top_srcdir)/%.txr,./%.ok,\ + $(shell find $(top_srcdir)/tests -name '*.txr' | sort)) + +$(warning $(TESTS)) tests: $(PROG) $(TESTS) @echo "** tests passed!" -tests/001/%: TXR_ARGS := tests/001/data -tests/002/%: TXR_OPTS := -DTESTDIR=tests/002 +tests/001/%: TXR_ARGS := $(top_srcdir)/tests/001/data +tests/002/%: TXR_OPTS := -DTESTDIR=$(top_srcdir)/tests/002 tests/004/%: TXR_ARGS := -a 123 -b -c %.ok: %.txr - ./txr $(TXR_DBG_OPTS) $(TXR_OPTS) $^ $(TXR_ARGS) > $(@:.ok=.out) - diff $(@:.ok=.expected) $(@:.ok=.out) + mkdir -p $(dir $@) + $(PROG) $(TXR_DBG_OPTS) $(TXR_OPTS) $^ $(TXR_ARGS) > $(@:.ok=.out) + diff $(^:.txr=.expected) $(@:.ok=.out) %.expected: %.txr - ./txr $(TXR_OPTS) $^ $(TXR_ARGS) > $@ + $(PROG) $(TXR_OPTS) $^ $(TXR_ARGS) > $@ install: $(PROG) mkdir -p $(install_prefix)$(bindir) diff --git a/configure b/configure index 58753f41..ec6a898b 100755 --- a/configure +++ b/configure @@ -392,10 +392,6 @@ esac if [ "$source_dir" != "." ] ; then printf "symlinking Makefile -> $source_dir/Makefile\n" ln -sf "$source_dir/Makefile" . - printf "symlinking tests -> $source_dir/tests\n" - ln -sf "$source_dir/tests" . - printf "symlinking dep.mk -> $source_dir/dep.mk\n" - ln -sf "$source_dir/dep.mk" . else printf "warning: its recommended to build in a separate directory\n" fi -- cgit v1.2.3