Makefile.modbuiltin 1.7 KB

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