From 73e6ea9ce66698e4efc68df4e7c5ad78d692bf2e Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Mon, 14 Aug 2023 10:32:01 +0200 Subject: [PATCH 1/3] 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 := \ From d96742620477d7ee4e310b9e356f9b338a552395 Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Mon, 14 Aug 2023 11:29:23 +0200 Subject: [PATCH 2/3] add missing EXTRA_DIST --- devices/ccat/Makefile.am | 8 +++++++- master/Makefile.am | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devices/ccat/Makefile.am b/devices/ccat/Makefile.am index 35b1e2a8..9aa3a8de 100644 --- a/devices/ccat/Makefile.am +++ b/devices/ccat/Makefile.am @@ -29,8 +29,14 @@ include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ + gpio.c \ + module.c \ module.h \ + netdev.c \ netdev.h \ - update.h + sram.c \ + update.h \ + update.c + #------------------------------------------------------------------------------ diff --git a/master/Makefile.am b/master/Makefile.am index cbd7cf59..5a8e92f8 100644 --- a/master/Makefile.am +++ b/master/Makefile.am @@ -39,6 +39,7 @@ noinst_HEADERS = \ domain.c domain.h \ doxygen.c \ ethernet.c ethernet.h \ + flag.c flag.h \ fmmu_config.c fmmu_config.h \ foe.h \ foe_request.c foe_request.h \ From 88080a2da17d4bd3d3832a1369d750806b8279ec Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Mon, 14 Aug 2023 11:34:29 +0200 Subject: [PATCH 3/3] build dist in ci and test out-of-tree build --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae231ce6..91a19d06 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,12 @@ build: - ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat - make -j8 all modules - make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck + - make dist + - mkdir test_dist && cd test_dist && tar xzf ../ethercat-*.tar.gz && cd ethercat-*/ + - mkdir build && cd build + - ../configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat + - make -j8 all modules + # Build ethercat tool subcommand help output for documentation commands: