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