linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] kbuild: refactor Makefile inclusion
@ 2015-03-27 11:43 Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 1/4] kbuild: use relative path to include Makefile Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, linux-mips, Tony Luck, x86, linux-ia64,
	user-mode-linux-devel, Jeff Dike, H. Peter Anvin, linux-kernel,
	Thomas Gleixner, Russell King, Richard Weinberger, Michal Marek,
	user-mode-linux-user, Ingo Molnar, Fenghua Yu, Ralf Baechle,
	linux-arm-kernel

Masahiro Yamada (4):
  kbuild: use relative path to include Makefile
  kbuild: use relative path more to include Makefile
  kbuild: include $(src)/Makefile rather than $(obj)/Makefile
  kbuild: ia64: use $(src)/Makefile.gate rather than particular path

 Makefile                  | 22 ++++++++++------------
 arch/arm/boot/Makefile    |  2 +-
 arch/ia64/kernel/Makefile |  2 +-
 arch/mips/Makefile        |  2 +-
 arch/um/Makefile          |  6 +++---
 arch/x86/Makefile         |  2 +-
 arch/x86/Makefile.um      |  2 +-
 scripts/Makefile.dtbinst  |  2 +-
 scripts/Makefile.fwinst   |  2 +-
 9 files changed, 20 insertions(+), 22 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] kbuild: use relative path to include Makefile
  2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
@ 2015-03-27 11:43 ` Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 2/4] kbuild: use relative path more " Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Tony Luck, linux-ia64, linux-kernel,
	Russell King, Michal Marek, Fenghua Yu, linux-arm-kernel

The "MAKEFLAGS += --include-dir=$(srctree)" line in the top Makefile
allows us to do this.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/boot/Makefile    | 2 +-
 arch/ia64/kernel/Makefile | 2 +-
 scripts/Makefile.dtbinst  | 2 +-
 scripts/Makefile.fwinst   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index ec2f806..9eca7ae 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -12,7 +12,7 @@
 #
 
 ifneq ($(MACHINE),)
-include $(srctree)/$(MACHINE)/Makefile.boot
+include $(MACHINE)/Makefile.boot
 endif
 
 # Note: the following conditions must always be true:
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 20678a9..47e8aff 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -51,7 +51,7 @@ obj-$(CONFIG_BINFMT_ELF)	+= elfcore.o
 CFLAGS_traps.o  += -mfixed-range=f2-f5,f16-f31
 
 # The gate DSO image is built using a special linker script.
-include $(srctree)/arch/ia64/kernel/Makefile.gate
+include arch/ia64/kernel/Makefile.gate
 # tell compiled for native
 CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_NATIVE
 
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 909ed7a..7cbff16 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -18,7 +18,7 @@ export dtbinst-root ?= $(obj)
 
 include include/config/auto.conf
 include scripts/Kbuild.include
-include $(srctree)/$(obj)/Makefile
+include $(obj)/Makefile
 
 PHONY += __dtbs_install_prep
 __dtbs_install_prep:
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index 5b698ad..baf5eae 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -13,7 +13,7 @@ src := $(obj)
 -include $(objtree)/.config
 
 include scripts/Kbuild.include
-include $(srctree)/$(obj)/Makefile
+include $(obj)/Makefile
 
 include scripts/Makefile.host
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] kbuild: use relative path more to include Makefile
  2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 1/4] kbuild: use relative path to include Makefile Masahiro Yamada
@ 2015-03-27 11:43 ` Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 3/4] kbuild: include $(src)/Makefile rather than $(obj)/Makefile Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, linux-mips, user-mode-linux-devel, x86,
	H. Peter Anvin, linux-kernel, Thomas Gleixner,
	Richard Weinberger, Michal Marek, user-mode-linux-user,
	Ingo Molnar, Ralf Baechle, Jeff Dike

Prior to this commit, it was impossible to use relative path to
include Makefiles from the top level Makefile because the option
"--include-dir=$(srctree)" becomes effective when Make enters into
sub Makefiles.

To use relative path in any places, this commit moves the option
above the "sub-make" target.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile             | 22 ++++++++++------------
 arch/mips/Makefile   |  2 +-
 arch/um/Makefile     |  6 +++---
 arch/x86/Makefile    |  2 +-
 arch/x86/Makefile.um |  2 +-
 5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index cc68048..402ff77 100644
