GMKPATH = ..
include $(GMKPATH)/Makefile.config

CFLAGS = -I.. -I../nlib -I../libem -I$(MILTER_INCDIR) $(COPT)
LDFLAGS = $(LDFL) -L.. -L$(MILTER_LIBDIR) -lemfw -lfwall -lci_milter $(AUXLIB)

BINOBJS = nntp-gw nntp-top
TBNOBJS = chkversion
MANOBJS = nntp-gw.8
NGWOBJS = nntp-gw.o
NTPOBJS = nntp-top.o
CKVOBJS = chkversion.o
TABOBJS = command.h list.h ext.h authinfo.h
ALLOBJS = $(CKVOBJS) $(TBNOBJS) $(TABOBJS) $(NGWOBJS) $(NTPOBJS) $(BINOBJS) $(MANOBJS)

all: $(ALLOBJS)

$(NGWOBJS): $(TBNOBJS) $(TABOBJS)

nntp-gw: $(NGWOBJS) ../libemfw.a ../libfwall.a
	$(OFWTKLINK) $(NGWOBJS)
	mv -f nntp-gw nntp-gw.tmp
	./nntp-gw.tmp -check
	mv -f nntp-gw.tmp nntp-gw

nntp-top: $(NTPOBJS) ../libemfw.a 
	$(OFWTKLINK) $(NTPOBJS)

chkversion: $(CKVOBJS) ../libemfw.a
	$(OFWTKLINK) $(CKVOBJS)
	./chkversion

$(TABOBJS): command.tab list.tab ext.tab authinfo.tab
	cat command.tab  |../libem/maketable -h command 60  >command.h
	cat list.tab     |../libem/maketable -h list 20     >list.h
	cat ext.tab      |../libem/maketable -h ext 20      >ext.h
	cat authinfo.tab |../libem/maketable -h authinfo 10 >authinfo.h
