From 73e6ea9ce66698e4efc68df4e7c5ad78d692bf2e Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Mon, 14 Aug 2023 10:32:01 +0200 Subject: [PATCH] support out-of-tree build by replacing `src` variable in Kbuild files. --- Makefile.kbuild | 2 +- devices/Kbuild.in | 3 +++ devices/ccat/Kbuild.in | 3 +++ devices/e1000/Kbuild.in | 3 +++ devices/e1000e/Kbuild.in | 3 +++ devices/igb/Kbuild.in | 3 +++ examples/dc_rtai/Kbuild.in | 3 +++ examples/mini/Kbuild.in | 2 ++ examples/rtai/Kbuild.in | 3 +++ examples/tty/Kbuild.in | 3 +++ master/Kbuild.in | 3 +++ tty/Kbuild.in | 3 +++ 12 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Makefile.kbuild b/Makefile.kbuild index a9439e36..92156104 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -3,7 +3,7 @@ # ``` # include $(top_srcdir)/Makefile.kbuild # ``` -KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_srcdir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" +KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_builddir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules: diff --git a/devices/Kbuild.in b/devices/Kbuild.in index d3a28b68..7c589e72 100644 --- a/devices/Kbuild.in +++ b/devices/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + REV := $(shell if test -s $(src)/../revision; then \ cat $(src)/../revision; \ else \ diff --git a/devices/ccat/Kbuild.in b/devices/ccat/Kbuild.in index 1ee8dbca..99d8ac5f 100644 --- a/devices/ccat/Kbuild.in +++ b/devices/ccat/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + TOPDIR := $(src)/../.. ifeq (@ENABLE_CCAT@,1) diff --git a/devices/e1000/Kbuild.in b/devices/e1000/Kbuild.in index c460d79c..6836fe4d 100644 --- a/devices/e1000/Kbuild.in +++ b/devices/e1000/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + TOPDIR := $(src)/../.. REV := $(shell if test -s $(TOPDIR)/revision; then \ diff --git a/devices/e1000e/Kbuild.in b/devices/e1000e/Kbuild.in index abe4bdbc..93eb6ed3 100644 --- a/devices/e1000e/Kbuild.in +++ b/devices/e1000e/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + TOPDIR := $(src)/../.. REV := $(shell if test -s $(TOPDIR)/revision; then \ diff --git a/devices/igb/Kbuild.in b/devices/igb/Kbuild.in index 762ff49a..f8ef3857 100644 --- a/devices/igb/Kbuild.in +++ b/devices/igb/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + TOPDIR := $(src)/../.. REV := $(shell if test -s $(TOPDIR)/revision; then \ diff --git a/examples/dc_rtai/Kbuild.in b/examples/dc_rtai/Kbuild.in index 57a04a51..083c9c44 100644 --- a/examples/dc_rtai/Kbuild.in +++ b/examples/dc_rtai/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + obj-m := ec_dc_rtai_sample.o ec_dc_rtai_sample-objs := dc_rtai_sample.o diff --git a/examples/mini/Kbuild.in b/examples/mini/Kbuild.in index 5d6cc99a..2649a896 100644 --- a/examples/mini/Kbuild.in +++ b/examples/mini/Kbuild.in @@ -31,6 +31,8 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ + obj-m := ec_mini.o ec_mini-objs := mini.o diff --git a/examples/rtai/Kbuild.in b/examples/rtai/Kbuild.in index f3b4ede5..c29a961a 100644 --- a/examples/rtai/Kbuild.in +++ b/examples/rtai/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + obj-m := ec_rtai_sample.o ec_rtai_sample-objs := rtai_sample.o diff --git a/examples/tty/Kbuild.in b/examples/tty/Kbuild.in index 132259bc..2a93b34a 100644 --- a/examples/tty/Kbuild.in +++ b/examples/tty/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + obj-m := ec_tty_example.o ec_tty_example-objs := \ diff --git a/master/Kbuild.in b/master/Kbuild.in index 98b9e6cd..d67e22e9 100644 --- a/master/Kbuild.in +++ b/master/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + obj-m := ec_master.o ec_master-objs := \ diff --git a/tty/Kbuild.in b/tty/Kbuild.in index 16ddd0b6..09cdf377 100644 --- a/tty/Kbuild.in +++ b/tty/Kbuild.in @@ -31,6 +31,9 @@ # #------------------------------------------------------------------------------ +src := @abs_srcdir@ +ccflags-y := -I@abs_top_builddir@ + obj-m := ec_tty.o ec_tty-objs := \