public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Elliott Mitchell <ehem+linux@m5p.com>
To: masahiroy@kernel.org, nathan@kernel.org, nicolas@fjasle.eu
Cc: linux-kbuild@vger.kernel.org
Subject: [WIP PATCH 13/30] scripts: modify uses of $(objtree) to assume trailing slash
Date: Sun, 3 Mar 2024 15:24:50 -0800	[thread overview]
Message-ID: <491ac1cbd85474eff9e189d0a64945f2f79cc8cc.1709508291.git.ehem+linux@m5p.com> (raw)
In-Reply-To: <cover.1709508290.git.ehem+linux@m5p.com>

Date: Tue, 20 Feb 2024 09:13:37 -0800

This isn't much more than `find | sed` to adjust all uses of $(objtree).
This is split into a separate commit to highlight the actual changes to
the build machinery.

Signed-off-by: Elliott Mitchell <ehem+linux@m5p.com>
---
`grep` was also used to locate things which needed other actions
(notably the non-toplevel Makefile adjustments), but this is roughly:
find . -name Makefile\* -print0 | xargs -0 sed -i -e's,$(objtree)$,$(objtree:%/=%),' -e's,$(objtree)\([^,/]\),$(objtree:%/=%)\1,g' -es',$(objtree)/,$(objtree),g'

There could be goofs in here or missed bits.  I hope not, but...
---
 scripts/Makefile.build       |  8 ++++----
 scripts/Makefile.defconf     |  4 ++--
 scripts/Makefile.gcc-plugins |  2 +-
 scripts/Makefile.headersinst |  2 +-
 scripts/Makefile.host        |  6 +++---
 scripts/Makefile.kcov        |  2 +-
 scripts/Makefile.lib         | 18 +++++++++---------
 scripts/Makefile.package     |  8 ++++----
 scripts/Makefile.randstruct  |  4 ++--
 scripts/basic/Makefile       |  2 +-
 scripts/gcc-plugins/Makefile |  2 +-
 scripts/selinux/mdp/Makefile |  2 +-
 12 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 176e1909b055..46fc6f2efe1a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -192,7 +192,7 @@ endif
 # files, including recordmcount.
 sub_cmd_record_mcount =					\
 	if [ $(@) != "scripts/mod/empty.o" ]; then	\
-		$(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)";	\
+		$(objtree)scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)";	\
 	fi;
 recordmcount_source := $(srctree)scripts/recordmcount.c \
 		    $(srctree)scripts/recordmcount.h
@@ -273,7 +273,7 @@ rust_common_cmd = \
 	-Zcrate-attr=no_std \
 	-Zcrate-attr='feature($(rust_allowed_features))' \
 	--extern alloc --extern kernel \
-	--crate-type rlib -L $(objtree)/rust/ \
+	--crate-type rlib -L $(objtree)rust/ \
 	--crate-name $(basename $(notdir $@)) \
 	--sysroot=/dev/null \
 	--out-dir $(dir $@) --emit=dep-info=$(depfile)
@@ -376,10 +376,10 @@ $(obj)/%.lds: $(src)/%.lds.S FORCE
 # ASN.1 grammar
 # ---------------------------------------------------------------------------
 quiet_cmd_asn1_compiler = ASN.1   $(basename $@).[ch]
-      cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
+      cmd_asn1_compiler = $(objtree)scripts/asn1_compiler $< \
 				$(basename $@).c $(basename $@).h
 
