1# $FreeBSD$
2#
3# Common code to marry kernel config(8) goo and module building goo.
4#
5
6# Generate options files that otherwise would be built
7# in substantially similar ways through the tree. Move
8# the code here when they all produce identical results
9# (or should)
10.if !defined(KERNBUILDDIR)
11opt_bpf.h:
12	echo "#define DEV_BPF 1" > ${.TARGET}
13.if ${MK_INET_SUPPORT} != "no"
14opt_inet.h:
15	@echo "#define INET 1" > ${.TARGET}
16	@echo "#define TCP_OFFLOAD 1" >> ${.TARGET}
17.endif
18.if ${MK_INET6_SUPPORT} != "no"
19opt_inet6.h:
20	@echo "#define INET6 1" > ${.TARGET}
21.endif
22.if ${MK_IPSEC_SUPPORT} != "no"
23opt_ipsec.h:
24	@echo "#define IPSEC_SUPPORT 1" > ${.TARGET}
25.endif
26.if ${MK_RATELIMIT} != "no"
27opt_ratelimit.h:
28	@echo "#define RATELIMIT 1" > ${.TARGET}
29.endif
30opt_mrouting.h:
31	echo "#define MROUTING 1" > ${.TARGET}
32opt_printf.h:
33	echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET}
34opt_scsi.h:
35	echo "#define SCSI_DELAY 15000" > ${.TARGET}
36.if ${MK_SCTP_SUPPORT} != "no"
37opt_sctp.h:
38	@echo "#define SCTP_SUPPORT 1" > ${.TARGET}
39.endif
40opt_wlan.h:
41	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
42	echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET}
43	echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
44KERN_OPTS.i386=NEW_PCIB DEV_PCI
45KERN_OPTS.amd64=NEW_PCIB DEV_PCI
46KERN_OPTS.powerpc=NEW_PCIB DEV_PCI
47KERN_OPTS=MROUTING IEEE80211_DEBUG \
48	IEEE80211_AMPDU_AGE IEEE80211_SUPPORT_MESH DEV_BPF \
49	${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA}
50.if ${MK_INET_SUPPORT} != "no"
51KERN_OPTS+= INET TCP_OFFLOAD
52.endif
53.if ${MK_INET6_SUPPORT} != "no"
54KERN_OPTS+= INET6
55.endif
56.if ${MK_IPSEC_SUPPORT} != "no"
57KERN_OPTS+= IPSEC_SUPPORT
58.endif
59.if ${MK_SCTP_SUPPORT} != "no"
60KERN_OPTS+= SCTP_SUPPORT
61.endif
62.elif !defined(KERN_OPTS)
63KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u
64.export KERN_OPTS
65.endif
66
67.if !defined(NO_MODULES) && !defined(__MPATH) && !make(install) && \
68    (empty(.MAKEFLAGS:M-V) || defined(NO_SKIP_MPATH))
69__MPATH!=find ${SYSDIR:tA}/ -name \*_if.m
70.export __MPATH
71.endif
72