#
#	$Id: GNUmakefile,v 1.9 1996/12/21 18:04:20 lf Exp $
#
#	Authors:
#	 Pedro Roque		<roque@di.fc.ul.pt>
#	 Lars Fenneberg		<lf@elemental.net>	 
#
#	This software is Copyright 1996 by the above mentioned author(s), 
#	All Rights Reserved.
#
#	The license which is distributed with this software in the file COPYRIGHT
#	applies to this software. If your distribution is missing this file, you
#	may request one from <lf@elemental.net>.
#
#

include GNUmakefile.config

HDRS=radvd.h defaults.h pathnames.h

RADVD_SRCS=radvd.c timer.c log.c device.c linklocal.c socket.c send.c \
	process.c recv.c util.c interface.c
RADVD_OBJS=$(RADVD_SRCS:.c=.o) gram.tab.o lex.yy.o

RADVDUMP_SRCS=radvdump.c log.c socket.c recv.c util.c
RADVDUMP_OBJS=$(RADVDUMP_SRCS:.c=.o)

MANS_IN=radvd.8.in radvd.conf.5.in
MANS=radvd.8 radvd.conf.5

all: radvd radvdump $(MANS)

radvd: $(RADVD_OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(FLEXLIB)

radvdump: $(RADVDUMP_OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

clean:
	$(RM) $(RADVD_OBJS) $(RADVDUMP_OBJS) radvd radvdump $(MANS) *~ *.bak core

realclean: clean
	$(RM) lex.yy.c gram.tab.c gram.tab.h

install: all
	$(INSTALL) -m 755 radvd $(DESTDIR)/sbin/$(IN)radvd
	$(INSTALL) -m 755 radvdump $(DESTDIR)/sbin/radvdump
	$(INSTALL) -m 644 radvd.8 $(DESTDIR)/man/man8/$(IN)radvd.8
	$(INSTALL) -m 644 radvd.conf.5 $(DESTDIR)/man/man5/radvd.conf.5

dist:   ci co gram.tab.c gram.tab.h lex.yy.c clean
	cd ..;\
	$(LN) -s radvd radvd-$(VERSION);\
	$(TAR) -V "radvd v$(VERSION) (`$(DATE)`)" \
	 --exclude RCS --exclude expr \
	 -czhvvf radvd-$(VERSION).tar.gz radvd-$(VERSION);\
	$(RM) radvd-$(VERSION)

ci:
	-$(CI) $(CIFLAGS) GNUmakefile GNUmakefile.config $(RADVD_SRCS) $(HDRS) \
		radvdump.c scanner.l gram.y $(MANS_IN) README CHANGES INTRO \
		TODO

co:
	-$(CO) $(COFLAGS) GNUmakefile GNUmakefile.config $(RADVD_SRCS) $(HDRS) \
		radvdump.c scanner.l gram.y $(MANS_IN) README CHANGES INTRO \
		TODO

lex.yy.c: scanner.l
	$(FLEX) $^

gram.tab.c gram.tab.h: gram.y
	$(BISON) --defines $^

# DO NOT DELETE

device.o: radvd.h defaults.h
gram.tab.o: radvd.h defaults.h
interface.o: radvd.h defaults.h
lex.yy.o: radvd.h gram.tab.h
linklocal.o: radvd.h pathnames.h
log.o: radvd.h
process.o: radvd.h
radvd.o: radvd.h pathnames.h
radvdump.o: radvd.h pathnames.h
recv.o: radvd.h
send.o: radvd.h
socket.o: radvd.h
timer.o: radvd.h
util.o: radvd.h