--- a/Makefile
+++ b/Makefile
@@ -10,9 +10,10 @@ NAME = Hurr durr I'ma sheep
 # Comments in this file are targeted only to the developer, do not
 # expect to learn how to build the kernel reading this file.
 
-# Do not use make's built-in rules and variables
-# (this increases performance and avoids hard-to-debug behaviour);
-MAKEFLAGS += -rR
+# o Do not use make's built-in rules and variables
+#   (this increases performance and avoids hard-to-debug behaviour);
+# o Look for make include files relative to root of kernel src
+MAKEFLAGS += -rR --include-dir=$(CURDIR)
 
 # Avoid funny character set dependencies
 unexport LC_ALL
@@ -344,12 +345,9 @@ endif
 export COMPILER
 endif
 
-# Look for make include files relative to root of kernel src
-MAKEFLAGS += --include-dir=$(srctree)
-
 # We need some generic definitions (do not try to remake the file).
-$(srctree)/scripts/Kbuild.include: ;
-include $(srctree)/scripts/Kbuild.include
+scripts/Kbuild.include: ;
+include scripts/Kbuild.include
 
 # Make variables (CC, etc...)
 AS		= $(CROSS_COMPILE)as
@@ -533,7 +531,7 @@ ifeq ($(config-targets),1)
 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
-include $(srctree)/arch/$(SRCARCH)/Makefile
+include arch/$(SRCARCH)/Makefile
 export KBUILD_DEFCONFIG KBUILD_KCONFIG
 
 config: scripts_basic outputmakefile FORCE
@@ -609,7 +607,7 @@ endif # $(dot-config)
 # Defaults to vmlinux, but the arch makefile usually adds further targets
 all: vmlinux
 
-include $(srctree)/arch/$(SRCARCH)/Makefile
+include arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 
@@ -781,8 +779,8 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
 	KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
 endif
 
-include $(srctree)/scripts/Makefile.kasan
-include $(srctree)/scripts/Makefile.extrawarn
+include scripts/Makefile.kasan
+include scripts/Makefile.extrawarn
 
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 KBUILD_CPPFLAGS += $(KCPPFLAGS)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 8f57fc7..d152dfb 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -225,7 +225,7 @@ endif
 #
 # Board-dependent options and extra files
 #
-include $(srctree)/arch/mips/Kbuild.platforms
+include arch/mips/Kbuild.platforms
 
 ifdef CONFIG_PHYSICAL_START
 load-y					= $(CONFIG_PHYSICAL_START)
diff --git a/arch/um/Makefile b/arch/um/Makefile
index e4b1a96..17d4460 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -43,8 +43,8 @@ endif
 
 HOST_DIR := arch/$(HEADER_ARCH)
 
-include $(srctree)/$(ARCH_DIR)/Makefile-skas
-include $(srctree)/$(HOST_DIR)/Makefile.um
+include $(ARCH_DIR)/Makefile-skas
+include $(HOST_DIR)/Makefile.um
 
 core-y += $(HOST_DIR)/um/
 
@@ -73,7 +73,7 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
 	$(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
 
 #This will adjust *FLAGS accordingly to the platform.
-include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
+include $(ARCH_DIR)/Makefile-os-$(OS)
 
 KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
 		   -I$(srctree)/$(HOST_DIR)/include/uapi \
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5ba2d9c..2fda005 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -63,7 +63,7 @@ ifeq ($(CONFIG_X86_32),y)
 				$(call cc-option,-fno-unit-at-a-time))
 
         # CPU-specific tuning. Anything which can be shared with UML should go here.
-        include $(srctree)/arch/x86/Makefile_32.cpu
+        include arch/x86/Makefile_32.cpu
         KBUILD_CFLAGS += $(cflags-y)
 
         # temporary until string.h is fixed
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 95eba55..5b7e898 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -18,7 +18,7 @@ LDS_EXTRA		:= -Ui386
 export LDS_EXTRA
 
 # First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
-include $(srctree)/arch/x86/Makefile_32.cpu
+include arch/x86/Makefile_32.cpu
 
 # prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
 cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] kbuild: include $(src)/Makefile rather than $(obj)/Makefile
  2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 1/4] kbuild: use relative path to include Makefile Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 2/4] kbuild: use relative path more " Masahiro Yamada
