xref: /freebsd/libexec/bootpd/Makefile.UNIX (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
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)
48
49tests: $(TESTS)
50
51system: install
52
53install: $(PROGS)
54	-for f in $(PROGS) ;\
55	do \
56		$(INSTALL) -c -s $$f $(DESTDIR)$(BINDIR) ;\
57	done
58
59MAN5= bootptab.5
60MAN8= bootpd.8 bootpef.8 bootptest.8
61install.man: $(MAN5) $(MAN8)
62	-for f in $(MAN5) ;\
63	do \
64		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man5 ;\
65	done
66	-for f in $(MAN8) ;\
67	do \
68		$(INSTALL) -c -m 644 $$f $(DESTDIR)$(MANDIR)/man8 ;\
69	done
70
71clean:
72	-rm -f core *.o
73	-rm -f $(PROGS) $(TESTS)
74
75distclean:
76	-rm -f *.BAK *.CKP *~ .emacs*
77
78#
79# Handy targets for individual systems:
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# Silicon Graphics IRIX  (no <sys/sockio.h>, so not SVR4)
100irix:
101	$(MAKE) SYSDEFS="-DSYSV -DIRIX"
102
103# SunOS 4.X
104sunos4:
105	$(MAKE) SYSDEFS="-DSUNOS -DETC_ETHERS" \
106		STRERROR=strerror.o
107
108# Solaris 2.X (i.e. SunOS 5.X)
109sunos5:
110	$(MAKE) SYSDEFS="-DSVR4 -DETC_ETHERS" \
111		SYSLIBS="-lsocket -lnsl"
112
113# UNIX System V Rel. 4 (also: IRIX 5.X, others)
114svr4:
115	$(MAKE) SYSDEFS="-DSVR4" \
116		SYSLIBS="-lsocket -lnsl"
117
118#
119# How to build each program:
120#
121
122OBJ_D=	bootpd.o dovend.o readfile.o hash.o dumptab.o \
123	 lookup.o getif.o hwaddr.o tzone.o report.o $(STRERROR)
124bootpd: $(OBJ_D)
125	$(CC) -o $@ $(OBJ_D) $(SYSLIBS)
126
127OBJ_EF=	bootpef.o dovend.o readfile.o hash.o dumptab.o \
128	 lookup.o hwaddr.o tzone.o report.o $(STRERROR)
129bootpef: $(OBJ_EF)
130	$(CC) -o $@ $(OBJ_EF) $(SYSLIBS)
131
132OBJ_GW= bootpgw.o getif.o hwaddr.o report.o $(STRERROR)
133bootpgw: $(OBJ_GW)
134	$(CC) -o $@ $(OBJ_GW) $(SYSLIBS)
135
136OBJ_TEST= bootptest.o print-bootp.o getif.o getether.o \
137	 report.o $(STRERROR)
138bootptest: $(OBJ_TEST)
139	$(CC) -o $@ $(OBJ_TEST) $(SYSLIBS)
140
141# This is just for testing the lookup functions.
142TRYLOOK= trylook.o lookup.o report.o $(STRERROR)
143trylook : $(TRYLOOK)
144	$(CC) -o $@ $(TRYLOOK) $(SYSLIBS)
145
146# This is just for testing getif.
147TRYGETIF= trygetif.o getif.o report.o $(STRERROR)
148trygetif : $(TRYGETIF)
149	$(CC) -o $@ $(TRYGETIF) $(SYSLIBS)
150
151# This is just for testing getether.
152TRYGETEA= trygetea.o getether.o report.o $(STRERROR)
153trygetea : $(TRYGETEA)
154	$(CC) -o $@ $(TRYGETEA) $(SYSLIBS)
155
156# This rule just keeps the LOG_BOOTP define localized.
157report.o : report.c
158	$(CC) $(CFLAGS) $(LOG_FACILITY) -c $<
159
160# Punt SunOS -target noise
161.c.o:
162	$(CC) $(CFLAGS) -c $<
163
164#
165# Header file dependencies:
166#
167
168bootpd.o  : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
169bootpd.o  : readfile.h report.h tzone.h patchlevel.h getif.h
170bootpef.o : bootp.h bptypes.h hash.h hwaddr.h bootpd.h dovend.h
171bootpef.o : readfile.h report.h tzone.h patchlevel.h
172bootpgw.o : bootp.h bptypes.h getif.h hwaddr.h report.h patchlevel.h
173bootptest.o : bootp.h bptypes.h bootptest.h getif.h patchlevel.h
174dovend.o : bootp.h bptypes.h bootpd.h hash.h hwaddr.h report.h dovend.h
175dumptab.o : bootp.h bptypes.h hash.h hwaddr.h report.h patchlevel.h bootpd.h
176getif.o : getif.h report.h
177hash.o : hash.h
178hwaddr.o : bptypes.h hwaddr.h report.h
179lookup.o : bootp.h bptypes.h lookup.h report.h
180print-bootp.o : bootp.h bptypes.h bootptest.h
181readfile.o : bootp.h bptypes.h hash.h hwaddr.h lookup.h readfile.h
182readfile.o : report.h tzone.h bootpd.h
183report.o : report.h
184tzone.o : bptypes.h report.h tzone.h
185