1 # ==========================================================================
2 # Generating modules.builtin
3 # ==========================================================================
10 -include include/config/auto.conf
11 # tristate.conf sets tristate variables to uppercase 'Y' or 'M'
12 # That way, we get the list of built-in modules in obj-Y
13 -include include/config/tristate.conf
15 include scripts/Kbuild.include
17 # The filename Kbuild has precedence over Makefile
18 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
19 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
20 include $(kbuild-file)
22 include scripts/Makefile.lib
23 __subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y)))
24 subdir-Y += $(__subdir-Y)
25 subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m))
26 subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
27 obj-Y := $(addprefix $(obj)/,$(obj-Y))
29 modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym))
30 modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko))
31 modbuiltin-target := $(obj)/modules.builtin
33 __modbuiltin: $(modbuiltin-target) $(subdir-ym)
36 $(modbuiltin-target): $(subdir-ym) FORCE
37 $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \
38 cat /dev/null $(modbuiltin-subdirs)) > $@
45 # ---------------------------------------------------------------------------
49 $(Q)$(MAKE) $(modbuiltin)=$@
52 # Declare the contents of the .PHONY variable as phony. We keep that
53 # information in a variable se we can use it in if_changed and friends.