git: e1e47070ed8b - main - build: sys: Define CPPFLAGS variable, to be used in 'files*'

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Thu, 19 Nov 2026 14:50:26 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1e47070ed8b12e3b294cff1207be24a68a8393c

commit e1e47070ed8b12e3b294cff1207be24a68a8393c
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-11-03 21:42:13 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-19 14:49:54 +0000

    build: sys: Define CPPFLAGS variable, to be used in 'files*'
    
    Define the CPPFLAGS Makefile variable to contain the preprocessor
    options that are passed for compilation of normal C files, including
    usual '-I' and '-D' directives.
    
    This enables safely using the preprocessor in 'files*' on "template"
    source files to generate other source files (see next commit).
    
    Do not define NORMAL_CPP (as discussed with des@), as other NORMAL_*
    variables do include ${.IMPSRC} and thus NORMAL_CPP would need to
    include it for consistency, making it unusable to generate files through
    explicit make rules.
    
    Discussed with: des (do not define NORMAL_CPP)
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D61168
---
 sys/conf/kern.pre.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 347ff6ee90ff..d17a25ef1636 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -75,7 +75,8 @@ NOSTDINC= -nostdinc
 INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S -I$S/contrib/ck/include
 
 CFLAGS=	${COPTFLAGS} ${DEBUG}
-CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
+CPPFLAGS= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
+CFLAGS+= ${CPPFLAGS}
 CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100
 CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
 CFLAGS.gcc+= -finline-limit=${INLINE_LIMIT}