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

CFLAGS = -I.. $(COPT) -I$(MAGIC_INCDIR)
LDFLAGS = $(LDFL) -L.. -lm $(AUXLIB)

TB1OBJS = syslogchk structchk
TB2OBJS = maketable
LIBOBJS = ../libfwall.a
MANOBJS = man/cfg_append.3 man/daemonize.3 man/isalldigits.3 man/mapuid.3 	\
          man/str_to_port.3 man/cfg_free.3 man/do_daemon.3 man/lock_fd.3	\
          man/nacasematch.3 man/waitwaitwait.3 man/cfg_get.3 man/enargv.3	\
          man/locktest_fd.3 man/namatch.3 man/xmalloc.3 man/cfg_read.3		\
          man/getpassword.3 man/lockun_fd.3 man/peername.3 man/xrealloc.3	\
          man/cfg_setpfile.3 man/hostmatch.3 man/mapgid.3 man/randomnumber.3	\
          man/xstrdup.3 man/conn_server.3 man/hup_exit.3 man/maphostname.3 	\
          man/set_oob_notification.3 man/netperm-table.5
LFWOBJS = namatch.o misc.o cfg.o list.o sysapi.o				\
          enargv.o authio.o							\
          $(MISSING) $(SYSLOG) $(SYSVOBJ) $(STRERROR) $(INETADDR)		\
          gen2api.o cfg2.o transparency.o hash.o randomname.o tunnel.o soio.o 	\
          newiostub.o
SLCOBJS = syslogchk.o
STCOBJS = structchk.o
MTLOBJS = maketable.o
ALLOBJS = $(STCOBJS) $(SLCOBJS) $(TB1OBJS) $(LFWOBJS) $(LIBOBJS) $(MTLOBJS) $(TB2OBJS) $(MANOBJS)

all: $(ALLOBJS)

$(LFWOBJS): $(TB1OBJS)

$(MTLOBJS): $(LIBOBJS)

../libfwall.a: $(LFWOBJS)
	$(OFWTKAR)

maketable: $(MTLOBJS) $(LIBOBJS) 
	$(OFWTKLINK) $(MTLOBJS) $(LIBOBJS)

structchk: $(STCOBJS)
	$(OFWTKLINK) $(STCOBJS)
	./structchk

syslogchk: $(SLCOBJS)
	$(OFWTKLINK) $(SLCOBJS)
	./syslogchk

$(MISSING):
	$(CC) $(CFLAGS) -c missing/$(@:.o=.c)
