git: 66548ca4d871 - stable/13 - LinuxKPI: define LINUXKPI_INCLUDES for module builds as well

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 17 Oct 2022 20:41:42 UTC
The branch stable/13 has been updated by bz:

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

commit 66548ca4d8713279e3e7821137916da8857f9c76
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-09-23 21:18:45 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-10-17 20:37:05 +0000

    LinuxKPI: define LINUXKPI_INCLUDES for module builds as well
    
    While for in-kernel we already have LINUXKPI_INCLUDES in kern.pre.mk
    for kmod builds we've not had a common define to use leading to various
    spellings of include paths.
    
    In order for the include list to be expanded more easily in the future,
    e.g., adding the "dummy" includes (for all) and to harmonize code,
    duplicate LINUXKPI_INCLUDES to kmod.mk and use it for all module Makefiles.
    
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D36683
    
    (cherry picked from commit 514fb3872166a361faa81d89909f65913e90b1b2)
---
 sys/conf/kmod.mk                    | 3 +++
 sys/modules/axgbe/if_axa/Makefile   | 2 +-
 sys/modules/axgbe/if_axp/Makefile   | 2 +-
 sys/modules/cxgbe/iw_cxgbe/Makefile | 2 +-
 sys/modules/ibcore/Makefile         | 2 +-
 sys/modules/ipoib/Makefile          | 2 +-
 sys/modules/iser/Makefile           | 2 +-
 sys/modules/iwlwifi/Makefile        | 2 +-
 sys/modules/lindebugfs/Makefile     | 2 +-
 sys/modules/linuxkpi/Makefile       | 2 +-
 sys/modules/linuxkpi_wlan/Makefile  | 2 +-
 sys/modules/mlx4/Makefile           | 2 +-
 sys/modules/mlx4en/Makefile         | 2 +-
 sys/modules/mlx4ib/Makefile         | 2 +-
 sys/modules/mlx5/Makefile           | 2 +-
 sys/modules/mlx5en/Makefile         | 2 +-
 sys/modules/mlx5fpga_tools/Makefile | 2 +-
 sys/modules/mlx5ib/Makefile         | 2 +-
 sys/modules/mlxfw/Makefile          | 2 +-
 sys/modules/mthca/Makefile          | 2 +-
 sys/modules/qlnx/qlnxe/Makefile     | 2 +-
 sys/modules/qlnx/qlnxev/Makefile    | 2 +-
 sys/modules/qlnx/qlnxr/Makefile     | 2 +-
 sys/modules/rdma/krping/Makefile    | 2 +-
 sys/modules/rtw88/Makefile          | 2 +-
 25 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index 16174983bb32..36ea024dae9a 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -106,6 +106,9 @@ LINUXKPI_GENSRCS+= \
 	opt_usb.h \
 	opt_stack.h
 
+LINUXKPI_INCLUDES+= \
+	-I${SYSDIR}/compat/linuxkpi/common/include
+
 CFLAGS+=	${WERROR}
 CFLAGS+=	-D_KERNEL
 CFLAGS+=	-DKLD_MODULE
diff --git a/sys/modules/axgbe/if_axa/Makefile b/sys/modules/axgbe/if_axa/Makefile
index fd1cae37cacd..ed4d285b7ff1 100644
--- a/sys/modules/axgbe/if_axa/Makefile
+++ b/sys/modules/axgbe/if_axa/Makefile
@@ -7,6 +7,6 @@ SRCS    = device_if.h bus_if.h miibus_if.h ofw_bus_if.h ifdi_if.h vnode_if.h
 SRCS	+= opt_inet.h opt_inet6.h opt_rss.h opt_iflib.h opt_platform.h
 SRCS    += if_axgbe.c xgbe-sysctl.c xgbe_osdep.c xgbe-desc.c xgbe-drv.c xgbe-mdio.c xgbe-dev.c xgbe-i2c.c xgbe-phy-v1.c xgbe-txrx.c
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
diff --git a/sys/modules/axgbe/if_axp/Makefile b/sys/modules/axgbe/if_axp/Makefile
index 4253a529348c..60b8d24b0909 100644
--- a/sys/modules/axgbe/if_axp/Makefile
+++ b/sys/modules/axgbe/if_axp/Makefile
@@ -7,6 +7,6 @@ SRCS    = device_if.h bus_if.h miibus_if.h pci_if.h ifdi_if.h vnode_if.h
 SRCS	+= opt_inet.h opt_inet6.h opt_rss.h opt_iflib.h opt_platform.h
 SRCS    += if_axgbe_pci.c xgbe-sysctl.c xgbe_osdep.c xgbe-desc.c xgbe-drv.c xgbe-mdio.c xgbe-dev.c xgbe-i2c.c xgbe-phy-v2.c xgbe-txrx.c
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
diff --git a/sys/modules/cxgbe/iw_cxgbe/Makefile b/sys/modules/cxgbe/iw_cxgbe/Makefile
index 69ac1a4de752..54839dfec276 100644
--- a/sys/modules/cxgbe/iw_cxgbe/Makefile
+++ b/sys/modules/cxgbe/iw_cxgbe/Makefile
@@ -18,7 +18,7 @@ SRCS+=	opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h
 
 CFLAGS+= -I${CXGBE} -I${SRCTOP}/sys/ofed/include -DLINUX_TYPES_DEFINED
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
 CFLAGS+= -DINET6 -DINET
 
