kmod build: start generating opt_global.h, include it

For untied module builds, we'll generate opt_foo headers if they're included
in SRCS. However, options that would normally be represented in opt_global.h
aren't properly represented.

Start generating opt_global.h with #define VIMAGE for !mips since it's
almost universally a project default and right now kmods must hack it in
themselves in order to be properly compiled for the default kernel. For
example, ^/sys/modules/pf/Makefile

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D23345
This commit is contained in:
Kyle Evans 2020-01-29 18:50:55 +00:00
parent fbd46fe94a
commit 0c4c594841
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357265
2 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,10 @@
# the code here when they all produce identical results
# (or should)
.if !defined(KERNBUILDDIR)
opt_global.h:
.if ${MACHINE} != "mips"
@echo "#define VIMAGE 1" > ${.TARGET}
.endif
opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
.if ${MK_INET_SUPPORT} != "no"

View File

@ -106,6 +106,9 @@ NOSTDINC= -nostdinc
CFLAGS:= ${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*}
.if defined(KERNBUILDDIR)
CFLAGS+= -DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/opt_global.h
.else
SRCS+= opt_global.h
CFLAGS+= -include ${.OBJDIR}/opt_global.h
.endif
# Add -I paths for system headers. Individual module makefiles don't