fs: set per-rootfs variable name
authorYann E. MORIN <yann.morin.1998@free.fr>
Sat, 31 Mar 2018 09:05:51 +0000 (11:05 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 31 Mar 2018 18:52:52 +0000 (20:52 +0200)
Like we do for packages with the PKG variable, set ROOTFS to contain the
upper-case name of the rootfs currently being generated.

This will be useful in later patches, when we need more per-rootfs
variables, like a per-rootfs TARGET_DIR for example.

In Makefiles, per-rule variables trickle down the dependency chain, to
all dependencies of that rule, so we have to stop ROOTFS as soon as
we're not in a rootfs. This means we have to stop it at target-finalize
(which is a dependency of all filesystems), and for each package
individually, since some packages (host or target) can be direct
dependencies of filesystems as well.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Makefile
fs/common.mk
package/pkg-generic.mk

index 6eca3c9ec687198a44729bde0ff2c54ca7d1e529..6cfe83072ec0eb4ab335aa5862bbdbb9b2ef143f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -677,6 +677,9 @@ endif
 
 $(TARGETS_ROOTFS): target-finalize
 
+# Avoid the rootfs name leaking down the dependency chain
+target-finalize: ROOTFS=
+
 .PHONY: target-finalize
 target-finalize: $(PACKAGES)
        @$(call MESSAGE,"Finalizing target directory")
index 274a3e9c7b15da1c266d354790fa3848e6a11014..19a975aa472bd12b8e0521b0b0b21538818de54b 100644 (file)
@@ -72,6 +72,7 @@ ROOTFS_$(2)_COMPRESS_EXT = .xz
 ROOTFS_$(2)_COMPRESS_CMD = xz -9 -C crc32 -c
 endif
 
+$$(BINARIES_DIR)/rootfs.$(1): ROOTFS=$(2)
 $$(BINARIES_DIR)/rootfs.$(1): target-finalize $$(ROOTFS_$(2)_DEPENDENCIES)
        @$$(call MESSAGE,"Generating root filesystem image rootfs.$(1)")
        rm -rf $(FS_DIR)
index 6d82f7027e9a99deb8017868eafb741e451fd45e..152e1d0c67d0876fa8cd519c4f6c317bff902f7c 100644 (file)
@@ -384,6 +384,10 @@ endef
 
 define inner-generic-package
 
+# When doing a package, we're definitely not doing a rootfs, but we
+# may inherit it via the dependency chain, so we reset it.
+$(1): ROOTFS=
+
 # Ensure the package is only declared once, i.e. do not accept that a
 # package be re-defined by a br2-external tree
 ifneq ($(call strip,$(filter $(1),$(PACKAGES_ALL))),)