NOMAN   = true
OBJS    = parser.o scanner.o \
	  scanner.o parser.o fwset.o fwent.o \
	  print.o
LDADD   = -lfl
PROGS    = gatekeeper ipfw fwlint
LIB	= gate.a

all: $(PROGS)

.c.o:	parser.h policies.h

gatekeeper: gatekeeper.o permissions.o message.o $(LIB)

scanner.c: scanner.l parser.h
	lex -l -i $(DEBUG) scanner.l
	mv lex.yy.c scanner.c

parser.h parser.c: parser.y
	yacc -vd parser.y
	mv y.tab.c parser.c
	mv y.tab.h parser.h

$(LIB):	$(OBJS)
	rm -f $(LIB)
	ar crv $(LIB) $(OBJS)
	ranlib $(LIB)

ipfw:	ipfw.o $(LIB)
	$(CC) $(CFLAGS) -o ipfw ipfw.o $(LIB)

fwlint: fwlint.c $(LIB)
	$(CC) $(CFLAGS) -DTEST -o fwlint fwlint.c $(LIB)

clean:
	rm -f $(OBJS) $(LIB)
	rm -f *.o parser.c parser.h scanner.c
	rm -f $(PROGS)

install: $(PROGS)
	install -c -s $(PROGS) /sbin
	install -c gatekeeper.cf /etc
