1# $NetBSD: Makefile,v 1.57 2022/10/31 09:27:23 wiz Exp $
2#
3
4WARNS?=		6
5USE_FORT?=	yes	# network client (local server)
6
7.include <bsd.init.mk>
8.include "../../Makefile.inc"
9
10PROG=		dhcpcd
11SRCS=		common.c control.c dhcpcd.c duid.c eloop.c logerr.c
12SRCS+=		if.c if-options.c route.c sa.c script.c
13SRCS+=		dhcp-common.c dhcpcd-embedded.c
14SRCS+=		if-bsd.c
15
16# Disable privilege separation and sandboxing
17# This should be fine for ramdisk based installers
18.if !defined(SMALLPROG)
19CPPFLAGS+=	-DPRIVSEP -DPRIVSEP_USER=\"_dhcpcd\"
20SRCS+=		privsep.c privsep-root.c privsep-inet.c privsep-control.c
21SRCS+=		privsep-bsd.c
22.endif
23
24CPPFLAGS+=	-DHAVE_CONFIG_H
25
26USE_INET?=	yes
27
28.if defined(SMALLPROG)
29CPPFLAGS+=	-DSMALL
30.else
31CPPFLAGS+=	-DAUTH
32SRCS+=		auth.c
33.endif
34
35.if (${USE_INET} != "no")
36CPPFLAGS+=	-DINET
37SRCS+=		bpf.c dhcp.c ipv4.c
38.if !defined(SMALLPROG)
39SRCS+=		privsep-bpf.c
40.endif
41
42.if (${MKLIBCSANITIZER:Uno} == "yes")
43.if (${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8)
44COPTS.dhcp.c+=	-Wno-error=sign-conversion
45.endif
46.endif
47
48.if !defined(SMALLPROG)
49CPPFLAGS+=	-DARP
50SRCS+=		arp.c
51CPPFLAGS+=	-DARPING
52CPPFLAGS+=	-DIPV4LL
53SRCS+=		ipv4ll.c
54.endif
55.endif
56
57.if (!defined(SMALLPROG) || defined(SMALLPROG_INET6)) && (${USE_INET6} != "no")
58CPPFLAGS+=	-DINET6
59SRCS+=		ipv6.c ipv6nd.c
60# -DSMALL already strips out prefix delegation
61# A network could be IPv6 only and require DHCPv6
62CPPFLAGS+=	-DDHCP6
63SRCS+=		dhcp6.c
64.endif
65
66CPPFLAGS+=	-I${SRCDIR}/include -I${DIST}/src
67
68DPADD+=		${LIBUTIL}
69LDADD+=		-lutil
70
71.PATH: ${DIST}/src ${DIST}/src/crypt ${LIBC_NET}
72
73CONFIGFILES=			dhcpcd.conf
74FILESDIR_dhcpcd.conf=		/etc
75FILESMODE_dhcpcd.conf=		644	# -rw-r--r--
76
77MAN=			dhcpcd.conf.5 dhcpcd.8 
78
79COPTS.logerr.c+=    ${${ACTIVE_CC} == "clang" && ${MACHINE_ARCH} == "powerpc":? -O0 :}
80
81.include <bsd.prog.mk>
82