xref: /dragonfly/sbin/dhcpcd/Makefile (revision 0de61e28)
1# Derived from NetBSD's Makefile for dhcpcd
2
3DISTDIR=	${.CURDIR}/../../contrib/dhcpcd
4
5PROG=		dhcpcd
6
7SRCDIR=		${DISTDIR}/src
8.PATH:		${SRCDIR}
9CFLAGS+=	-DHAVE_CONFIG_H -I${.CURDIR} -I${SRCDIR} -I${DISTDIR}
10SRCS=		common.c control.c dhcpcd.c duid.c eloop.c logerr.c
11SRCS+=		if.c if-options.c route.c sa.c script.c
12SRCS+=		dhcp-common.c dhcpcd-embedded.c
13SRCS+=		if-bsd.c
14
15CFLAGS+=	-DAUTH
16SRCS+=		auth.c
17
18CFLAGS+=	-DINET
19SRCS+=		bpf.c dhcp.c ipv4.c
20CFLAGS+=	-DARP -DARPING
21SRCS+=		arp.c
22CFLAGS+=	-DIPV4LL
23SRCS+=		ipv4ll.c
24
25CFLAGS+=	-DINET6
26SRCS+=		ipv6.c ipv6nd.c
27CFLAGS+=	-DDHCP6
28SRCS+=		dhcp6.c
29
30CFLAGS+=	-DPRIVSEP -DPRIVSEP_USER='"_dhcp"'
31SRCS+=		privsep.c privsep-root.c privsep-inet.c privsep-control.c
32SRCS+=		privsep-bpf.c
33SRCS+=		privsep-bsd.c
34
35.PATH:		${DISTDIR}/compat
36SRCS+=		pidfile.c rb.c strtoi.c strtou.c
37.PATH:		${DISTDIR}/compat/crypt
38SRCS+=		hmac.c
39
40# Fully convert to openssl/md5.h and openssl/sha2.h
41CFLAGS+=	-DUSE_PRIVATECRYPTO
42FLAGS_GROUPS=	openssl
43openssl_FLAGS=	-I${_SHLIBDIRPREFIX}/usr/include/priv/openssl
44openssl_FLAGS+=	-DMD5Init=MD5_Init -DMD5Update=MD5_Update -DMD5Final=MD5_Final
45openssl_FLAGS_FILES= hmac.c ipv6.c
46
47CFLAGS+=	${PRIVATELIB_CFLAGS}
48DPADD=		${LIBCRYPTO}
49LDADD=		-lprivate_crypto
50LDFLAGS+=	${PRIVATELIB_LDFLAGS}
51
52# system directories
53_SYSCONFDIR=	/etc
54_LIBDIR=	/usr/lib
55_LIBEXECDIR=	/usr/libexec
56_DBDIR=		/var/db/dhcpcd
57_RUNDIR=	/var/run/dhcpcd
58CFLAGS+=	-DSYSCONFDIR='"${_SYSCONFDIR}"' \
59		-DSBINDIR='"${BINDIR}"' \
60		-DLIBDIR='"${_LIBDIR}"' \
61		-DLIBEXECDIR='"${_LIBEXECDIR}"' \
62		-DDBDIR='"${_DBDIR}"' \
63		-DRUNDIR='"${_RUNDIR}"'
64
65_DATADIR=	/usr/share/examples
66_HOOKDIR=	${_LIBEXECDIR}/dhcpcd-hooks
67_SED_CMDS=	-e 's:@SYSCONFDIR@:${_SYSCONFDIR}:g' \
68		-e 's:@DATADIR@:${_DATADIR}:g' \
69		-e 's:@DBDIR@:${_DBDIR}:g' \
70		-e 's:@LIBDIR@:${_LIBDIR}:g' \
71		-e 's:@RUNDIR@:${_RUNDIR}:g' \
72		-e 's:@HOOKDIR@:${_HOOKDIR}:g' \
73		-e 's:@SCRIPT@:${_LIBEXECDIR}/dhcpcd-run-hooks:g' \
74		-e 's:@SERVICEEXISTS@::g' \
75		-e 's:@SERVICECMD@::g' \
76		-e 's:@SERVICESTATUS@::g' \
77		-e 's:@STATUSARG@::g' \
78		-e 's:@DEFAULT_HOSTNAME@::g' \
79		-e 's:@YPDOMAIN_DIR@::g' \
80		-e 's:@YPDOMAIN_SUFFIX@::g'
81
82MAN=		dhcpcd.conf.5 dhcpcd.8
83.for f in dhcpcd.conf.5 dhcpcd.8
84CLEANFILES+=	${f}
85${f}: ${f}.in
86	sed ${_SED_CMDS} ${SRCDIR}/${f}.in > $@
87.endfor
88
89# NOTE:
90# The configuration file 'dhcpcd.conf' is installed by 'etc/Makefile'
91
92#
93# Hooks
94#
95
96HOOKSRC=	${DISTDIR}/hooks
97.PATH:		${HOOKSRC}
98
99SCRIPTS=	dhcpcd-run-hooks
100SCRIPTSDIR=	${_LIBEXECDIR}
101MAN+=		dhcpcd-run-hooks.8
102
103FILES=		01-test 20-resolv.conf 30-hostname
104FILESDIR=	${_HOOKDIR}
105
106# Example hooks that should not be installed by default
107.for f in 10-wpa_supplicant 15-timezone 29-lookup-hostname 50-ypbind
108FILES+=		${f}
109FILESDIR_${f}=	${_DATADIR}/dhcpcd/hooks
110.endfor
111
112.for f in dhcpcd-run-hooks dhcpcd-run-hooks.8 30-hostname 50-ypbind
113CLEANFILES+=	${f}
114${f}: ${f}.in
115	sed ${_SED_CMDS} ${HOOKSRC}/${f}.in > $@
116.endfor
117
118.include <bsd.prog.mk>
119