]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - scripts/Makefile.modbuiltin
Merge branch 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-bionic-kernel.git] / scripts / Makefile.modbuiltin
1 # SPDX-License-Identifier: GPL-2.0
2 # ==========================================================================
3 # Generating modules.builtin
4 # ==========================================================================
5
6 src := $(obj)
7
8 PHONY := __modbuiltin
9 __modbuiltin:
10
11 -include include/config/auto.conf
12 # tristate.conf sets tristate variables to uppercase 'Y' or 'M'
13 # That way, we get the list of built-in modules in obj-Y
14 -include include/config/tristate.conf
15
16 include scripts/Kbuild.include
17
18 ifneq ($(KBUILD_SRC),)
19 # Create output directory if not already present
20 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
21 endif
22
23 # The filename Kbuild has precedence over Makefile
24 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
25 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
26 include $(kbuild-file)
27
28 include scripts/Makefile.lib
29 __subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y)))
30 subdir-Y += $(__subdir-Y)
31 subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m))
32 subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
33 obj-Y := $(addprefix $(obj)/,$(obj-Y))
34
35 modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym))
36 modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko))
37 modbuiltin-target := $(obj)/modules.builtin
38
39 __modbuiltin: $(modbuiltin-target) $(subdir-ym)
40 @:
41
42 $(modbuiltin-target): $(subdir-ym) FORCE
43 $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \
44 cat /dev/null $(modbuiltin-subdirs)) > $@
45
46 PHONY += FORCE
47
48 FORCE:
49
50 # Descending
51 # ---------------------------------------------------------------------------
52
53 PHONY += $(subdir-ym)
54 $(subdir-ym):
55 $(Q)$(MAKE) $(modbuiltin)=$@
56
57
58 # Declare the contents of the .PHONY variable as phony. We keep that
59 # information in a variable se we can use it in if_changed and friends.
60
61 .PHONY: $(PHONY)