xref: /freebsd/sys/conf/config.mk (revision 8415a654d02e1c4268885e667c539873db570576)
135c4406dSWarner Losh#
235c4406dSWarner Losh# Common code to marry kernel config(8) goo and module building goo.
335c4406dSWarner Losh#
435c4406dSWarner Losh
535c4406dSWarner Losh# Generate options files that otherwise would be built
635c4406dSWarner Losh# in substantially similar ways through the tree. Move
735c4406dSWarner Losh# the code here when they all produce identical results
835c4406dSWarner Losh# (or should)
935c4406dSWarner Losh.if !defined(KERNBUILDDIR)
100c4c5948SKyle Evansopt_global.h:
11861526b5SKyle Evans	touch ${.TARGET}
12a4b3b535SMark Johnston	@echo "#define SMP 1" >> ${.TARGET}
137df58aa8SKyle Evans	@echo "#define MAC 1" >> ${.TARGET}
14a4b3b535SMark Johnston	@echo "#define VIMAGE 1" >> ${.TARGET}
154355ab6fSWarner Losh# Note: Define 'options' in DEFAULTS to 1. For simplicity, no check if the
164355ab6fSWarner Losh# option is in opt_global.h. Nearly all the options in DEFAUlTS today are in
174355ab6fSWarner Losh# opt_global.h with GEOM_* being the main exceptions. Move any options from
184355ab6fSWarner Losh# GENERIC or std.* files to DEFAULTS to get this treatment for untied builds.
194355ab6fSWarner Losh	@awk '$$1 == "options" && $$2 !~ "GEOM_" { print "#define ", $$2, " 1"; }' \
204355ab6fSWarner Losh		< ${SYSDIR}/${MACHINE}/conf/DEFAULTS \
214355ab6fSWarner Losh		>>  ${.TARGET}
22483d953aSJohn Baldwin.if ${MK_BHYVE_SNAPSHOT} != "no"
23483d953aSJohn Baldwinopt_bhyve_snapshot.h:
24483d953aSJohn Baldwin	@echo "#define BHYVE_SNAPSHOT 1" > ${.TARGET}
25483d953aSJohn Baldwin.endif
2635c4406dSWarner Loshopt_bpf.h:
2735c4406dSWarner Losh	echo "#define DEV_BPF 1" > ${.TARGET}
2835c4406dSWarner Losh.if ${MK_INET_SUPPORT} != "no"
2935c4406dSWarner Loshopt_inet.h:
3035c4406dSWarner Losh	@echo "#define INET 1" > ${.TARGET}
3135c4406dSWarner Losh	@echo "#define TCP_OFFLOAD 1" >> ${.TARGET}
3235c4406dSWarner Losh.endif
3335c4406dSWarner Losh.if ${MK_INET6_SUPPORT} != "no"
3435c4406dSWarner Loshopt_inet6.h:
3535c4406dSWarner Losh	@echo "#define INET6 1" > ${.TARGET}
3635c4406dSWarner Losh.endif
371319a761SJohn Baldwin.if ${MK_IPSEC_SUPPORT} != "no"
384bcbd26fSJohn Baldwinopt_ipsec.h:
394bcbd26fSJohn Baldwin	@echo "#define IPSEC_SUPPORT 1" > ${.TARGET}
401319a761SJohn Baldwin.endif
41f3e7afe2SHans Petter Selasky.if ${MK_RATELIMIT} != "no"
42f3e7afe2SHans Petter Selaskyopt_ratelimit.h:
43f3e7afe2SHans Petter Selasky	@echo "#define RATELIMIT 1" > ${.TARGET}
44f3e7afe2SHans Petter Selasky.endif
4535c4406dSWarner Loshopt_mrouting.h:
46ff8d9d9cSWarner Losh	@echo "#define MROUTING 1" > ${.TARGET}
47ff8d9d9cSWarner Losh.if ${MK_FDT} != "no"
48ff8d9d9cSWarner Loshopt_platform.h:
49ff8d9d9cSWarner Losh	@echo "#define FDT 1" > ${.TARGET}
50ff8d9d9cSWarner Losh.endif
512379d1d6SWarner Loshopt_printf.h:
522379d1d6SWarner Losh	echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET}
5335c4406dSWarner Loshopt_scsi.h:
5435c4406dSWarner Losh	echo "#define SCSI_DELAY 15000" > ${.TARGET}
5579ddb55cSMark Johnston.if ${MK_SCTP_SUPPORT} != "no"
5679ddb55cSMark Johnstonopt_sctp.h:
5779ddb55cSMark Johnston	@echo "#define SCTP_SUPPORT 1" > ${.TARGET}
5879ddb55cSMark Johnston.endif
5935c4406dSWarner Loshopt_wlan.h:
6035c4406dSWarner Losh	echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
6135c4406dSWarner Losh	echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
62*8415a654SJessica ClarkeKERN_OPTS.i386=DEV_PCI
63*8415a654SJessica ClarkeKERN_OPTS.amd64=DEV_PCI
64*8415a654SJessica ClarkeKERN_OPTS.powerpc=DEV_PCI
65a7dc3128SBrooks DavisKERN_OPTS=MROUTING IEEE80211_DEBUG \
664945f79aSAndriy Voskoboinyk	IEEE80211_SUPPORT_MESH DEV_BPF \
6735c4406dSWarner Losh	${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA}
68483d953aSJohn Baldwin.if ${MK_BHYVE_SNAPSHOT} != "no"
69483d953aSJohn BaldwinKERN_OPTS+= BHYVE_SNAPSHOT
70483d953aSJohn Baldwin.endif
7135c4406dSWarner Losh.if ${MK_INET_SUPPORT} != "no"
7235c4406dSWarner LoshKERN_OPTS+= INET TCP_OFFLOAD
7335c4406dSWarner Losh.endif
7435c4406dSWarner Losh.if ${MK_INET6_SUPPORT} != "no"
7535c4406dSWarner LoshKERN_OPTS+= INET6
7635c4406dSWarner Losh.endif
771319a761SJohn Baldwin.if ${MK_IPSEC_SUPPORT} != "no"
781319a761SJohn BaldwinKERN_OPTS+= IPSEC_SUPPORT
791319a761SJohn Baldwin.endif
8079ddb55cSMark Johnston.if ${MK_SCTP_SUPPORT} != "no"
8179ddb55cSMark JohnstonKERN_OPTS+= SCTP_SUPPORT
8279ddb55cSMark Johnston.endif
83ebf5587eSBryan Drewery.elif !defined(KERN_OPTS)
84eec0e91eSWarner Losh# Add all the options that are mentioned in any opt_*.h file when we
85eec0e91eSWarner Losh# have a kernel build directory to pull them from.
8635c4406dSWarner LoshKERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u
87ebf5587eSBryan Drewery.export KERN_OPTS
8835c4406dSWarner Losh.endif
89ec4047adSBryan Drewery
90d395e093SBryan Drewery.if !defined(NO_MODULES) && !defined(__MPATH) && !make(install) && \
91d395e093SBryan Drewery    (empty(.MAKEFLAGS:M-V) || defined(NO_SKIP_MPATH))
92ec4047adSBryan Drewery__MPATH!=find ${SYSDIR:tA}/ -name \*_if.m
93ec4047adSBryan Drewery.export __MPATH
94ec4047adSBryan Drewery.endif
95