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