TOPDIR = ..
include $(TOPDIR)/MakeVars
include $(TOPDIR)/Makerules

SUBDIRS = $(PARSER)
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)

all: subdir filing.o

subdir: 
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i);)

filing.o: $(OBJS) $(PARSER)/$(PARSER).o
	$(RM) filing.o
	$(LD) -r -o filing.o $(OBJS) $(PARSER)/$(PARSER).o

tags: 
	cd $(PARSER); $(MAKE) tags
	ln -sf $(TOPDIR)/TAGS TAGS
	etags -a -o TAGS $(SRCS)

dep depend:
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i) dep;)
	$(DEPEND) $(SRCS) > .depend

clean:
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i) clean;)
	$(RM) *.o

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif

