xref: /freebsd/sys/conf/config.mk (revision 23c73dbae7b2f64014b275643efbe92f449feaa2)
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_global.h:
12	touch ${.TARGET}
13	@echo "#define SMP 1" >> ${.TARGET}
14	@echo "#define MAC 1" >> ${.TARGET}
15	@echo "#define VIMAGE 1" >> ${.TARGET}
16# Note: Define 'options' in DEFAULTS to 1. For simplicity, no check if the
17# option is in opt_global.h. Nearly all the options in DEFAUlTS today are in
18# opt_global.h with GEOM_* being the main exceptions. Move any options from
19# GENERIC or std.* files to DEFAULTS to get this treatment for untied builds.
20	@awk '$$1 == "options" && $$2 !~ "GEOM_" { print "#define ", $$2, " 1"; }' \
21		< ${SYSDIR}/${MACHINE}/conf/DEFAULTS \
22		>>  ${.TARGET}
23.if ${MK_BHYVE_SNAPSHOT} != "no"
24opt_bhyve_snapshot.h:
25	@echo "#define BHYVE_SNAPSHOT 1" > ${.TARGET}
26.endif
27opt_bpf.h:
28	echo "#define DEV_BPF 1" > ${.TARGET}
29.if ${MK_INET_SUPPORT} != "no"
30opt_inet.h:
31	@echo "#define INET 1" > ${.TARGET}
32	@echo "#define TCP_OFFLOAD 1" >> ${.TARGET}
33.endif
34.if ${MK_INET6_SUPPORT} != "no"
35opt_inet6.h:
36	@echo "#define INET6 1" > ${.TARGET}
37.endif
38.if ${MK_IPSEC_SUPPORT} != "no"
39opt_ipsec.h:
40	@echo "#define IPSEC_SUPPORT 1" > ${.TARGET}
41.endif
42.if ${MK_RATELIMIT} != "no"
43opt_ratelimit.h:
44	@echo "#define RATELIMIT 1" > ${.TARGET}
45.endif
46opt_mrouting.h:
47	@echo "#define MROUTING 1" > ${.TARGET}
48.if ${MK_FDT} != "no"
49opt_platform.h:
50	@echo "#define FDT 1" > ${.TARGET}
51.endif
52opt_printf.h:
53	echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET}
54opt_scsi.h:
55	echo "#define SCSI_DELAY 15000" > ${.TARGET}
56.if ${MK_SCTP_SUPPORT} != "no"
57opt_sctp.h:
58	@echo "#define SCTP_SUPPORT 1" > ${.TARGET}
59.endif
60opt_wlan.h:
61	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
62	echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
63KERN_OPTS.i386=NEW_PCIB DEV_PCI
64KERN_OPTS.amd64=NEW_PCIB DEV_PCI
65KERN_OPTS.powerpc=NEW_PCIB DEV_PCI
66KERN_OPTS=MROUTING IEEE80211_DEBUG \
67	IEEE80211_SUPPORT_MESH DEV_BPF \
68	${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA}
69.if ${MK_BHYVE_SNAPSHOT} != "no"
70KERN_OPTS+= BHYVE_SNAPSHOT
71.endif
72.if ${MK_INET_SUPPORT} != "no"
73KERN_OPTS+= INET TCP_OFFLOAD
74.endif
75.if ${MK_INET6_SUPPORT} != "no"
76KERN_OPTS+= INET6
77.endif
78.if ${MK_IPSEC_SUPPORT} != "no"
79KERN_OPTS+= IPSEC_SUPPORT
80.endif
81.if ${MK_SCTP_SUPPORT} != "no"
82KERN_OPTS+= SCTP_SUPPORT
83.endif
84.elif !defined(KERN_OPTS)
85# Add all the options that are mentioned in any opt_*.h file when we
86# have a kernel build directory to pull them from.
87KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u
88.export KERN_OPTS
89.endif
90
91.if !defined(NO_MODULES) && !defined(__MPATH) && !make(install) && \
92    (empty(.MAKEFLAGS:M-V) || defined(NO_SKIP_MPATH))
93__MPATH!=find ${SYSDIR:tA}/ -name \*_if.m
94.export __MPATH
95.endif
96