diff --git a/sys/modules/ibcore/Makefile b/sys/modules/ibcore/Makefile
index b2ab1ea2b317..801fcf9345ef 100644
--- a/sys/modules/ibcore/Makefile
+++ b/sys/modules/ibcore/Makefile
@@ -36,7 +36,7 @@ SRCS+=	opt_inet.h opt_inet6.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DINET6 -DINET -DCONFIG_INFINIBAND_USER_MEM
 
 EXPORT_SYMS=	YES
diff --git a/sys/modules/ipoib/Makefile b/sys/modules/ipoib/Makefile
index 2eb9f348e91b..b10a9150c04a 100644
--- a/sys/modules/ipoib/Makefile
+++ b/sys/modules/ipoib/Makefile
@@ -10,7 +10,7 @@ SRCS+=	opt_inet.h opt_inet6.h opt_ofed.h
 CFLAGS+= -I${SRCTOP}/sys/ofed/drivers/infiniband/ulp/ipoib
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
 
diff --git a/sys/modules/iser/Makefile b/sys/modules/iser/Makefile
index c24c42a0f6fb..4961c95599af 100644
--- a/sys/modules/iser/Makefile
+++ b/sys/modules/iser/Makefile
@@ -18,7 +18,7 @@ SRCS+=	opt_inet.h opt_inet6.h opt_cam.h icl_conn_if.h
 CFLAGS+= -I${SYSDIR}/
 CFLAGS+= -I${SYSDIR}/ofed/include
 CFLAGS+= -I${SYSDIR}/ofed/include/uapi
-CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
 CFLAGS+= -DINET6 -DINET
 CFLAGS+= -fms-extensions
diff --git a/sys/modules/iwlwifi/Makefile b/sys/modules/iwlwifi/Makefile
index 6b58949891ff..67493ca61105 100644
--- a/sys/modules/iwlwifi/Makefile
+++ b/sys/modules/iwlwifi/Makefile
@@ -35,7 +35,7 @@ SRCS+=	opt_wlan.h opt_inet6.h opt_inet.h opt_acpi.h
 CFLAGS+=	-DKBUILD_MODNAME='"iwlwifi"'
 
 CFLAGS+=	-I${DEVIWLWIFIDIR}
-CFLAGS+=	-I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+=	${LINUXKPI_INCLUDES}
 CFLAGS+=	-DCONFIG_IWLDVM=0
 CFLAGS+=	-DCONFIG_IWLMVM=1
 # Helpful after fresh imports.
diff --git a/sys/modules/lindebugfs/Makefile b/sys/modules/lindebugfs/Makefile
index da61fd519e96..024b945dfc6c 100644
--- a/sys/modules/lindebugfs/Makefile
+++ b/sys/modules/lindebugfs/Makefile
@@ -6,6 +6,6 @@ KMOD=	lindebugfs
 SRCS=	lindebugfs.c
 SRCS+=	${LINUXKPI_GENSRCS}
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile
index e34bd1e954d7..57fa81f969d6 100644
--- a/sys/modules/linuxkpi/Makefile
+++ b/sys/modules/linuxkpi/Makefile
@@ -40,7 +40,7 @@ SRCS+=	opt_acpi.h acpi_if.h linux_acpi.c linux_fpu.c
 SRCS+=	opt_ddb.h
 SRCS+=	${LINUXKPI_GENSRCS}
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
 
 EXPORT_SYMS=	YES
