diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5a42d40..a663184e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,7 @@ build: - ./bootstrap - ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too - make -j8 all modules + - make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck include: - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' - diff --git a/Makefile.am b/Makefile.am index 21b386ca..948fc342 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild ACLOCAL_AMFLAGS = -I m4 @@ -67,20 +68,13 @@ EXTRA_DIST = \ README.EoE \ ethercat.spec -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - mydist: git -C $(srcdir) log > ChangeLog @REV=`git -C $(srcdir) describe` && \ $(MAKE) dist-bzip2 distdir=$(PACKAGE)-$(VERSION)-$${REV} dist-hook: - if which git >/dev/null 2>&1; then \ + -if which git >/dev/null 2>&1; then \ git -C $(srcdir) describe 2>/dev/null >$(distdir)/revision; \ fi diff --git a/Makefile.kbuild b/Makefile.kbuild new file mode 100644 index 00000000..a419b939 --- /dev/null +++ b/Makefile.kbuild @@ -0,0 +1,29 @@ +# Shared makefile code providing support for Kbuild make. It is included +# by every `Makefile.am` that needs Kbuild support with: +# ``` +# include $(top_srcdir)/Makefile.kbuild +# ``` +KBUILD = $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="$(abs_srcdir)" INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" + + +modules: + $(KBUILD) modules + +modules_install: + $(KBUILD) modules_install + + +# Call Kbuild clean *before* automake `clean` (see #5 for the rationale) +# by adding `kbuild-clean` to the clean prerequisites. Having targets +# with the same name will result in merging the prerequisites, i.e.: +# ``` +# # Equivalent to 'clean: prerequisite1 prerequisite2' +# clean: prerequisite1 +# clean: prerequisite2 +# ``` +clean: kbuild-clean + +kbuild-clean: + $(KBUILD) clean + +.PHONY: kbuild-clean diff --git a/configure.ac b/configure.ac index dd639e13..2b08bd8a 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,8 @@ AC_PREREQ(2.59) # AC_INIT([ethercat],[1.5.2],[fp@igh-essen.com]) AC_CONFIG_AUX_DIR([autoconf]) -AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 subdir-objects]) +AM_INIT_AUTOMAKE([-Wall -Wno-override -Werror dist-bzip2 subdir-objects]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/devices/Makefile.am b/devices/Makefile.am index 28342dfd..39fbfaf1 100644 --- a/devices/Makefile.am +++ b/devices/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild SUBDIRS = \ ccat \ @@ -174,14 +175,4 @@ noinst_HEADERS = \ r8169-4.4-ethercat.c \ r8169-4.4-orig.c -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/devices/ccat/Makefile.am b/devices/ccat/Makefile.am index 1ff5ea80..35b1e2a8 100644 --- a/devices/ccat/Makefile.am +++ b/devices/ccat/Makefile.am @@ -26,20 +26,11 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ module.h \ netdev.h \ update.h -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/devices/e1000/Makefile.am b/devices/e1000/Makefile.am index 9d69638f..5c5513dc 100644 --- a/devices/e1000/Makefile.am +++ b/devices/e1000/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ LICENSE \ @@ -352,15 +353,4 @@ EXTRA_DIST = \ e1000_param-4.4-ethercat.c \ e1000_param-4.4-orig.c - -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/devices/e1000e/Makefile.am b/devices/e1000e/Makefile.am index 163c02d9..82b69710 100644 --- a/devices/e1000e/Makefile.am +++ b/devices/e1000e/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ 80003es2lan-3.10-ethercat.c \ @@ -460,14 +461,4 @@ EXTRA_DIST = \ regs-4.4-orig.h \ update.sh -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/devices/igb/Makefile.am b/devices/igb/Makefile.am index df5d43c8..52ebf57f 100644 --- a/devices/igb/Makefile.am +++ b/devices/igb/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ e1000_82575-3.18-ethercat.c \ @@ -110,14 +111,4 @@ EXTRA_DIST = \ igb_ptp-4.4-orig.c \ update.sh -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/examples/Makefile.am b/examples/Makefile.am index 0ed68a0e..2cc41d40 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild SUBDIRS = diff --git a/examples/dc_rtai/Makefile.am b/examples/dc_rtai/Makefile.am index 164936cf..b070b3b2 100644 --- a/examples/dc_rtai/Makefile.am +++ b/examples/dc_rtai/Makefile.am @@ -28,18 +28,9 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ dc_rtai_sample.c -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/examples/mini/Makefile.am b/examples/mini/Makefile.am index cbc0ae32..888caa83 100644 --- a/examples/mini/Makefile.am +++ b/examples/mini/Makefile.am @@ -30,18 +30,9 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ mini.c -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/examples/rtai/Makefile.am b/examples/rtai/Makefile.am index a73ea81a..5b5b9678 100644 --- a/examples/rtai/Makefile.am +++ b/examples/rtai/Makefile.am @@ -28,18 +28,9 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild EXTRA_DIST = \ rtai_sample.c -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/examples/tty/Makefile.am b/examples/tty/Makefile.am index 2f3d0b2c..ec76fc24 100644 --- a/examples/tty/Makefile.am +++ b/examples/tty/Makefile.am @@ -30,20 +30,11 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild noinst_HEADERS = \ serial.c \ serial.h \ tty.c -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/lib/Makefile.am b/lib/Makefile.am index b3f27bc0..4d9879ed 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -79,6 +79,11 @@ cmakedir = $(libdir)/cmake cmake_DATA = EtherCATConfig.cmake +EXTRA_DIST = EtherCATConfig.cmake.in + +CLEANFILES = $(cmake_DATA) + + #------------------------------------------------------------------------------ if ENABLE_RTDM diff --git a/master/Makefile.am b/master/Makefile.am index c7ea3ed7..cbd7cf59 100644 --- a/master/Makefile.am +++ b/master/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild # using HEADERS to enable tags target noinst_HEADERS = \ @@ -74,14 +75,4 @@ noinst_HEADERS = \ sync_config.c sync_config.h \ voe_handler.c voe_handler.h -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------ diff --git a/tty/Makefile.am b/tty/Makefile.am index 0060714f..a445b38f 100644 --- a/tty/Makefile.am +++ b/tty/Makefile.am @@ -26,6 +26,7 @@ # industrial property and similar rights of Beckhoff Automation GmbH. # #------------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.kbuild # using HEADERS to enable tags target noinst_HEADERS = \ @@ -34,14 +35,4 @@ noinst_HEADERS = \ EXTRA_DIST = \ README -modules: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" modules - -modules_install: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" \ - INSTALL_MOD_DIR="$(INSTALL_MOD_DIR)" modules_install - -clean-local: - $(MAKE) -C "$(LINUX_SOURCE_DIR)" M="@abs_srcdir@" clean - #------------------------------------------------------------------------------