xref: /freebsd/libexec/bootpd/Makefile.UNIX (revision b0d29bc47dba79f6f38e67eabadfb4b32ffd9390)
1# $FreeBSD$
2#
3# Makefile for the BOOTP programs:
4#   bootpd	- BOOTP server daemon
5#   bootpef	- BOOTP extension file builder
6#   bootpgw	- BOOTP gateway daemon
7#   bootptest	- BOOTP tester (client)
8#
9
10# OPTion DEFinitions:
11# Remove the -DVEND_CMU if you don't wish to support the "CMU vendor format"
12# in addition to the RFC1048 format.  Leaving out DEBUG saves little.
13OPTDEFS= -DSYSLOG -DVEND_CMU -DDEBUG
14
15# Uncomment and edit this to choose the facility code used for syslog.
16# LOG_FACILITY= "-DLOG_BOOTP=LOG_LOCAL2"
17
18# SYStem DEFinitions:
19# Either uncomment some of the following, or do:
20#	"make sunos4"	(or "make sunos5", etc.)
21# SYSDEFS= -DSUNOS -DETC_ETHERS
22# SYSDEFS= -DSVR4
23# SYSLIBS= -lsocket -lnsl
24
25# Uncomment this if your system does not provide streror(3)
26# STRERROR=strerror.o
27
28# FILE DEFinitions:
29# The next few lines may be uncommented and changed to alter the default
30# filenames bootpd uses for its configuration and dump files.
31#CONFFILE= -DCONFIG_FILE=\"/usr/etc/bootptab\"
32#DUMPFILE= -DDUMPTAB_FILE=\"/usr/etc/bootpd.dump\"
33#FILEDEFS= $(CONFFILE) $(DUMPFILE)
34
35# MORE DEFinitions (whatever you might want to add)
36# One might define NDEBUG (to remove "assert()" checks).
37MOREDEFS=
38
39INSTALL=/usr/bin/install
40DESTDIR=
41BINDIR=/usr/etc
42MANDIR=/usr/local/man
43
44CFLAGS= $(OPTDEFS) $(SYSDEFS) $(FILEDEFS) $(MOREDEFS)
45PROGS= bootpd bootpef bootpgw bootptest
46TESTS= trylook trygetif trygetea
47
48all: $(PROGS) $(TESTS)
49
50system: install
51
52install: $(PROGS)
53	-for f in $(PROGS) ;\
54	do \
55		$(INSTALL) -c -s $$f $(DESTDIR)$(BINDIR) ;\
56	done
57
58MAN5= bootptab.5
59MAN8= bootpd.8 bootpef.8 bootptest.8
60install.man: $(MAN5) $(MAN8)
61	-for f in $(MAN5) ;\
62	do \
63		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man5 ;\
64	done
65	-for f in $(MAN8) ;\
66	do \
67		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man8 ;\
68	done
69
70clean:
71	-rm -f core *.o
72	-rm -f $(PROGS) $(TESTS)
73
74distclean:
75	-rm -f *.BAK *.CKP *~ .emacs*
76
77#
78# Handy targets for systems needing special treatment:
79# (Most POSIX systems should work with just "make all")
80#
81
82# DEC/OSF1 on the Alpha
83alpha:
84	$(MAKE) SYSDEFS="-DETC_ETHERS -Dint32=int -D_SOCKADDR_LEN" \
85		STRERROR=strerror.o
86
87# Control Data EP/IX 1.4.3 system, BSD 4.3 mode
88epix143:
89	$(MAKE) CC="cc -systype bsd43" \
90		SYSDEFS="-Dconst= -D_SIZE_T -DNO_UNISTD -DUSE_BFUNCS" \
91		STRERROR=strerror.o
92
93# Control Data EP/IX 2.1.1 system, SVR4 mode
94epix211:
95	$(MAKE) CC="cc -systype svr4" \
96		SYSDEFS="-DSVR4" \
97		SYSLIBS="-lsocket -lnsl"
98
99# IRIX 5.X (Silicon Graphics)
100irix:
101	$(MAKE) SYSDEFS= SYSLIBS=
102
103# Linux 1.1.80+ on [34]86
104linux:
105	$(MAKE) SYSDEFS="-O6 -Wall -fomit-frame-pointer"
106
107# SunOS 4.X
108sunos4:
109	$(MAKE) SYSDEFS="-DSUNOS -DETC_ETHERS" \
110		STRERROR=strerror.o
111
112# Solaris 2.X (i.e. SunOS 5.X)
113sunos5:
114	$(MAKE) SYSDEFS="-DSVR4 -DETC_ETHERS" \
115		SYSLIBS="-lsocket -lnsl"
116
117# Solaris 2.X (i.e. SunOS 5.X) with GCC.  Note that GCC normally
118# defines __STDC__=1 which breaks many Solaris header files...
119sunos5gcc:
120	$(MAKE) SYSDEFS="-DSVR4 -DETC_ETHERS -D__STDC__=0" \
121		SYSLIBS="-lsocket -lnsl" CC="gcc -Wall"
122
123# UNIX System V Rel. 3
124svr3:
125	$(MAKE) SYSDEFS="-DSYSV"
126
127# UNIX System V Rel. 4
128svr4:
129	$(MAKE) SYSDEFS="-DSVR4" \
130		SYSLIBS="-lsocket -lnsl"
131
132# AT&T/GIS - Both AT&T StarServer and NCR 3000
133# may work for others using Wollongong's WIN-TCP
134wollongong gis :
135	$(MAKE) SYSDEFS="-DSVR4 -DWIN_TCP" \
136		SYSLIBS="-lsocket -lnsl"
137
138#
139# How to build each program:
140#
141
142OBJ_D=	bootpd.o dovend.o readfile.o hash.o dumptab.o \
143	 lookup.o getif.o hwaddr.o tzone.o report.o $(STRERROR)
144bootpd: $(OBJ_D)
145	$(CC) -o $@ $(OBJ_D) $(SYSLIBS)
146
147OBJ_EF=	bootpef.o dovend.o readfile.o hash.o dumptab.o \
148	 lookup.o hwaddr.o tzone.o report.o $(STRERROR)
149bootpef: $(OBJ_EF)
150	$(CC) -o $@ $(OBJ_EF) $(SYSLIBS)
151
152OBJ_GW= bootpgw.o getif.o hwaddr.o report.o $(STRERROR)
153bootpgw: $(OBJ_GW)
154	$(CC) -o $@ $(OBJ_GW) $(SYSLIBS)
155
156OBJ_TEST= bootptest.o print-bootp.o getif.o getether.o \
157	 report.o $(STRERROR)
158bootptest: $(OBJ_TEST)
159	$(CC) -o $@ $(OBJ_TEST) $(SYSLIBS)
160
161# This is just for testing the lookup functions.
162TRYLOOK= trylook.o lookup.o report.o $(STRERROR)
163trylook : $(TRYLOOK)
164	$(CC) -o $@ $(TRYLOOK) $(SYSLIBS)
165
166# This is just for testing getif.
167TRYGETIF= trygetif.o getif.o report.o $(STRERROR)
168trygetif : $(TRYGETIF)
169	$(CC) -o $@ $(TRYGETIF) $(SYSLIBS)
170
171# This is just for testing getether.
172TRYGETEA= trygetea.o getether.o report.o $(STRERROR)
173trygetea : $(TRYGETEA)
174	$(CC) -o $@ $(TRYGETEA) $(SYSLIBS)
175
176# This rule just keeps the LOG_BOOTP define localized.
177report.o : report.c
178	$(CC) $(CFLAGS) $(LOG_FACILITY) -c $<
179
180# Punt SunOS -target noise
181.c.o:
182	$(CC) $(CFLAGS) -c $<
183
184#
185# Header file dependencies:
186#
187
188bootpd.o  : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
189bootpd.o  : readfile.h report.h tzone.h patchlevel.h getif.h
190bootpef.o : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
191bootpef.o : readfile.h report.h tzone.h patchlevel.h
192bootpgw.o : bootp.h bptypes.h getif.h hwaddr.h report.h patchlevel.h
193bootptest.o : bootp.h bptypes.h bootptest.h getif.h patchlevel.h
194dovend.o : bootp.h bptypes.h bootpd.h hash.h hwaddr.h report.h dovend.h
195dumptab.o : bootp.h bptypes.h hash.h hwaddr.h report.h patchlevel.h bootpd.h
196getif.o : getif.h report.h
197hash.o : hash.h
198hwaddr.o : bptypes.h hwaddr.h report.h
199lookup.o : bootp.h bptypes.h lookup.h report.h
200print-bootp.o : bootp.h bptypes.h bootptest.h
201readfile.o : bootp.h bptypes.h hash.h hwaddr.h lookup.h readfile.h
202readfile.o : report.h tzone.h bootpd.h
203report.o : report.h
204tzone.o : bptypes.h report.h tzone.h
205