Makefile.fwinst 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # ==========================================================================
  2. # Installing firmware
  3. #
  4. # We don't include the .config, so all firmware files are in $(fw-shipped-)
  5. # rather than in $(fw-shipped-y) or $(fw-shipped-n).
  6. # ==========================================================================
  7. INSTALL := install
  8. src := $(obj)
  9. # For modules_install installing firmware, we want to see .config
  10. # But for firmware_install, we don't care, but don't want to require it.
  11. -include $(objtree)/.config
  12. include scripts/Kbuild.include
  13. include $(srctree)/$(obj)/Makefile
  14. include scripts/Makefile.host
  15. mod-fw := $(fw-shipped-m)
  16. # If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the
  17. # firmware for in-kernel drivers too.
  18. ifndef CONFIG_FIRMWARE_IN_KERNEL
  19. mod-fw += $(fw-shipped-y)
  20. endif
  21. installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
  22. installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
  23. installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/.
  24. # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
  25. PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
  26. $(INSTALL_FW_PATH)/$$(%): install-all-dirs
  27. @true
  28. install-all-dirs: $(installed-fw-dirs)
  29. @true
  30. quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
  31. cmd_install = $(INSTALL) -m0644 $< $@
  32. $(installed-fw-dirs):
  33. $(call cmd,mkdir)
  34. $(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
  35. $(call cmd,install)
  36. PHONY += __fw_install __fw_modinst FORCE
  37. .PHONY: $(PHONY)
  38. __fw_install: $(installed-fw)
  39. __fw_modinst: $(installed-mod-fw)
  40. @:
  41. __fw_modbuild: $(addprefix $(obj)/,$(mod-fw))
  42. @:
  43. FORCE:
  44. # Read all saved command lines and dependencies for the $(targets) we
  45. # may be building using $(if_changed{,_dep}). As an optimization, we
  46. # don't need to read them if the target does not exist; we will rebuild
  47. # anyway in that case.
  48. targets := $(wildcard $(sort $(targets)))
  49. cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
  50. ifneq ($(cmd_files),)
  51. include $(cmd_files)
  52. endif