7663f0f9e3bb9acfee2369affd0163b4ac2349f0
[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+=        -DARP -DINET
19 SRCS+=          arp.c bpf.c dhcp.c ipv4.c
20 CFLAGS+=        -DIPV4LL -DARPING
21 SRCS+=          ipv4ll.c
22
23 CFLAGS+=        -DINET6
24 SRCS+=          ipv6.c ipv6nd.c
25 CFLAGS+=        -DDHCP6
26 SRCS+=          dhcp6.c
27
28 .PATH:          ${DISTDIR}/compat
29 SRCS+=          pidfile.c strtoi.c strtou.c
30 .PATH:          ${DISTDIR}/compat/crypt
31 SRCS+=          hmac.c
32
33 # Fully convert to openssl/md5.h and openssl/sha2.h
34 FLAGS_GROUPS=   openssl
35 openssl_FLAGS=  -I${_SHLIBDIRPREFIX}/usr/include/priv/openssl
36 openssl_FLAGS+= -DMD5Init=MD5_Init -DMD5Update=MD5_Update -DMD5Final=MD5_Final
37 openssl_FLAGS_FILES= hmac.c ipv6.c
38
39 CFLAGS+=        ${PRIVATELIB_CFLAGS}
40 DPADD=          ${LIBCRYPTO}
41 LDADD=          -lprivate_crypto
42 LDFLAGS+=       ${PRIVATELIB_LDFLAGS}
43
44 # system directories
45 _SYSCONFDIR=    /etc
46 _LIBDIR=        /usr/lib
47 _LIBEXECDIR=    /usr/libexec
48 _DBDIR=         /var/db/dhcpcd
49 _RUNDIR=        /var/run
50 CFLAGS+=        -DSYSCONFDIR='"${_SYSCONFDIR}"' \
51                 -DSBINDIR='"${BINDIR}"' \
52                 -DLIBDIR='"${_LIBDIR}"' \
53                 -DLIBEXECDIR='"${_LIBEXECDIR}"' \
54                 -DDBDIR='"${_DBDIR}"' \
55                 -DRUNDIR='"${_RUNDIR}"'
56
57 _DATADIR=       /usr/share/examples
58 _HOOKDIR=       ${_LIBEXECDIR}/dhcpcd-hooks
59 _SED_CMDS=      -e 's:@SYSCONFDIR@:${_SYSCONFDIR}:g' \
60                 -e 's:@DATADIR@:${_DATADIR}:g' \
61                 -e 's:@DBDIR@:${_DBDIR}:g' \
62                 -e 's:@LIBDIR@:${_LIBDIR}:g' \
63                 -e 's:@RUNDIR@:${_RUNDIR}:g' \
64                 -e 's:@HOOKDIR@:${_HOOKDIR}:g' \
65                 -e 's:@SCRIPT@:${_LIBEXECDIR}/dhcpcd-run-hooks:g' \
66                 -e 's:@SERVICEEXISTS@::g' \
67                 -e 's:@SERVICECMD@::g' \
68                 -e 's:@SERVICESTATUS@::g' \
69                 -e 's:@STATUSARG@::g' \
70                 -e 's:@YPDOMAIN_DIR@::g' \
71                 -e 's:@YPDOMAIN_SUFFIX@::g'
72
73 MAN=            dhcpcd.conf.5 dhcpcd.8
74 .for f in dhcpcd.conf.5 dhcpcd.8
75 CLEANFILES+=    ${f}
76 ${f}: ${f}.in
77         sed ${_SED_CMDS} ${SRCDIR}/${f}.in > $@
78 .endfor
79
80 # XXX -Wunused-parameter in duid.c, not implemented duid_machineuuid().
81 WARNS?=         3
82
83 # NOTE:
84 # The configuration file 'dhcpcd.conf' is installed by 'etc/Makefile'
85
86 #
87 # Hooks
88 #
89
90 HOOKSRC=        ${DISTDIR}/hooks
91 .PATH:          ${HOOKSRC}
92
93 SCRIPTS=        dhcpcd-run-hooks
94 SCRIPTSDIR=     ${_LIBEXECDIR}
95 MAN+=           dhcpcd-run-hooks.8
96
97 FILES=          01-test 02-dump 20-resolv.conf 30-hostname
98 FILESDIR=       ${_HOOKDIR}
99
100 # Example hooks that should not be installed by default
101 .for f in 10-wpa_supplicant 15-timezone 29-lookup-hostname 50-ypbind
102 FILES+=         ${f}
103 FILESDIR_${f}=  ${_DATADIR}/dhcpcd/hooks
104 .endfor
105
106 .for f in dhcpcd-run-hooks dhcpcd-run-hooks.8 50-ypbind
107 CLEANFILES+=    ${f}
108 ${f}: ${f}.in
109         sed ${_SED_CMDS} ${HOOKSRC}/${f}.in > $@
110 .endfor
111
112 .include <bsd.prog.mk>