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