diff --git a/sys/modules/linuxkpi_wlan/Makefile b/sys/modules/linuxkpi_wlan/Makefile
index 4aba6f83137f..fccd1249bc72 100644
--- a/sys/modules/linuxkpi_wlan/Makefile
+++ b/sys/modules/linuxkpi_wlan/Makefile
@@ -8,7 +8,7 @@ SRCS=	linux_80211.c \
 SRCS+=	opt_wlan.h
 SRCS+=	${LINUXKPI_GENSRCS}
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 EXPORT_SYMS=	YES
 
diff --git a/sys/modules/mlx4/Makefile b/sys/modules/mlx4/Makefile
index 96818c2ef3d0..6cffacef5d7a 100644
--- a/sys/modules/mlx4/Makefile
+++ b/sys/modules/mlx4/Makefile
@@ -28,7 +28,7 @@ SRCS+=	opt_inet.h opt_inet6.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 EXPORT_SYMS=	YES
 
diff --git a/sys/modules/mlx4en/Makefile b/sys/modules/mlx4en/Makefile
index b03f93008333..34f24959b54b 100644
--- a/sys/modules/mlx4en/Makefile
+++ b/sys/modules/mlx4en/Makefile
@@ -14,6 +14,6 @@ SRCS+=	${LINUXKPI_GENSRCS}
 SRCS+=	opt_inet.h opt_inet6.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
diff --git a/sys/modules/mlx4ib/Makefile b/sys/modules/mlx4ib/Makefile
index dc819d7ef01d..2b0158e02544 100644
--- a/sys/modules/mlx4ib/Makefile
+++ b/sys/modules/mlx4ib/Makefile
@@ -21,7 +21,7 @@ SRCS+=	opt_inet.h opt_inet6.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
 CFLAGS+= -DINET6 -DINET
 
diff --git a/sys/modules/mlx5/Makefile b/sys/modules/mlx5/Makefile
index fcd6197e9488..2742a5f1ba90 100644
--- a/sys/modules/mlx5/Makefile
+++ b/sys/modules/mlx5/Makefile
@@ -39,7 +39,7 @@ SRCS+=	${LINUXKPI_GENSRCS}
 SRCS+=	opt_inet.h opt_inet6.h opt_rss.h opt_ratelimit.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .if defined(CONFIG_BUILD_FPGA)
 SRCS+= \
diff --git a/sys/modules/mlx5en/Makefile b/sys/modules/mlx5en/Makefile
index 4c192a860f4e..5dc413c5bfbe 100644
--- a/sys/modules/mlx5en/Makefile
+++ b/sys/modules/mlx5en/Makefile
@@ -30,7 +30,7 @@ CFLAGS+= -DCONFIG_MLX5_FPGA
 .endif
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
 
diff --git a/sys/modules/mlx5fpga_tools/Makefile b/sys/modules/mlx5fpga_tools/Makefile
index 23ae912589e2..697230ff61f3 100644
--- a/sys/modules/mlx5fpga_tools/Makefile
+++ b/sys/modules/mlx5fpga_tools/Makefile
@@ -10,7 +10,7 @@ SRCS+=	${LINUXKPI_GENSRCS}
 SRCS+= 	opt_inet.h opt_inet6.h opt_rss.h opt_ratelimit.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
 
diff --git a/sys/modules/mlx5ib/Makefile b/sys/modules/mlx5ib/Makefile
index c1d11b5b3801..6e3a1b6d9079 100644
--- a/sys/modules/mlx5ib/Makefile
+++ b/sys/modules/mlx5ib/Makefile
@@ -20,7 +20,7 @@ SRCS+= 	opt_inet.h opt_inet6.h opt_ratelimit.h opt_rss.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
 
 .if defined(CONFIG_BUILD_FPGA)
