150476Speter# $FreeBSD$
23229Spst#
33229Spst# Makefile for the BOOTP programs:
43229Spst#   bootpd	- BOOTP server daemon
53229Spst#   bootpef	- BOOTP extension file builder
63229Spst#   bootpgw	- BOOTP gateway daemon
73229Spst#   bootptest	- BOOTP tester (client)
83229Spst#
93229Spst
103229Spst# OPTion DEFinitions:
113229Spst# Remove the -DVEND_CMU if you don't wish to support the "CMU vendor format"
123229Spst# in addition to the RFC1048 format.  Leaving out DEBUG saves little.
133229SpstOPTDEFS= -DSYSLOG -DVEND_CMU -DDEBUG
143229Spst
153229Spst# Uncomment and edit this to choose the facility code used for syslog.
163229Spst# LOG_FACILITY= "-DLOG_BOOTP=LOG_LOCAL2"
173229Spst
183229Spst# SYStem DEFinitions:
193229Spst# Either uncomment some of the following, or do:
203229Spst#	"make sunos4"	(or "make sunos5", etc.)
213229Spst# SYSDEFS= -DSUNOS -DETC_ETHERS
223229Spst# SYSDEFS= -DSVR4
233229Spst# SYSLIBS= -lsocket -lnsl
243229Spst
253229Spst# Uncomment this if your system does not provide streror(3)
263229Spst# STRERROR=strerror.o
273229Spst
283229Spst# FILE DEFinitions:
293229Spst# The next few lines may be uncommented and changed to alter the default
303229Spst# filenames bootpd uses for its configuration and dump files.
313229Spst#CONFFILE= -DCONFIG_FILE=\"/usr/etc/bootptab\"
323229Spst#DUMPFILE= -DDUMPTAB_FILE=\"/usr/etc/bootpd.dump\"
333229Spst#FILEDEFS= $(CONFFILE) $(DUMPFILE)
343229Spst
353229Spst# MORE DEFinitions (whatever you might want to add)
363229Spst# One might define NDEBUG (to remove "assert()" checks).
373229SpstMOREDEFS=
383229Spst
393229SpstINSTALL=/usr/bin/install
403229SpstDESTDIR=
413229SpstBINDIR=/usr/etc
423229SpstMANDIR=/usr/local/man
433229Spst
443229SpstCFLAGS= $(OPTDEFS) $(SYSDEFS) $(FILEDEFS) $(MOREDEFS)
453229SpstPROGS= bootpd bootpef bootpgw bootptest
463229SpstTESTS= trylook trygetif trygetea
473229Spst
4813572Spstall: $(PROGS) $(TESTS)
493229Spst
503229Spstsystem: install
513229Spst
523229Spstinstall: $(PROGS)
533229Spst	-for f in $(PROGS) ;\
543229Spst	do \
553229Spst		$(INSTALL) -c -s $$f $(DESTDIR)$(BINDIR) ;\
563229Spst	done
573229Spst
583229SpstMAN5= bootptab.5
593229SpstMAN8= bootpd.8 bootpef.8 bootptest.8
603229Spstinstall.man: $(MAN5) $(MAN8)
613229Spst	-for f in $(MAN5) ;\
623229Spst	do \
633229Spst		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man5 ;\
643229Spst	done
653229Spst	-for f in $(MAN8) ;\
663229Spst	do \
673229Spst		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man8 ;\
683229Spst	done
693229Spst
703229Spstclean:
713229Spst	-rm -f core *.o
723229Spst	-rm -f $(PROGS) $(TESTS)
733229Spst
743229Spstdistclean:
753229Spst	-rm -f *.BAK *.CKP *~ .emacs*
763229Spst
773229Spst#
7813572Spst# Handy targets for systems needing special treatment:
7913572Spst# (Most POSIX systems should work with just "make all")
803229Spst#
813229Spst
823229Spst# DEC/OSF1 on the Alpha
833229Spstalpha:
843229Spst	$(MAKE) SYSDEFS="-DETC_ETHERS -Dint32=int -D_SOCKADDR_LEN" \
853229Spst		STRERROR=strerror.o
863229Spst
873229Spst# Control Data EP/IX 1.4.3 system, BSD 4.3 mode
883229Spstepix143:
893229Spst	$(MAKE) CC="cc -systype bsd43" \
903229Spst		SYSDEFS="-Dconst= -D_SIZE_T -DNO_UNISTD -DUSE_BFUNCS" \
913229Spst		STRERROR=strerror.o
923229Spst
933229Spst# Control Data EP/IX 2.1.1 system, SVR4 mode
943229Spstepix211:
953229Spst	$(MAKE) CC="cc -systype svr4" \
963229Spst		SYSDEFS="-DSVR4" \
973229Spst		SYSLIBS="-lsocket -lnsl"
983229Spst
9913572Spst# IRIX 5.X (Silicon Graphics)
1003229Spstirix:
10113572Spst	$(MAKE) SYSDEFS= SYSLIBS=
1023229Spst
10313572Spst# Linux 1.1.80+ on [34]86
10413572Spstlinux:
10513572Spst	$(MAKE) SYSDEFS="-O6 -Wall -fomit-frame-pointer"
10613572Spst
1073229Spst# SunOS 4.X
1083229Spstsunos4:
1093229Spst	$(MAKE) SYSDEFS="-DSUNOS -DETC_ETHERS" \
1103229Spst		STRERROR=strerror.o
1113229Spst
1123229Spst# Solaris 2.X (i.e. SunOS 5.X)
1133229Spstsunos5:
1143229Spst	$(MAKE) SYSDEFS="-DSVR4 -DETC_ETHERS" \
1153229Spst		SYSLIBS="-lsocket -lnsl"
1163229Spst
11713572Spst# Solaris 2.X (i.e. SunOS 5.X) with GCC.  Note that GCC normally
11813572Spst# defines __STDC__=1 which breaks many Solaris header files...
11913572Spstsunos5gcc:
12013572Spst	$(MAKE) SYSDEFS="-DSVR4 -DETC_ETHERS -D__STDC__=0" \
12113572Spst		SYSLIBS="-lsocket -lnsl" CC="gcc -Wall"
12213572Spst
12313572Spst# UNIX System V Rel. 3
12413572Spstsvr3:
12513572Spst	$(MAKE) SYSDEFS="-DSYSV"
12613572Spst
12713572Spst# UNIX System V Rel. 4
1283229Spstsvr4:
1293229Spst	$(MAKE) SYSDEFS="-DSVR4" \
1303229Spst		SYSLIBS="-lsocket -lnsl"
1313229Spst
13213572Spst# AT&T/GIS - Both AT&T StarServer and NCR 3000
13313572Spst# may work for others using Wollongong's WIN-TCP
13413572Spstwollongong gis :
13513572Spst	$(MAKE) SYSDEFS="-DSVR4 -DWIN_TCP" \
13613572Spst		SYSLIBS="-lsocket -lnsl"
13713572Spst
1383229Spst#
1393229Spst# How to build each program:
1403229Spst#
1413229Spst
1423229SpstOBJ_D=	bootpd.o dovend.o readfile.o hash.o dumptab.o \
1433229Spst	 lookup.o getif.o hwaddr.o tzone.o report.o $(STRERROR)
1443229Spstbootpd: $(OBJ_D)
1453229Spst	$(CC) -o $@ $(OBJ_D) $(SYSLIBS)
1463229Spst
1473229SpstOBJ_EF=	bootpef.o dovend.o readfile.o hash.o dumptab.o \
1483229Spst	 lookup.o hwaddr.o tzone.o report.o $(STRERROR)
1493229Spstbootpef: $(OBJ_EF)
1503229Spst	$(CC) -o $@ $(OBJ_EF) $(SYSLIBS)
1513229Spst
1523229SpstOBJ_GW= bootpgw.o getif.o hwaddr.o report.o $(STRERROR)
1533229Spstbootpgw: $(OBJ_GW)
1543229Spst	$(CC) -o $@ $(OBJ_GW) $(SYSLIBS)
1553229Spst
1563229SpstOBJ_TEST= bootptest.o print-bootp.o getif.o getether.o \
1573229Spst	 report.o $(STRERROR)
1583229Spstbootptest: $(OBJ_TEST)
1593229Spst	$(CC) -o $@ $(OBJ_TEST) $(SYSLIBS)
1603229Spst
1613229Spst# This is just for testing the lookup functions.
1623229SpstTRYLOOK= trylook.o lookup.o report.o $(STRERROR)
1633229Spsttrylook : $(TRYLOOK)
1643229Spst	$(CC) -o $@ $(TRYLOOK) $(SYSLIBS)
1653229Spst
1663229Spst# This is just for testing getif.
1673229SpstTRYGETIF= trygetif.o getif.o report.o $(STRERROR)
1683229Spsttrygetif : $(TRYGETIF)
1693229Spst	$(CC) -o $@ $(TRYGETIF) $(SYSLIBS)
1703229Spst
1713229Spst# This is just for testing getether.
1723229SpstTRYGETEA= trygetea.o getether.o report.o $(STRERROR)
1733229Spsttrygetea : $(TRYGETEA)
1743229Spst	$(CC) -o $@ $(TRYGETEA) $(SYSLIBS)
1753229Spst
1763229Spst# This rule just keeps the LOG_BOOTP define localized.
1773229Spstreport.o : report.c
1783229Spst	$(CC) $(CFLAGS) $(LOG_FACILITY) -c $<
1793229Spst
1803229Spst# Punt SunOS -target noise
1813229Spst.c.o:
1823229Spst	$(CC) $(CFLAGS) -c $<
1833229Spst
1843229Spst#
1853229Spst# Header file dependencies:
1863229Spst#
1873229Spst
1883229Spstbootpd.o  : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
1893229Spstbootpd.o  : readfile.h report.h tzone.h patchlevel.h getif.h
1903229Spstbootpef.o : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
1913229Spstbootpef.o : readfile.h report.h tzone.h patchlevel.h
1923229Spstbootpgw.o : bootp.h bptypes.h getif.h hwaddr.h report.h patchlevel.h
1933229Spstbootptest.o : bootp.h bptypes.h bootptest.h getif.h patchlevel.h
1943229Spstdovend.o : bootp.h bptypes.h bootpd.h hash.h hwaddr.h report.h dovend.h
1953229Spstdumptab.o : bootp.h bptypes.h hash.h hwaddr.h report.h patchlevel.h bootpd.h
1963229Spstgetif.o : getif.h report.h
1973229Spsthash.o : hash.h
1983229Spsthwaddr.o : bptypes.h hwaddr.h report.h
1993229Spstlookup.o : bootp.h bptypes.h lookup.h report.h
2003229Spstprint-bootp.o : bootp.h bptypes.h bootptest.h
2013229Spstreadfile.o : bootp.h bptypes.h hash.h hwaddr.h lookup.h readfile.h
2023229Spstreadfile.o : report.h tzone.h bootpd.h
2033229Spstreport.o : report.h
2043229Spsttzone.o : bptypes.h report.h tzone.h
205