Back to home page

LXR

 
 

    


0001 # ==========================================================================
0002 # Generating modules.builtin
0003 # ==========================================================================
0004 
0005 src := $(obj)
0006 
0007 PHONY := __modbuiltin
0008 __modbuiltin:
0009 
0010 -include include/config/auto.conf
0011 # tristate.conf sets tristate variables to uppercase 'Y' or 'M'
0012 # That way, we get the list of built-in modules in obj-Y
0013 -include include/config/tristate.conf
0014 
0015 include scripts/Kbuild.include
0016 
0017 ifneq ($(KBUILD_SRC),)
0018 # Create output directory if not already present
0019 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
0020 endif
0021 
0022 # The filename Kbuild has precedence over Makefile
0023 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
0024 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
0025 include $(kbuild-file)
0026 
0027 include scripts/Makefile.lib
0028 __subdir-Y     := $(patsubst %/,%,$(filter %/, $(obj-Y)))
0029 subdir-Y       += $(__subdir-Y)
0030 subdir-ym      := $(sort $(subdir-y) $(subdir-Y) $(subdir-m))
0031 subdir-ym      := $(addprefix $(obj)/,$(subdir-ym))
0032 obj-Y          := $(addprefix $(obj)/,$(obj-Y))
0033 
0034 modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym))
0035 modbuiltin-mods    := $(filter %.ko, $(obj-Y:.o=.ko))
0036 modbuiltin-target  := $(obj)/modules.builtin
0037 
0038 __modbuiltin: $(modbuiltin-target) $(subdir-ym)
0039         @:
0040 
0041 $(modbuiltin-target): $(subdir-ym) FORCE
0042         $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done;     \
0043         cat /dev/null $(modbuiltin-subdirs)) > $@
0044 
0045 PHONY += FORCE
0046 
0047 FORCE:
0048 
0049 # Descending
0050 # ---------------------------------------------------------------------------
0051 
0052 PHONY += $(subdir-ym)
0053 $(subdir-ym):
0054         $(Q)$(MAKE) $(modbuiltin)=$@
0055 
0056 
0057 # Declare the contents of the .PHONY variable as phony.  We keep that
0058 # information in a variable se we can use it in if_changed and friends.
0059 
0060 .PHONY: $(PHONY)