Correction for dmalloc testability.
[gedcom-parse.git] / Makefile
index 737ba42c068430686d1eb522196773136b0d8875..87673b74dd56cab60bfe4e9a30ebd7c5e3ff5d3f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,43 @@
 # $Id$
 # $Name$
 
-gedcom_parse:  standalone.o lex.gedcom_.o gedcom.tab.o
-       cc standalone.o lex.gedcom_.o gedcom.tab.o -o gedcom_parse
+DMALLOC_CFLAGS=
+DMALLOC_LOADLIBES=
+CFLAGS=-g -W -Wall -pedantic $(DMALLOC_CFLAGS)
+CPPFLAGS=-I ./include
+YFLAGS=--debug --defines
+LFLAGS=-8
+LOADLIBES=$(DMALLOC_LOADLIBES)
+LDFLAGS_GEDCOM=-Lgedcom/.libs
 
-lex.gedcom_.c: gedcom.lex gedcom.tab.h gedcom.h
-       flex -8 -Pgedcom_ gedcom.lex
+all:   ansel_module libgedcom gedcom_parse
 
-gedcom.tab.c gedcom.tab.h:     gedcom.y gedcom.h
-       bison --debug --defines --name-prefix=gedcom_ gedcom.y
+gedcom_parse:  standalone.o
+       $(CC) $(LDFLAGS) $(LDFLAGS_GEDCOM) -lgedcom $^ $(LOADLIBES) $(LDLIBS) -o $@
 
+libgedcom:
+       cd gedcom && $(MAKE) DMALLOC_CFLAGS=$(DMALLOC_CFLAGS) \
+       DMALLOC_LOADLIBES=$(DMALLOC_LOADLIBES)
+
+ansel_module:
+       cd ansel && $(MAKE)
+
+.PHONY:        clean
 clean:
-       rm -f core gedcom_parse *.o lex.gedcom_.c gedcom.tab.* gedcom.output
+       rm -f core gedcom_parse *.o logfile
+       cd gedcom && $(MAKE) clean
+       cd ansel && $(MAKE) clean
+
+# Test of parser
+
+test:  all
+       @export GCONV_PATH=./ansel; \
+       export LD_LIBRARY_PATH=gedcom/.libs; \
+        for file in t/*.ged; do \
+         echo "=== testing $$file"; \
+         ./gedcom_parse -2 $$file; \
+       done
+
+testmem:       DMALLOC_CFLAGS=-DMALLOC
+testmem:       DMALLOC_LOADLIBES=-ldmalloc
+testmem:       clean test