@ 2015-03-27 11:43 ` Masahiro Yamada
  2015-03-27 11:43 ` [PATCH 4/4] kbuild: ia64: use $(src)/Makefile.gate rather than particular path Masahiro Yamada
  2015-04-02 15:27 ` [PATCH 0/4] kbuild: refactor Makefile inclusion Michal Marek
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel, Michal Marek

This commit actually has no impact because $(src) and $(obj) point
to the same path, but $(src)/Makefile looks better when we include
source files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/Makefile.dtbinst | 2 +-
 scripts/Makefile.fwinst  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 7cbff16..1c15717 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -18,7 +18,7 @@ export dtbinst-root ?= $(obj)
 
 include include/config/auto.conf
 include scripts/Kbuild.include
-include $(obj)/Makefile
+include $(src)/Makefile
 
 PHONY += __dtbs_install_prep
 __dtbs_install_prep:
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index baf5eae..b272900 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -13,7 +13,7 @@ src := $(obj)
 -include $(objtree)/.config
 
 include scripts/Kbuild.include
-include $(obj)/Makefile
+include $(src)/Makefile
 
 include scripts/Makefile.host
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] kbuild: ia64: use $(src)/Makefile.gate rather than particular path
  2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
                   ` (2 preceding siblings ...)
  2015-03-27 11:43 ` [PATCH 3/4] kbuild: include $(src)/Makefile rather than $(obj)/Makefile Masahiro Yamada
@ 2015-03-27 11:43 ` Masahiro Yamada
  2015-04-02 15:27 ` [PATCH 0/4] kbuild: refactor Makefile inclusion Michal Marek
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-03-27 11:43 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Tony Luck, linux-ia64, Fenghua Yu, linux-kernel

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/ia64/kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 47e8aff..d68b5cf 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -51,7 +51,7 @@ obj-$(CONFIG_BINFMT_ELF)	+= elfcore.o
 CFLAGS_traps.o  += -mfixed-range=f2-f5,f16-f31
 
 # The gate DSO image is built using a special linker script.
-include arch/ia64/kernel/Makefile.gate
+include $(src)/Makefile.gate
 # tell compiled for native
 CPPFLAGS_gate.lds += -D__IA64_GATE_PARAVIRTUALIZED_NATIVE
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] kbuild: refactor Makefile inclusion
  2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
                   ` (3 preceding siblings ...)
  2015-03-27 11:43 ` [PATCH 4/4] kbuild: ia64: use $(src)/Makefile.gate rather than particular path Masahiro Yamada
@ 2015-04-02 15:27 ` Michal Marek
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Marek @ 2015-04-02 15:27 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild
  Cc: linux-mips, Tony Luck, x86, linux-ia64, user-mode-linux-devel,
	Jeff Dike, H. Peter Anvin, linux-kernel, Thomas Gleixner,
	Russell King, Richard Weinberger, user-mode-linux-user,
	Ingo Molnar, Fenghua Yu, Ralf Baechle, linux-arm-kernel

On 2015-03-27 12:43, Masahiro Yamada wrote:
> Masahiro Yamada (4):
>   kbuild: use relative path to include Makefile
>   kbuild: use relative path more to include Makefile
>   kbuild: include $(src)/Makefile rather than $(obj)/Makefile
>   kbuild: ia64: use $(src)/Makefile.gate rather than particular path

Applied to kbuild.git#kbuild.

Michal


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-02 15:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 11:43 [PATCH 0/4] kbuild: refactor Makefile inclusion Masahiro Yamada
2015-03-27 11:43 ` [PATCH 1/4] kbuild: use relative path to include Makefile Masahiro Yamada
2015-03-27 11:43 ` [PATCH 2/4] kbuild: use relative path more " Masahiro Yamada
2015-03-27 11:43 ` [PATCH 3/4] kbuild: include $(src)/Makefile rather than $(obj)/Makefile Masahiro Yamada
2015-03-27 11:43 ` [PATCH 4/4] kbuild: ia64: use $(src)/Makefile.gate rather than particular path Masahiro Yamada
2015-04-02 15:27 ` [PATCH 0/4] kbuild: refactor Makefile inclusion Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).