diff --git a/sys/modules/mlxfw/Makefile b/sys/modules/mlxfw/Makefile
index 3ab9b0f3950d..18f6128d9278 100644
--- a/sys/modules/mlxfw/Makefile
+++ b/sys/modules/mlxfw/Makefile
@@ -10,7 +10,7 @@ SRCS+=	${LINUXKPI_GENSRCS}
 
 CFLAGS+= \
 	-I${SRCTOP}/sys/ofed/include \
-	-I${SRCTOP}/sys/compat/linuxkpi/common/include \
+	${LINUXKPI_INCLUDES} \
 	-I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
 	-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz
 
diff --git a/sys/modules/mthca/Makefile b/sys/modules/mthca/Makefile
index 584a86b6ada7..d7807157f50c 100644
--- a/sys/modules/mthca/Makefile
+++ b/sys/modules/mthca/Makefile
@@ -26,7 +26,7 @@ SRCS+=	opt_inet.h opt_inet6.h
 
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
 CFLAGS+= -DINET6 -DINET
 
diff --git a/sys/modules/qlnx/qlnxe/Makefile b/sys/modules/qlnx/qlnxe/Makefile
index 718040776496..6013f3ee6c2c 100644
--- a/sys/modules/qlnx/qlnxe/Makefile
+++ b/sys/modules/qlnx/qlnxe/Makefile
@@ -69,7 +69,7 @@ CFLAGS += -DECORE_PACKAGE
 CFLAGS += -DCONFIG_ECORE_L2
 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 #CFLAGS += -g
 #CFLAGS += -fno-inline
diff --git a/sys/modules/qlnx/qlnxev/Makefile b/sys/modules/qlnx/qlnxev/Makefile
index 4c79eee59a55..89ba62cd3027 100644
--- a/sys/modules/qlnx/qlnxev/Makefile
+++ b/sys/modules/qlnx/qlnxev/Makefile
@@ -60,7 +60,7 @@ CFLAGS += -DECORE_PACKAGE
 CFLAGS += -DCONFIG_ECORE_L2
 CFLAGS += -DECORE_CONFIG_DIRECT_HWFN
 
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 CFLAGS += -g
 CFLAGS += -fno-inline
diff --git a/sys/modules/qlnx/qlnxr/Makefile b/sys/modules/qlnx/qlnxr/Makefile
index f193ff09e7ef..f02089588942 100644
--- a/sys/modules/qlnx/qlnxr/Makefile
+++ b/sys/modules/qlnx/qlnxr/Makefile
@@ -54,7 +54,7 @@ CFLAGS+= -I${.CURDIR}
 CFLAGS+= -I${ETHDRVR}
 CFLAGS+= -I${OFEDDIR}/ofed/include
 CFLAGS+= -I${OFEDDIR}/ofed/include/uapi
-CFLAGS+= -I${OFEDDIR}/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 CFLAGS+= -DLINUX_TYPES_DEFINED
 CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
diff --git a/sys/modules/rdma/krping/Makefile b/sys/modules/rdma/krping/Makefile
index 97c2fdedb91d..7f3a4962190e 100644
--- a/sys/modules/rdma/krping/Makefile
+++ b/sys/modules/rdma/krping/Makefile
@@ -7,6 +7,6 @@ SRCS+=	${LINUXKPI_GENSRCS}
 SRCS+=  opt_inet.h opt_inet6.h
 CFLAGS+= -I${SRCTOP}/sys/ofed/include
 CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi
-CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+= ${LINUXKPI_INCLUDES}
 
 .include <bsd.kmod.mk>
diff --git a/sys/modules/rtw88/Makefile b/sys/modules/rtw88/Makefile
index a8880256eeae..396dd91726b2 100644
--- a/sys/modules/rtw88/Makefile
+++ b/sys/modules/rtw88/Makefile
@@ -29,7 +29,7 @@ SRCS+=	opt_wlan.h opt_inet6.h opt_inet.h
 CFLAGS+=	-DKBUILD_MODNAME='"rtw88"'
 
 CFLAGS+=	-I${DEVRTW88DIR}
-CFLAGS+=	-I${SRCTOP}/sys/compat/linuxkpi/common/include
+CFLAGS+=	${LINUXKPI_INCLUDES}
 CFLAGS+=	-DCONFIG_RTW88_DEBUG
 #CFLAGS+=	-DCONFIG_RTW88_DEBUGFS