diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | Makefile | 17 | ||||
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | dep.mk | 19 | ||||
-rw-r--r-- | depend.txr | 8 |
5 files changed, 47 insertions, 16 deletions
@@ -1,5 +1,20 @@ 2009-10-22 Kaz Kylheku <kkylheku@gmail.com> + Got build to work in separate build directory. + + * Makefile (CFLAGS): Added -I flag to point header inclusion to the + source directory. + (PROG): New variable to hold program name. + (VPATH): Variable set, as a quick and dirty way to get GNU make + to find the prerequisites back in the source directory. + * configure: Added steps to symlink the tests directory and dep.mk. + * depend.txr: Modified to generate the dependencies with + correct references to the top_srcdir, with the exception of + locally generated headers. + * dep.mk: Regenerated. + +2009-10-22 Kaz Kylheku <kkylheku@gmail.com> + Build configuration via configure script, with cross compiling support. (Tested by cross-compiling txr on an x86 GNU/Linux system to run on a MIPS-based GNU/Linux system). @@ -28,12 +28,17 @@ -include config.make -CFLAGS := $(LANG_FLAGS) $(DIAG_FLAGS) $(OPT_FLAGS) $(DBG_FLAGS) +CFLAGS := -I$(top_srcdir) $(LANG_FLAGS) $(DIAG_FLAGS) $(OPT_FLAGS) $(DBG_FLAGS) OBJS := txr.o lex.yy.o y.tab.o match.o lib.o regex.o gc.o unwind.o stream.o -txr: $(OBJS) + +PROG := ./txr + +$(PROG): $(OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LEXLIB) +VPATH := $(top_srcdir) + -include dep.mk lex.yy.c: parser.l @@ -43,18 +48,18 @@ y.tab.c y.tab.h: parser.y if $(YACC) -v -d $< ; then true ; else rm $@ ; false ; fi clean: - rm -f txr $(OBJS) \ + rm -f $(PROG) $(OBJS) \ y.tab.c lex.yy.c y.tab.h y.output $(TESTS:.ok=.out) distclean: clean rm -f config.make -depend: txr - ./txr depend.txr > dep.mk +depend: $(PROG) + $(PROG) depend.txr > dep.mk TESTS := $(patsubst %.txr,%.ok,$(shell find tests -name '*.txr' | sort)) -tests: txr $(TESTS) +tests: $(PROG) $(TESTS) @echo "** tests passed!" tests/001/%: TXR_ARGS := tests/001/data @@ -382,6 +382,10 @@ 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 @@ -1,9 +1,10 @@ -lib.o: lib.h gc.h unwind.h stream.h -lex.yy.o: y.tab.h lib.h gc.h stream.h parser.h -regex.o: lib.h unwind.h regex.h -y.tab.o: lib.h regex.h parser.h -unwind.o: lib.h gc.h stream.h txr.h unwind.h -txr.o: lib.h stream.h gc.h unwind.h parser.h match.h txr.h -match.o: lib.h gc.h unwind.h regex.h stream.h parser.h txr.h match.h -stream.o: lib.h gc.h unwind.h stream.h -gc.o: lib.h stream.h txr.h gc.h +parser.tab.o: $(top_srcdir)/lib.h $(top_srcdir)/regex.h $(top_srcdir)/parser.h +lib.o: $(top_srcdir)/lib.h $(top_srcdir)/gc.h $(top_srcdir)/unwind.h $(top_srcdir)/stream.h +lex.yy.o: y.tab.h $(top_srcdir)/lib.h $(top_srcdir)/gc.h $(top_srcdir)/stream.h $(top_srcdir)/parser.h +regex.o: $(top_srcdir)/lib.h $(top_srcdir)/unwind.h $(top_srcdir)/regex.h +y.tab.o: $(top_srcdir)/lib.h $(top_srcdir)/regex.h $(top_srcdir)/parser.h +unwind.o: $(top_srcdir)/lib.h $(top_srcdir)/gc.h $(top_srcdir)/stream.h $(top_srcdir)/txr.h $(top_srcdir)/unwind.h +txr.o: $(top_srcdir)/lib.h $(top_srcdir)/stream.h $(top_srcdir)/gc.h $(top_srcdir)/unwind.h $(top_srcdir)/parser.h $(top_srcdir)/match.h $(top_srcdir)/txr.h +match.o: $(top_srcdir)/lib.h $(top_srcdir)/gc.h $(top_srcdir)/unwind.h $(top_srcdir)/regex.h $(top_srcdir)/stream.h $(top_srcdir)/parser.h $(top_srcdir)/txr.h $(top_srcdir)/match.h +stream.o: $(top_srcdir)/lib.h $(top_srcdir)/gc.h $(top_srcdir)/unwind.h $(top_srcdir)/stream.h +gc.o: $(top_srcdir)/lib.h $(top_srcdir)/stream.h $(top_srcdir)/txr.h $(top_srcdir)/gc.h @@ -3,7 +3,13 @@ @file.c @(next)@file.c @(collect) -#include "@header" +#include "@hdr" +@(cases) +@(bind hdr ("y.tab.h")) +@(bind header hdr) +@(or) +@(bind header `$(top_srcdir)/@hdr`) +@(end) @(end) @(output) @file.o:@(rep) @header@(end) |