aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2014-04-29 11:54:47 +0200
committerMichal Marek <mmarek@suse.cz>2014-05-14 22:43:04 +0200
commit5180d5f483486859c0a822c9020ec459f4504b59 (patch)
tree311341f201df4f2ce9d99a1fd1ed6ffc8aa84bec /scripts
parent3fbb43df983acf6f10a122e43e73daf6528ad7ed (diff)
firmware: Simplify directory creation
When building the firmware blobs, use a simple loop to create directories in $(objtree), like in Makefile.build. This simplifies the rules and also makes it possible to set $(objtree) to '.' later. Before this change, a dependency on $(objtree)/<dir> would be satisfied by <dir> in $(srctree). When installing the firmware blobs, call mkdir like in Makefile.modinst. Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.fwinst24
1 files changed, 11 insertions, 13 deletions
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index 2c1d69c4345..d8e335eed22 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -24,25 +24,23 @@ ifndef CONFIG_FIRMWARE_IN_KERNEL
mod-fw += $(fw-shipped-y)
endif
+ifneq ($(KBUILD_SRC),)
+# Create output directory if not already present
+_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
+
+firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
+# Create directories for firmware in subdirectories
+_dummy := $(foreach d,$(firmware-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
+endif
+
installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
-installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
-
-# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
-PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
-$(INSTALL_FW_PATH)/$$(%): install-all-dirs
- @true
-install-all-dirs: $(installed-fw-dirs)
- @true
quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
- cmd_install = $(INSTALL) -m0644 $< $@
-
-$(installed-fw-dirs):
- $(call cmd,mkdir)
+ cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@
-$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
+$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/%
$(call cmd,install)
PHONY += __fw_install __fw_modinst FORCE