mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-27 07:23:30 +08:00
fs/common.mk: delay evaluation of variables
This makes things easier to understand and more consistent with the pkg-infra. For example, it removes the need for '$$@' in the CMD variables of fs/*/*.mk. It also makes it possible to update the variables later, e.g. in the package override file. It also makes sure that the date will be recorded correctly in Yann E. Morin's patch that logs the MESSAGE macros to a file. The fs/*/*.mk must be updated as well because the '$@' shouldn't be quoted anymore in the CMD variables or the hooks. The $(eval ...) for the dependencies is redundant, because the $(ROOTFS_TARGET) variable is already eval'd. Note that it is only redundant if the evaluation of the uses of the variable is also delayed. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
26f16d0fcf
commit
847895d295
@ -7,7 +7,7 @@
|
|||||||
ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
|
ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
|
||||||
|
|
||||||
define ROOTFS_CLOOP_CMD
|
define ROOTFS_CLOOP_CMD
|
||||||
$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $$@
|
$(HOST_DIR)/usr/bin/genisoimage -r $(TARGET_DIR) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,cloop))
|
$(eval $(call ROOTFS_TARGET,cloop))
|
44
fs/common.mk
44
fs/common.mk
@ -39,28 +39,28 @@ ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE)) \
|
|||||||
define ROOTFS_TARGET_INTERNAL
|
define ROOTFS_TARGET_INTERNAL
|
||||||
|
|
||||||
# extra deps
|
# extra deps
|
||||||
$(eval ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs $(if $(BR2_TARGET_ROOTFS_$(2)_LZMA),host-lzma))
|
ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs $$(if $$(BR2_TARGET_ROOTFS_$(2)_LZMA),host-lzma)
|
||||||
|
|
||||||
$(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES)
|
$$(BINARIES_DIR)/rootfs.$(1): $$(ROOTFS_$(2)_DEPENDENCIES)
|
||||||
@$(call MESSAGE,"Generating root filesystem image rootfs.$(1)")
|
@$$(call MESSAGE,"Generating root filesystem image rootfs.$(1)")
|
||||||
$(foreach hook,$(ROOTFS_$(2)_PRE_GEN_HOOKS),$(call $(hook))$(sep))
|
$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),$$(call $$(hook))$$(sep))
|
||||||
rm -f $(FAKEROOT_SCRIPT)
|
rm -f $$(FAKEROOT_SCRIPT)
|
||||||
rm -f $(TARGET_DIR_WARNING_FILE)
|
rm -f $$(TARGET_DIR_WARNING_FILE)
|
||||||
echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
|
echo "chown -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
|
||||||
ifneq ($(ROOTFS_DEVICE_TABLES),)
|
ifneq ($$(ROOTFS_DEVICE_TABLES),)
|
||||||
cat $(ROOTFS_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)
|
cat $$(ROOTFS_DEVICE_TABLES) > $$(FULL_DEVICE_TABLE)
|
||||||
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
|
ifeq ($$(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
|
||||||
printf '$(subst $(sep),\n,$(PACKAGES_DEVICES_TABLE))' >> $(FULL_DEVICE_TABLE)
|
printf '$$(subst $$(sep),\n,$$(PACKAGES_DEVICES_TABLE))' >> $$(FULL_DEVICE_TABLE)
|
||||||
endif
|
endif
|
||||||
printf '$(subst $(sep),\n,$(PACKAGES_PERMISSIONS_TABLE))' >> $(FULL_DEVICE_TABLE)
|
printf '$$(subst $$(sep),\n,$$(PACKAGES_PERMISSIONS_TABLE))' >> $$(FULL_DEVICE_TABLE)
|
||||||
echo "$(HOST_DIR)/usr/bin/makedevs -d $(FULL_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
|
echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
|
||||||
endif
|
endif
|
||||||
echo "$(ROOTFS_$(2)_CMD)" >> $(FAKEROOT_SCRIPT)
|
echo "$$(ROOTFS_$(2)_CMD)" >> $$(FAKEROOT_SCRIPT)
|
||||||
chmod a+x $(FAKEROOT_SCRIPT)
|
chmod a+x $$(FAKEROOT_SCRIPT)
|
||||||
$(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT)
|
$$(HOST_DIR)/usr/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
|
||||||
cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
|
cp support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
|
||||||
-@rm -f $(FAKEROOT_SCRIPT) $(FULL_DEVICE_TABLE)
|
-@rm -f $$(FAKEROOT_SCRIPT) $$(FULL_DEVICE_TABLE)
|
||||||
$(foreach hook,$(ROOTFS_$(2)_POST_GEN_HOOKS),$(call $(hook))$(sep))
|
$$(foreach hook,$$(ROOTFS_$(2)_POST_GEN_HOOKS),$$(call $$(hook))$$(sep))
|
||||||
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y)
|
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y)
|
||||||
gzip -9 -c $$@ > $$@.gz
|
gzip -9 -c $$@ > $$@.gz
|
||||||
endif
|
endif
|
||||||
@ -68,13 +68,13 @@ ifeq ($$(BR2_TARGET_ROOTFS_$(2)_BZIP2),y)
|
|||||||
bzip2 -9 -c $$@ > $$@.bz2
|
bzip2 -9 -c $$@ > $$@.bz2
|
||||||
endif
|
endif
|
||||||
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZMA),y)
|
ifeq ($$(BR2_TARGET_ROOTFS_$(2)_LZMA),y)
|
||||||
$(LZMA) -9 -c $$@ > $$@.lzma
|
$$(LZMA) -9 -c $$@ > $$@.lzma
|
||||||
endif
|
endif
|
||||||
|
|
||||||
rootfs-$(1)-show-depends:
|
rootfs-$(1)-show-depends:
|
||||||
@echo $(ROOTFS_$(2)_DEPENDENCIES)
|
@echo $$(ROOTFS_$(2)_DEPENDENCIES)
|
||||||
|
|
||||||
rootfs-$(1): $(BINARIES_DIR)/rootfs.$(1) $(ROOTFS_$(2)_POST_TARGETS)
|
rootfs-$(1): $$(BINARIES_DIR)/rootfs.$(1) $$(ROOTFS_$(2)_POST_TARGETS)
|
||||||
|
|
||||||
ifeq ($$(BR2_TARGET_ROOTFS_$(2)),y)
|
ifeq ($$(BR2_TARGET_ROOTFS_$(2)),y)
|
||||||
TARGETS += rootfs-$(1)
|
TARGETS += rootfs-$(1)
|
||||||
|
@ -28,7 +28,7 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
|
|||||||
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
|
ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
|
||||||
|
|
||||||
define ROOTFS_CPIO_CMD
|
define ROOTFS_CPIO_CMD
|
||||||
cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $$@
|
cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,cpio))
|
$(eval $(call ROOTFS_TARGET,cpio))
|
||||||
|
@ -10,7 +10,7 @@ CRAMFS_OPTS=-l
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
define ROOTFS_CRAMFS_CMD
|
define ROOTFS_CRAMFS_CMD
|
||||||
$(HOST_DIR)/usr/bin/mkcramfs $(CRAMFS_OPTS) $(TARGET_DIR) $$@
|
$(HOST_DIR)/usr/bin/mkcramfs $(CRAMFS_OPTS) $(TARGET_DIR) $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
|
ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
|
||||||
|
@ -21,7 +21,7 @@ endif
|
|||||||
ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
|
ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
|
||||||
|
|
||||||
define ROOTFS_EXT2_CMD
|
define ROOTFS_EXT2_CMD
|
||||||
PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) $$@
|
PATH=$(TARGET_PATH) fs/ext2/genext2fs.sh -d $(TARGET_DIR) $(EXT2_OPTS) $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,ext2))
|
$(eval $(call ROOTFS_TARGET,ext2))
|
||||||
|
@ -36,13 +36,13 @@ ROOTFS_JFFS2_DEPENDENCIES = host-mtd
|
|||||||
|
|
||||||
ifneq ($(BR2_TARGET_ROOTFS_JFFS2_SUMMARY),)
|
ifneq ($(BR2_TARGET_ROOTFS_JFFS2_SUMMARY),)
|
||||||
define ROOTFS_JFFS2_CMD
|
define ROOTFS_JFFS2_CMD
|
||||||
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $$@.nosummary && \
|
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@.nosummary && \
|
||||||
$(SUMTOOL) $(SUMTOOL_OPTS) -i $$@.nosummary -o $$@ && \
|
$(SUMTOOL) $(SUMTOOL_OPTS) -i $@.nosummary -o $@ && \
|
||||||
rm $$@.nosummary
|
rm $@.nosummary
|
||||||
endef
|
endef
|
||||||
else
|
else
|
||||||
define ROOTFS_JFFS2_CMD
|
define ROOTFS_JFFS2_CMD
|
||||||
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $$@
|
$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $@
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ ROMFS_TARGET=$(IMAGE).romfs
|
|||||||
ROOTFS_ROMFS_DEPENDENCIES = host-genromfs
|
ROOTFS_ROMFS_DEPENDENCIES = host-genromfs
|
||||||
|
|
||||||
define ROOTFS_ROMFS_CMD
|
define ROOTFS_ROMFS_CMD
|
||||||
$(HOST_DIR)/usr/bin/genromfs -d $(TARGET_DIR) -f $$@
|
$(HOST_DIR)/usr/bin/genromfs -d $(TARGET_DIR) -f $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,romfs))
|
$(eval $(call ROOTFS_TARGET,romfs))
|
@ -33,9 +33,9 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
define ROOTFS_SQUASHFS_CMD
|
define ROOTFS_SQUASHFS_CMD
|
||||||
$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $$@ -noappend \
|
$(HOST_DIR)/usr/bin/mksquashfs $(TARGET_DIR) $@ -noappend \
|
||||||
$(ROOTFS_SQUASHFS_ARGS) && \
|
$(ROOTFS_SQUASHFS_ARGS) && \
|
||||||
chmod 0644 $$@
|
chmod 0644 $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,squashfs))
|
$(eval $(call ROOTFS_TARGET,squashfs))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
TAR_OPTS:=$(BR2_TARGET_ROOTFS_TAR_OPTIONS)
|
TAR_OPTS:=$(BR2_TARGET_ROOTFS_TAR_OPTIONS)
|
||||||
|
|
||||||
define ROOTFS_TAR_CMD
|
define ROOTFS_TAR_CMD
|
||||||
tar -c$(TAR_OPTS)f $$@ -C $(TARGET_DIR) .
|
tar -c$(TAR_OPTS)f $@ -C $(TARGET_DIR) .
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,tar))
|
$(eval $(call ROOTFS_TARGET,tar))
|
||||||
|
@ -14,9 +14,9 @@ ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
|
|||||||
|
|
||||||
define ROOTFS_UBI_CMD
|
define ROOTFS_UBI_CMD
|
||||||
cp fs/ubifs/ubinize.cfg . ;\
|
cp fs/ubifs/ubinize.cfg . ;\
|
||||||
echo "image=$$@fs" \
|
echo "image=$@fs" \
|
||||||
>> ./ubinize.cfg ;\
|
>> ./ubinize.cfg ;\
|
||||||
$(HOST_DIR)/usr/sbin/ubinize -o $$@ $(UBI_UBINIZE_OPTS) ubinize.cfg ;\
|
$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) ubinize.cfg ;\
|
||||||
rm ubinize.cfg
|
rm ubinize.cfg
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ endif
|
|||||||
ROOTFS_UBIFS_DEPENDENCIES = host-mtd
|
ROOTFS_UBIFS_DEPENDENCIES = host-mtd
|
||||||
|
|
||||||
define ROOTFS_UBIFS_CMD
|
define ROOTFS_UBIFS_CMD
|
||||||
$(HOST_DIR)/usr/sbin/mkfs.ubifs -d $(TARGET_DIR) $(UBIFS_OPTS) -o $$@
|
$(HOST_DIR)/usr/sbin/mkfs.ubifs -d $(TARGET_DIR) $(UBIFS_OPTS) -o $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ROOTFS_TARGET,ubifs))
|
$(eval $(call ROOTFS_TARGET,ubifs))
|
Loading…
Reference in New Issue
Block a user