dhcpcd: Fix build for 9.1.2
[dragonfly.git] / sbin / dhcpcd / Makefile
1 # Derived from NetBSD's Makefile for dhcpcd
2
3 DISTDIR=        ${.CURDIR}/../../contrib/dhcpcd
4
5 PROG=           dhcpcd
6
7 SRCDIR=         ${DISTDIR}/src
8 .PATH:          ${SRCDIR}
9 CFLAGS+=        -DHAVE_CONFIG_H -I${.CURDIR} -I${SRCDIR} -I${DISTDIR}
10 SRCS=           common.c control.c dhcpcd.c duid.c eloop.c logerr.c
11 SRCS+=          if.c if-options.c route.c sa.c script.c
12 SRCS+=          dhcp-common.c dhcpcd-embedded.c
13 SRCS+=          if-bsd.c
14
15 CFLAGS+=        -DAUTH
16 SRCS+=          auth.c
17
18 CFLAGS+=        -DINET
19 SRCS+=          bpf.c dhcp.c ipv4.c
20 CFLAGS+=        -DARP -DARPING
21 SRCS+=          arp.c
22 CFLAGS+=        -DIPV4LL
23 SRCS+=          ipv4ll.c
24
25 CFLAGS+=        -DINET6
26 SRCS+=          ipv6.c ipv6nd.c
27 CFLAGS+=        -DDHCP6
28 SRCS+=          dhcp6.c
29
30 CFLAGS+=        -DPRIVSEP -DPRIVSEP_USER='"_dhcp"'
31 SRCS+=          privsep.c privsep-root.c privsep-inet.c privsep-control.c
32 SRCS+=          privsep-bpf.c
33 SRCS+=          privsep-bsd.c
34
35 .PATH:          ${DISTDIR}/compat
36 SRCS+=          pidfile.c rb.c strtoi.c strtou.c
37 .PATH:          ${DISTDIR}/compat/crypt
38 SRCS+=          hmac.c
39
40 # Fully convert to openssl/md5.h and openssl/sha2.h
41 CFLAGS+=        -DUSE_PRIVATECRYPTO
42 FLAGS_GROUPS=   openssl
43 openssl_FLAGS=  -I${_SHLIBDIRPREFIX}/usr/include/priv/openssl
44 openssl_FLAGS+= -DMD5Init=MD5_Init -DMD5Update=MD5_Update -DMD5Final=MD5_Final
45 openssl_FLAGS_FILES= hmac.c ipv6.c
46
47 CFLAGS+=        ${PRIVATELIB_CFLAGS}
48 DPADD=          ${LIBCRYPTO}
49 LDADD=          -lprivate_crypto
50 LDFLAGS+=       ${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
58 CFLAGS+=        -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
82 MAN=            dhcpcd.conf.5 dhcpcd.8
83 .for f in dhcpcd.conf.5 dhcpcd.8
84 CLEANFILES+=    ${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
96 HOOKSRC=        ${DISTDIR}/hooks
97 .PATH:          ${HOOKSRC}
98
99 SCRIPTS=        dhcpcd-run-hooks
100 SCRIPTSDIR=     ${_LIBEXECDIR}
101 MAN+=           dhcpcd-run-hooks.8
102
103 FILES=          01-test 20-resolv.conf 30-hostname
104 FILESDIR=       ${_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
108 FILES+=         ${f}
109 FILESDIR_${f}=  ${_DATADIR}/dhcpcd/hooks
110 .endfor
111
112 .for f in dhcpcd-run-hooks dhcpcd-run-hooks.8 30-hostname 50-ypbind
113 CLEANFILES+=    ${f}
114 ${f}: ${f}.in
115         sed ${_SED_CMDS} ${HOOKSRC}/${f}.in > $@
116 .endfor
117
118 .include <bsd.prog.mk>