lkml.org 
[lkml]   [2022]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/15] kbuild: move core-y in top Makefile to ./Kbuild
Date
Use the ordinary obj-y to list subdirectories.

There are some core-y entries remaining in arch/*/Makefile.
They will be moved after io_uring/built-in.a.

Note:
GNU Make seems to transform './.modules.order' to '.modules.order'
before matching it against the target pattern. Split ./.modules.order
to a dedicated rule to avoid "doesn't match the target pattern"
warning. [1]

[1]: https://lists.gnu.org/archive/html/bug-make/2022-08/msg00059.html

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

Kbuild | 16 ++++++++++++++++
Makefile | 10 +++++-----
scripts/Makefile.build | 4 ++--
3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Kbuild b/Kbuild
index 0b9e8a16a621..c8661cfc49a3 100644
--- a/Kbuild
+++ b/Kbuild
@@ -72,3 +72,19 @@ $(atomic-checks): $(obj)/.checked-%: include/linux/atomic/% FORCE
PHONY += prepare
prepare: $(offsets-file) missing-syscalls $(atomic-checks)
@:
+
+# Ordinary directory descending
+# ---------------------------------------------------------------------------
+
+obj-y += init/
+obj-y += usr/
+obj-y += arch/$(SRCARCH)/
+obj-y += kernel/
+obj-y += certs/
+obj-y += mm/
+obj-y += fs/
+obj-y += ipc/
+obj-y += security/
+obj-y += crypto/
+obj-$(CONFIG_BLOCK) += block/
+obj-$(CONFIG_IO_URING) += io_uring/
diff --git a/Makefile b/Makefile
index 89aba2c69be8..1bc44bb4be1f 100644
--- a/Makefile
+++ b/Makefile
@@ -676,7 +676,7 @@ endif

ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit
-core-y := init/ usr/ arch/$(SRCARCH)/
+core-y := ./
drivers-y := drivers/ sound/
drivers-$(CONFIG_SAMPLES) += samples/
drivers-$(CONFIG_NET) += net/
@@ -1101,9 +1101,6 @@ export MODORDER := $(extmod_prefix)modules.order
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps

ifeq ($(KBUILD_EXTMOD),)
-core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
-core-$(CONFIG_BLOCK) += block/
-core-$(CONFIG_IO_URING) += io_uring/

vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
@@ -1752,7 +1749,10 @@ ifdef CONFIG_MODULES

subdir-modorder := $(addsuffix /.modules.order, $(build-dirs))

-$(sort $(subdir-modorder)): %/.modules.order: % ;
+# Split ./.modules.order into a dedicate target to avoid
+# "doesn't match the target pattern" warning
+./.modules.order: . ;
+$(sort $(filter-out ./.modules.order, $(subdir-modorder))): %/.modules.order: % ;

cmd_modules_order = cat $(real-prereqs) > $@

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index c96c3c0ab228..098c811667d3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -464,8 +464,8 @@ PHONY += $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) $(build)=$@ \
$(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \
- need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin)),1) \
- need-modorder=$(if $(filter $@/.modules.order, $(subdir-modorder)),1)
+ need-builtin=$(if $(filter $@/built-in.a, $(subdir-builtin:./%=%)),1) \
+ need-modorder=$(if $(filter $@/.modules.order, $(subdir-modorder:./%=%)),1)

# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
--
2.34.1
\
 
 \ /
  Last update: 2022-08-28 04:42    [W:0.184 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site