-$(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
+$(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)scripts/asn1_compiler
 	$(call cmd,asn1_compiler)
 
 # Build the compiled-in targets
diff --git a/scripts/Makefile.defconf b/scripts/Makefile.defconf
index ff6a8345d1bf..51d27001abf3 100644
--- a/scripts/Makefile.defconf
+++ b/scripts/Makefile.defconf
@@ -9,7 +9,7 @@
 # Input config fragments without '.config' suffix
 define merge_into_defconfig
 	$(Q)$(CONFIG_SHELL) $(srctree)scripts/kconfig/merge_config.sh \
-		-m -O $(objtree) $(srctree)arch/$(SRCARCH)/configs/$(1) \
+		-m -O $(objtree:%/=%) $(srctree)arch/$(SRCARCH)/configs/$(1) \
 		$(foreach config,$(2),$(srctree)arch/$(SRCARCH)/configs/$(config).config)
 	+$(Q)$(MAKE) -f $(srctree)Makefile olddefconfig
 endef
@@ -23,7 +23,7 @@ endef
 # Input config fragments without '.config' suffix
 define merge_into_defconfig_override
 	$(Q)$(CONFIG_SHELL) $(srctree)scripts/kconfig/merge_config.sh \
-		-Q -m -O $(objtree) $(srctree)arch/$(SRCARCH)/configs/$(1) \
+		-Q -m -O $(objtree:%/=%) $(srctree)arch/$(SRCARCH)/configs/$(1) \
 		$(foreach config,$(2),$(srctree)arch/$(SRCARCH)/configs/$(config).config)
 	+$(Q)$(MAKE) -f $(srctree)Makefile olddefconfig
 endef
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index e4deaf5fa571..f335e0d1399e 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -44,7 +44,7 @@ export DISABLE_ARM_SSP_PER_TASK_PLUGIN
 
 # All the plugin CFLAGS are collected here in case a build target needs to
 # filter them out of the KBUILD_CFLAGS.
-GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
+GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
 export GCC_PLUGINS_CFLAGS
 
 # Add the flags to the build!
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index a6423d395c02..bafb60333e47 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -15,7 +15,7 @@ __headers:
 include $(srctree)scripts/Kbuild.include
 
 src := $(srctree)$(obj)
-gen := $(objtree)/$(subst include/,include/generated/,$(obj))
+gen := $(objtree)$(subst include/,include/generated/,$(obj))
 dst := usr/include
 
 -include $(src)/Kbuild
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 08d83d9db31a..7c6ebbe9c728 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -96,11 +96,11 @@ hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \
                  $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \
                  $(HOSTRUSTFLAGS_$(target-stem))
 
-# $(objtree)/$(obj) for including generated headers from checkin source files
+# $(objtree)$(obj) for including generated headers from checkin source files
 ifeq ($(KBUILD_EXTMOD),)
 ifdef building_out_of_srctree
-hostc_flags   += -I $(objtree)/$(obj)
-hostcxx_flags += -I $(objtree)/$(obj)
+hostc_flags   += -I $(objtree)$(obj)
+hostcxx_flags += -I $(objtree)$(obj)
 endif
 endif
 
diff --git a/scripts/Makefile.kcov b/scripts/Makefile.kcov
index 67e8cfe3474b..5d3d3d711b7a 100644
--- a/scripts/Makefile.kcov
+++ b/scripts/Makefile.kcov
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 kcov-flags-$(CONFIG_CC_HAS_SANCOV_TRACE_PC)	+= -fsanitize-coverage=trace-pc
 kcov-flags-$(CONFIG_KCOV_ENABLE_COMPARISONS)	+= -fsanitize-coverage=trace-cmp
-kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV)		+= -fplugin=$(objtree)/scripts/gcc-plugins/sancov_plugin.so
+kcov-flags-$(CONFIG_GCC_PLUGIN_SANCOV)		+= -fplugin=$(objtree)scripts/gcc-plugins/sancov_plugin.so
 
 export CFLAGS_KCOV := $(kcov-flags-y)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1c77fc1185e5..34aa26fe54f8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -201,12 +201,12 @@ _c_flags += $(if $(patsubst n%,, \
 endif
 
 # $(srctree)$(src) for including checkin headers from generated source files
-# $(objtree)/$(obj) for including generated headers from checkin source files
+# $(objtree)$(obj) for including generated headers from checkin source files
 ifeq ($(KBUILD_EXTMOD),)
 ifdef building_out_of_srctree
-_c_flags   += -I $(srctree)$(src) -I $(objtree)/$(obj)
-_a_flags   += -I $(srctree)$(src) -I $(objtree)/$(obj)
-_cpp_flags += -I $(srctree)$(src) -I $(objtree)/$(obj)
+_c_flags   += -I $(srctree)$(src) -I $(objtree)$(obj)
+_a_flags   += -I $(srctree)$(src) -I $(objtree)$(obj)
+_cpp_flags += -I $(srctree)$(src) -I $(objtree)$(obj)
 endif
 endif
 
@@ -232,7 +232,7 @@ c_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 		 $(_c_flags) $(modkern_cflags)                           \
 		 $(basename_flags) $(modname_flags)
 
-rust_flags     = $(_rust_flags) $(modkern_rustflags) @$(objtree)/include/generated/rustc_cfg
+rust_flags     = $(_rust_flags) $(modkern_rustflags) @$(objtree)include/generated/rustc_cfg
 
 a_flags        = -Wp,-MMD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 		 $(_a_flags) $(modkern_aflags)
@@ -250,7 +250,7 @@ dtc_cpp_flags  = -Wp,-MMD,$(depfile).pre.tmp -nostdinc                    \
 
 ifdef CONFIG_OBJTOOL
 
-objtool := $(objtree)/tools/objtool/objtool
+objtool := $(objtree)tools/objtool/objtool
 
 objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK)		+= --hacks=jump_label
 objtool-args-$(CONFIG_HAVE_NOINSTR_HACK)		+= --hacks=noinstr
@@ -339,7 +339,7 @@ quiet_cmd_gzip = GZIP    $@
 
 # DTC
 # ---------------------------------------------------------------------------
-DTC ?= $(objtree)/scripts/dtc/dtc
+DTC ?= $(objtree)scripts/dtc/dtc
 DTC_FLAGS += -Wno-interrupt_provider \
 	-Wno-unique_unit_address
 
@@ -396,7 +396,7 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
 	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
 
 quiet_cmd_fdtoverlay = DTOVL   $@
-      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
+      cmd_fdtoverlay = $(objtree)scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
 
 $(multi-dtb-y): FORCE
 	$(call if_changed,fdtoverlay)
@@ -406,7 +406,7 @@ ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
 DT_CHECKER ?= dt-validate
 DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
 DT_BINDING_DIR := Documentation/devicetree/bindings
-DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
+DT_TMP_SCHEMA := $(objtree)$(DT_BINDING_DIR)/processed-schema.json
 
 quiet_cmd_dtb =	DTC_CHK $@
       cmd_dtb =	$(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 269f4918d72c..c3234b26e6dc 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -131,14 +131,14 @@ deb-pkg srcdeb-pkg bindeb-pkg:
 # ---------------------------------------------------------------------------
 PHONY += snap-pkg
 snap-pkg:
-	rm -rf $(objtree)/snap
-	mkdir $(objtree)/snap
+	rm -rf $(objtree)snap
+	mkdir $(objtree)snap
 	$(MAKE) clean
 	sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
 		s@SRCTREE@$(abs_srctree)@" \
 		$(srctree)scripts/package/snapcraft.template > \
-		$(objtree)/snap/snapcraft.yaml
-	cd $(objtree)/snap && \
+		$(objtree)snap/snapcraft.yaml
+	cd $(objtree)snap && \
 	snapcraft --target-arch=$(UTS_MACHINE)
 
 # dir-pkg tar*-pkg - tarball targets
diff --git a/scripts/Makefile.randstruct b/scripts/Makefile.randstruct
index 24e283e89893..38fde99a580c 100644
--- a/scripts/Makefile.randstruct
+++ b/scripts/Makefile.randstruct
@@ -4,12 +4,12 @@ randstruct-cflags-y += -DRANDSTRUCT
 
 ifdef CONFIG_GCC_PLUGIN_RANDSTRUCT
 randstruct-cflags-y	\
-	+= -fplugin=$(objtree)/scripts/gcc-plugins/randomize_layout_plugin.so
+	+= -fplugin=$(objtree)scripts/gcc-plugins/randomize_layout_plugin.so
 randstruct-cflags-$(CONFIG_RANDSTRUCT_PERFORMANCE)		\
 	+= -fplugin-arg-randomize_layout_plugin-performance-mode
 else
 randstruct-cflags-y	\
-	+= -frandomize-layout-seed-file=$(objtree)/scripts/basic/randstruct.seed
+	+= -frandomize-layout-seed-file=$(objtree)scripts/basic/randstruct.seed
 endif
 
 export RANDSTRUCT_CFLAGS := $(randstruct-cflags-y)
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index ea7b56fd3700..47856f8ceefe 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -10,7 +10,7 @@ gen-randstruct-seed	:= $(srctree)scripts/gen-randstruct-seed.sh
 quiet_cmd_create_randstruct_seed = GENSEED $@
 cmd_create_randstruct_seed = \
 	$(CONFIG_SHELL) $(gen-randstruct-seed) \
-		$@ $(objtree)/include/generated/randstruct_hash.h
+		$@ $(objtree)include/generated/randstruct_hash.h
 $(obj)/randstruct.seed: $(gen-randstruct-seed) FORCE
 	$(call if_changed,create_randstruct_seed)
 always-$(CONFIG_RANDSTRUCT) += randstruct.seed
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index 2b3a1890f742..9cd2b18b9715 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -9,7 +9,7 @@ cmd_create_randomize_layout_seed = \
 	echo ' * Exposing this value will expose the layout of randomized structures.' >> $@; \
 	echo ' */' >> $@; \
 	echo "const char *randstruct_seed = \"$$SEED\";" >> $@
-$(obj)/randomize_layout_seed.h: $(objtree)/scripts/basic/randstruct.seed FORCE
+$(obj)/randomize_layout_seed.h: $(objtree)scripts/basic/randstruct.seed FORCE
 	$(call if_changed,create_randomize_layout_seed)
 targets += randomize_layout_seed.h
 
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
index f1b64cc46d47..5ee0837ee78d 100644
--- a/scripts/selinux/mdp/Makefile
+++ b/scripts/selinux/mdp/Makefile
@@ -2,6 +2,6 @@
 hostprogs-always-y += mdp
 HOST_EXTRACFLAGS += \
 	-I$(srctree)include/uapi -I$(srctree)include \
-	-I$(srctree)security/selinux/include -I$(objtree)/include
+	-I$(srctree)security/selinux/include -I$(objtree)include
 
 clean-files	:= policy.* file_contexts
-- 
2.39.2


  parent reply	other threads:[~2024-03-04  2:26 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 23:24 [WIP PATCH 00/30] Adding trailing slash to $(*tree) Elliott Mitchell
2024-03-01 19:48 ` [WIP PATCH 29/30] tools/build: modify uses of $(srctree) to assume trailing slash Elliott Mitchell
2024-03-01 19:48 ` [WIP PATCH 06/30] build: " Elliott Mitchell
2024-03-01 19:48 ` [WIP PATCH 11/30] scripts: " Elliott Mitchell
2024-03-01 19:48 ` [WIP PATCH 07/30] build: " Elliott Mitchell
2024-03-01 20:03 ` [WIP PATCH 08/30] " Elliott Mitchell
2024-03-01 20:03 ` [WIP PATCH 12/30] scripts: " Elliott Mitchell
2024-03-01 20:51 ` [WIP PATCH 01/30] build: replace uses of $(abspath ) with existing variables Elliott Mitchell
2024-03-04  9:50   ` Nicolas Schier
2024-03-04 10:01     ` Nicolas Schier
2024-03-04 19:45       ` Elliott Mitchell
2024-03-05 10:51         ` Nicolas Schier
2024-03-01 23:26 ` [WIP PATCH 16/30] scripts/dtc: dtx_diff: include trailing slash in ${srctree} variable Elliott Mitchell
2024-03-01 23:50 ` [WIP PATCH 02/30] scripts/coccicheck: modify to handle ${srctree} with trailing slash Elliott Mitchell
2024-03-01 23:50 ` [WIP PATCH 25/30] " Elliott Mitchell
2024-03-02  0:29 ` [WIP PATCH 15/30] build/scripts: install.sh: modify use of ${srctree} for " Elliott Mitchell
2024-03-02  0:32 ` [WIP PATCH 17/30] build/scripts: generate_initcall_order.pl: " Elliott Mitchell
2024-03-02  0:33 ` [WIP PATCH 18/30] build/scripts: streamline_config.pl: " Elliott Mitchell
2024-03-02  1:08 ` [WIP PATCH 14/30] build/scripts: link-vmlinux.sh: modify use of ${objtree} " Elliott Mitchell
2024-03-02  1:43 ` [WIP PATCH 20/30] scripts/package: buildtar: modify use of ${srctree} to assume " Elliott Mitchell
2024-03-02  1:43 ` [WIP PATCH 19/30] scripts/package: mkdebian: " Elliott Mitchell
2024-03-02  1:46 ` [WIP PATCH 22/30] scripts/nsdeps: " Elliott Mitchell
2024-03-02  1:47 ` [WIP PATCH 23/30] build/scripts: makelst: modify suggested use of ${srctree} for " Elliott Mitchell
2024-03-02  2:01 ` [WIP PATCH 21/30] scripts/package: mkspec: modify use of ${srctree} to assume " Elliott Mitchell
2024-03-02  2:02 ` [WIP PATCH 24/30] scripts/generate_rust_analyzer.py: modify use of ${srctree} for " Elliott Mitchell
2024-03-03 22:11 ` [WIP PATCH 03/30] build: handle optional trailing slash in $(srctree) Elliott Mitchell
2024-03-03 23:24 ` Elliott Mitchell [this message]
2024-03-03 23:24 ` [WIP PATCH 10/30] scripts: modify uses of $(srctree) to assume trailing slash Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 09/30] build: modify uses of $(objtree) " Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 30/30] tools/build: " Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 26/30] build: change $(*tree) to empty for current directory Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 27/30] tools/build: add trailing slash to $(*tree) Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 04/30] build: " Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 05/30] build: modify uses of $(srctree) to assume trailing slash Elliott Mitchell
2024-03-03 23:24 ` [WIP PATCH 28/30] tools/build: " Elliott Mitchell
2024-03-04  9:57 ` [WIP PATCH 00/30] Adding trailing slash to $(*tree) Nicolas Schier
2024-03-04 19:36   ` Elliott Mitchell
2024-03-05 10:43     ` Nicolas Schier
2024-03-07  0:02       ` Elliott Mitchell
2024-03-05 15:20     ` Masahiro Yamada
2024-03-07  0:09       ` Elliott Mitchell
2024-03-10 13:07         ` Masahiro Yamada
2024-03-12  0:15           ` Elliott Mitchell
2024-03-13  4:22             ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=491ac1cbd85474eff9e189d0a64945f2f79cc8cc.1709508291.git.ehem+linux@m5p.com \
    --to=ehem+linux@m5p.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox