# Change the following to specify the desired output language
# Currently only ENGLISH is supported.
LANGUAGE= ENGLISH

# You must use an ANSI C compiler (like gcc)
CC= gcc
CFLAGS= -D${LANGUAGE} -g -DHAVE_FGETLN -DHAVE_STRDUP

SRCS=main.c read.c database.c index.c output.c tags.c nstrdup.c
OBJS=main.o read.o database.o index.o output.o tags.o nstrdup.o
HDRS=database.h index.h node.h output.h read.h tags.h

ged2html: ${OBJS}
	${CC} ${CFLAGS} -o ged2html ${OBJS}

main.o: main.c node.h read.h database.h output.h tags.h
	${CC} ${CFLAGS} -c main.c

read.o: read.c node.h read.h tags.h
	${CC} ${CFLAGS} -c read.c

database.o: database.c node.h database.h index.h tags.h
	${CC} ${CFLAGS} -c database.c

index.o: index.c index.h
	${CC} ${CFLAGS} -c index.c

output.o: output.c tags.h node.h database.h output.h
	${CC} ${CFLAGS} -c output.c

tags.o: tags.c tags.h
	${CC} ${CFLAGS} -c tags.c

nstrdup.o: nstrdup.c
	${CC} ${CFLAGS} -c nstrdup.c

clean:
	rm  -f ged2html *.o *~ #*

indiv.tpl: ged2html
	./ged2html -t - > indiv.tpl

index.tpl: ged2html
	./ged2html -T - > index.tpl

surname.tpl: ged2html
	./ged2html -S - > surname.tpl

release: COPYRIGHT README OPTIONS MSDOS \
		indiv.tpl index.tpl surname.tpl \
		Makefile ${HDRS} ${SRCS} \
		g2hdos.mak g2hwin.mak g2hdos.exe g2hwin.exe \
		royal92.ged
	tar cfz release.tar.gz \
		COPYRIGHT README OPTIONS MSDOS \
		indiv.tpl index.tpl surname.tpl \
		Makefile ${HDRS} ${SRCS} \
		g2hdos.mak g2hwin.mak g2hdos.exe g2hwin.exe \
		royal92.ged
	zip release.zip \
		COPYRIGHT README OPTIONS MSDOS \
		indiv.tpl index.tpl surname.tpl \
		Makefile ${HDRS} ${SRCS} \
		g2hdos.mak g2hwin.mak g2hdos.exe g2hwin.exe \
		royal92.ged
