OBJS = freemarc.o
SRCS = freemarc.c
CPPFLAGS = -I../../../include -I../include -I.

CC = gcc -g $(WARN)
WARN = -W -Wpointer-arith -Wcast-qual -Wswitch $$W
#CCFLAGS = -Wall -g

all: $(OBJS)
	(cd ISO_2709; $(MAKE) $(MFLAGS) CC='$(CC)')
	(cd marctext; $(MAKE) $(MFLAGS) CC='$(CC)')

depend:
	makedepend -s "# DO NOT DELETE" -- $(CPPFLAGS) -- $(SRCS)
	(cd ISO_2709; $(MAKE) $(MFLAGS) depend)
	(cd marctext; $(MAKE) $(MFLAGS) depend)

clean:
	(cd ISO_2709; $(MAKE) $(MFLAGS) clean)
	(cd marctext; $(MAKE) $(MFLAGS) clean)
	rm -f *.[ao] *~ core *.log a.out *.bak

proto: proto.h
	rm -f ../include/marcproto.h
	cat proto.h ISO_2709/proto.h marctext/proto.h >../include/marcproto.h

proto.h: $(SRCS)
	cextract +Ap -o proto.h $(CPPFLAGS) $(SRCS)
	(cd ISO_2709; $(MAKE) $(MFLAGS) proto)
	(cd marctext; $(MAKE) $(MFLAGS) proto)

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

# DO NOT DELETE

freemarc.o: /usr/include/malloc.h marc.h ../include/config.h
freemarc.o: ../../../include/sr-general.h ../../../include/ansidef.h
freemarc.o: ../../../include/sr-logger.h /usr/include/stdio.h
freemarc.o: ../../../include/sr-oid.h ../include/marcproto.h
