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