From 600da0c9c2a133a3154bd5ad6df428d8e3256e30 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 16 Feb 2021 16:51:47 -0500 Subject: [PATCH] fix: remove 'src/' from modules install path The move of the modules sources in the 'src/' subdirectory had the unexpected side effect of adding 'src/' to the module install path inside '/lib/modules/$(uname -r)/extra'. Adjust the Makefiles to return to the initial behavior. Change-Id: I280fe8a1e5ef367edeec0a6351351a233cc6f0be Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: Ifcc64ea95c0e1435567150d976d42e3add3f7523 --- Makefile | 39 ++++--------------- src/Kbuild | 23 ++++++++++- Kbuild.common => src/Kbuild.common | 0 Kconfig => src/Kconfig | 0 src/lib/Kbuild | 2 +- src/probes/Kbuild | 2 +- {tests => src/tests}/Kbuild | 4 +- {tests => src/tests}/Kconfig | 0 .../clock-plugin/lttng-clock-plugin-test.c | 0 {tests => src/tests}/probes/lttng-test.c | 0 10 files changed, 34 insertions(+), 36 deletions(-) rename Kbuild.common => src/Kbuild.common (100%) rename Kconfig => src/Kconfig (100%) rename {tests => src/tests}/Kbuild (86%) rename {tests => src/tests}/Kconfig (100%) rename {tests => src/tests}/clock-plugin/lttng-clock-plugin-test.c (100%) rename {tests => src/tests}/probes/lttng-test.c (100%) diff --git a/Makefile b/Makefile index c586efed..37eb389b 100644 --- a/Makefile +++ b/Makefile @@ -2,33 +2,10 @@ ifneq ($(KERNELRELEASE),) - # This part of the Makefile is used when called by the kernel build system - # and defines the modules to be built. - - ifdef CONFIG_LOCALVERSION # Check if dot-config is included. - ifeq ($(CONFIG_TRACEPOINTS),) - $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) - endif # CONFIG_TRACEPOINTS - endif # ifdef CONFIG_LOCALVERSION - - TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST))) - - lttng_check_linux_version = $(shell pwd)/include/linux/version.h - lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h - - # - # Check for stale version.h, which can be a leftover from an old Linux - # kernel tree moved to a newer kernel version, only pruned by make - # distclean. - # - ifneq ($(wildcard $(lttng_check_linux_version)),) - ifneq ($(wildcard $(lttng_check_generated_linux_version)),) - $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file) - endif - endif - - obj-$(CONFIG_LTTNG) += src/ - obj-$(CONFIG_LTTNG) += tests/ +# This part of the Makefile is used when called by the kernel build system +# and defines the modules to be built. + +obj-$(CONFIG_LTTNG) += src/ else # KERNELRELEASE @@ -43,15 +20,15 @@ CFLAGS = $(EXTCFLAGS) default: modules modules: - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules modules_install: - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m modules_install clean: - $(MAKE) -C $(KERNELDIR) M=$(PWD) clean + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src clean %.i: %.c - $(MAKE) -C $(KERNELDIR) M=$(PWD) CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@ + $(MAKE) -C $(KERNELDIR) M=$(PWD)/src CONFIG_LTTNG=m CONFIG_LTTNG_CLOCK_PLUGIN_TEST=m $@ endif # KERNELRELEASE diff --git a/src/Kbuild b/src/Kbuild index e7593fd8..a5a840a7 100644 --- a/src/Kbuild +++ b/src/Kbuild @@ -1,8 +1,28 @@ # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) +ifdef CONFIG_LOCALVERSION # Check if dot-config is included. + ifeq ($(CONFIG_TRACEPOINTS),) + $(error The option CONFIG_TRACEPOINTS needs to be enabled in your kernel configuration) + endif # CONFIG_TRACEPOINTS +endif # ifdef CONFIG_LOCALVERSION + TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/.. -include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common +lttng_check_linux_version = $(shell pwd)/include/linux/version.h +lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h + +# +# Check for stale version.h, which can be a leftover from an old Linux +# kernel tree moved to a newer kernel version, only pruned by make +# distclean. +# +ifneq ($(wildcard $(lttng_check_linux_version)),) + ifneq ($(wildcard $(lttng_check_generated_linux_version)),) + $(error Duplicate version.h files found in $(lttng_check_linux_version) and $(lttng_check_generated_linux_version). Consider running make distclean on your kernel, or removing the stale $(lttng_check_linux_version) file) + endif +endif + +include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include @@ -125,3 +145,4 @@ lttng-statedump-objs := lttng-statedump-impl.o obj-$(CONFIG_LTTNG) += probes/ obj-$(CONFIG_LTTNG) += lib/ +obj-$(CONFIG_LTTNG) += tests/ diff --git a/Kbuild.common b/src/Kbuild.common similarity index 100% rename from Kbuild.common rename to src/Kbuild.common diff --git a/Kconfig b/src/Kconfig similarity index 100% rename from Kconfig rename to src/Kconfig diff --git a/src/lib/Kbuild b/src/lib/Kbuild index b0f49b6b..b356736c 100644 --- a/src/lib/Kbuild +++ b/src/lib/Kbuild @@ -2,7 +2,7 @@ TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../.. -include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common +include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include diff --git a/src/probes/Kbuild b/src/probes/Kbuild index 0fc7e9c2..e26b4359 100644 --- a/src/probes/Kbuild +++ b/src/probes/Kbuild @@ -2,7 +2,7 @@ TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../.. -include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common +include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include diff --git a/tests/Kbuild b/src/tests/Kbuild similarity index 86% rename from tests/Kbuild rename to src/tests/Kbuild index 906cbac8..9cf13342 100644 --- a/tests/Kbuild +++ b/src/tests/Kbuild @@ -1,8 +1,8 @@ # SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) -TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/.. +TOP_LTTNG_MODULES_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/../.. -include $(TOP_LTTNG_MODULES_DIR)/Kbuild.common +include $(TOP_LTTNG_MODULES_DIR)/src/Kbuild.common ccflags-y += -I$(TOP_LTTNG_MODULES_DIR)/include diff --git a/tests/Kconfig b/src/tests/Kconfig similarity index 100% rename from tests/Kconfig rename to src/tests/Kconfig diff --git a/tests/clock-plugin/lttng-clock-plugin-test.c b/src/tests/clock-plugin/lttng-clock-plugin-test.c similarity index 100% rename from tests/clock-plugin/lttng-clock-plugin-test.c rename to src/tests/clock-plugin/lttng-clock-plugin-test.c diff --git a/tests/probes/lttng-test.c b/src/tests/probes/lttng-test.c similarity index 100% rename from tests/probes/lttng-test.c rename to src/tests/probes/lttng-test.c -- 2.34.1