## Defaults...
SCRIPT = none
BINDIR = /usr/sbin
CLIENTBINDIR=/sbin
ADMMANEXT = .0
FFMANEXT = .0
ADMMANDIR = /usr/share/man/cat8
FFMANDIR = /usr/share/man/cat5
#INSTALL = install -c
MANINSTALL = install -c -m 444
CHMOD = chmod
CATMANPAGES =
MANCAT = cat
ETC = /etc
VARRUN = /var/run
VARDB = /var/db
CLIENT_PATH = '"PATH=/usr/ucb:/usr/bin:/usr/sbin:/bin:/sbin"'
FLTFLAGS += -s 32000
#LIBS = $(LIBRESOLV)


# Major version number (if applicable)
##--majver--
MAJORVERSION=2
##--majver--

# Minor version number (if applicable)
##--minver--
MINORVERSION=2
##--minver--

## Linux 2.0
#--linux-2.0--
COPTS = -DLINUX_MAJOR=$(MAJORVERSION) -DLINUX_MINOR=$(MINORVERSION)
CF = cf/linux.h
ADMMANDIR = /usr/man/man8
ADMMANEXT = .8
FFMANDIR = /usr/man/man5
FFMANEXT = .5
MANCAT = man
VARRUN = /var/run
VARDB = /var/state/dhcp	# see rationale in includes/cf/linux.h
SCRIPT=linux
#--linux-2.0--

CATMANPAGES = dhcpd.cat8 dhcpd.conf.cat5 dhcpd.leases.cat5
SEDMANPAGES = dhcpd.man8 dhcpd.conf.man5 dhcpd.leases.man5
SRCS   = dhcpd.c dhcp.c bootp.c confpars.c db.c amitp.c
OBJS   = dhcpd.o dhcp.o bootp.o confpars.o db.o amitp.o ../../amit_lib/support.lib
PROG   = dhcpd
MAN    = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5

DEBUG  = -g
INCLUDES += -I.. -I../includes
DHCPLIB = ../common/libdhcp.a
CFLAGS += $(PREDEFINES) $(INCLUDES) $(COPTS) 

#ifdef CONFIG_USER_DNSMASQ_DNSMASQ
CFLAGS += -DCONFIG_USER_DNSMASQ_DNSMASQ
#endif

ifdef CONFIG_USER_FLATFSD_FLATFSD
SRCS += nettel.c
OBJS += nettel.o
endif

all:	$(PROG)

clean:
	-rm -f $(OBJS) $(PROG) *.elf *.gdb

realclean: clean
	-rm -f $(PROG) $(CATMANPAGES) $(SEDMANPAGES) *~ #*

distclean: realclean
	-rm -f Makefile

# These should only be done on 4.4 BSD-based systems, since the mandoc
# macros aren't available on older unices.   Catted man pages are
# provided in the distribution so that this doesn't become a problem.

dhcpd.cat8:	dhcpd.man8
	nroff -man dhcpd.man8 >dhcpd.cat8

dhcpd.man8:	dhcpd.8
	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
		-e "s#RUNDIR#$(VARRUN)#g" < dhcpd.8 >dhcpd.man8

dhcpd.conf.cat5:	dhcpd.conf.man5
	nroff -man dhcpd.conf.man5 >dhcpd.conf.cat5

dhcpd.conf.man5:	dhcpd.conf.5
	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
		-e "s#RUNDIR#$(VARRUN)#g" < dhcpd.conf.5 >dhcpd.conf.man5

dhcpd.leases.cat5:	dhcpd.leases.man5
	nroff -man dhcpd.leases.man5 >dhcpd.leases.cat5

dhcpd.leases.man5:	dhcpd.leases.5
	sed -e "s#ETCDIR#$(ETC)#g" -e "s#DBDIR#$(VARDB)#g" \
		-e "s#RUNDIR#$(VARRUN)#g" < dhcpd.leases.5 >dhcpd.leases.man5

dhcpd:	$(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS) $(DHCPLIB) $(LIBS) $(LDADD)

romfs:
	$(ROMFSINST) /bin/dhcpd

# Dependencies (semi-automatically-generated)

dhcpd.o: dhcpd.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h ../includes/version.h
dhcp.o: dhcp.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h
amitp.o: amitp.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h ../../amit_lib/support.lib
bootp.o: bootp.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h
confpars.o: confpars.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h ../includes/dhctoken.h
db.o: db.c ../includes/dhcpd.h \
	../includes/cdefs.h ../includes/osdep.h ../includes/site.h \
	../includes/cf/netbsd.h ../includes/dhcp.h \
	../includes/tree.h ../includes/hash.h ../includes/inet.h \
	../includes/sysconf.h
