From 32faf35112e5092a5657862a43aadf67d907dbd3 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Tue, 7 Apr 2009 21:04:31 +0000 Subject: [PATCH] Makefile: add target-finalize for common filesystem cleanup And remove from each rootfs variant. --- Makefile | 12 ++++++++++-- target/cloop/cloop.mk | 11 ----------- target/cpio/cpioroot.mk | 8 -------- target/cramfs/cramfs.mk | 9 --------- target/ext2/ext2root.mk | 12 ------------ target/initramfs/initramfs.mk | 8 -------- target/jffs2/jffs2root.mk | 10 ---------- target/romfs/romfs.mk | 8 -------- target/squashfs/squashfsroot.mk | 8 -------- target/tar/tarroot.mk | 8 -------- target/ubifs/ubifsroot.mk | 12 ------------ 11 files changed, 10 insertions(+), 96 deletions(-) diff --git a/Makefile b/Makefile index 99a2ceaacb..ed8c2610e6 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ endif include package/*/*.mk -TARGETS+=target-devfiles +TARGETS+=target-finalize ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) TARGETS+=target-purgelocales @@ -343,7 +343,7 @@ $(TARGET_DIR): $(PROJECT_BUILD_DIR)/.root erase-fakeroots: rm -f $(PROJECT_BUILD_DIR)/.fakeroot* -target-devfiles: +target-finalize: ifeq ($(BR2_HAVE_DEVFILES),y) ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) ) else @@ -351,6 +351,14 @@ else find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -delete find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -delete endif +ifneq ($(BR2_HAVE_MANPAGES),y) + rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man +endif +ifneq ($(BR2_HAVE_INFOPAGES),y) + rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info +endif + find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true + $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) LOCALE_WHITELIST=$(PROJECT_BUILD_DIR)/locales.nopurge diff --git a/target/cloop/cloop.mk b/target/cloop/cloop.mk index 9e31776227..059dd6c4bc 100644 --- a/target/cloop/cloop.mk +++ b/target/cloop/cloop.mk @@ -63,17 +63,6 @@ cloop-module: $(CLOOP_DIR)/cloop.o ### Note: target/default/device_table.txt is not yet supported! ck # the quickfix is to use sudo to mount the previous created cramroot check-tools: -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man - @rm -rf $(TARGET_DIR)/usr/share/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info - @rm -rf $(TARGET_DIR)/usr/share/info -endif - @rmdir -p --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share - which mkisofs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true - which symlinks && symlinks -r $(TARGET_DIR) $(IMAGE).cramfs: cramfsroot diff --git a/target/cpio/cpioroot.mk b/target/cpio/cpioroot.mk index c02d0209d6..08983ffd68 100644 --- a/target/cpio/cpioroot.mk +++ b/target/cpio/cpioroot.mk @@ -40,14 +40,6 @@ cpioroot-init: ln -s sbin/init $(TARGET_DIR)/init $(CPIO_BASE): host-fakeroot makedevs cpioroot-init - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/cramfs/cramfs.mk b/target/cramfs/cramfs.mk index e35bd1f218..e2ca41521b 100644 --- a/target/cramfs/cramfs.mk +++ b/target/cramfs/cramfs.mk @@ -52,15 +52,6 @@ endif CRAMFS_TARGET=$(IMAGE).cramfs cramfsroot: host-fakeroot makedevs cramfs - #-@find $(TARGET_DIR)/lib -type f -name \*.so\* | xargs $(STRIPCMD) --strip-unneeded 2>/dev/null || true - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CRAMFS_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/ext2/ext2root.mk b/target/ext2/ext2root.mk index 6ff51c8150..4fadefa194 100644 --- a/target/ext2/ext2root.mk +++ b/target/ext2/ext2root.mk @@ -87,18 +87,6 @@ EXT2_TARGET := $(EXT2_BASE) endif $(EXT2_BASE): host-fakeroot makedevs genext2fs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man - @rm -rf $(TARGET_DIR)/usr/share/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - @test -d $(TARGET_DIR)/usr/share && \ - rmdir -p --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share || \ - true - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(EXT2_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/initramfs/initramfs.mk b/target/initramfs/initramfs.mk index bbeae980f6..195a92904e 100644 --- a/target/initramfs/initramfs.mk +++ b/target/initramfs/initramfs.mk @@ -17,14 +17,6 @@ TARGETS+=$(INITRAMFS_TARGET) $(INITRAMFS_TARGET) initramfs: host-fakeroot makedevs rm -f $(TARGET_DIR)/init ln -s sbin/init $(TARGET_DIR)/init - -find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/jffs2/jffs2root.mk b/target/jffs2/jffs2root.mk index 1e03bf0467..a89dc80113 100644 --- a/target/jffs2/jffs2root.mk +++ b/target/jffs2/jffs2root.mk @@ -46,16 +46,6 @@ endif # just built. # $(JFFS2_TARGET): host-fakeroot makedevs mtd-host - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man - @rm -rf $(TARGET_DIR)/usr/share/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - @rmdir -p --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(JFFS2_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/romfs/romfs.mk b/target/romfs/romfs.mk index 1abb24829a..2e2470b4b2 100644 --- a/target/romfs/romfs.mk +++ b/target/romfs/romfs.mk @@ -37,14 +37,6 @@ romfs-dirclean: ROMFS_TARGET=$(IMAGE).romfs romfsroot: host-fakeroot makedevs romfs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(ROMFS_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/squashfs/squashfsroot.mk b/target/squashfs/squashfsroot.mk index 167f579863..019ed8bbcf 100644 --- a/target/squashfs/squashfsroot.mk +++ b/target/squashfs/squashfsroot.mk @@ -48,14 +48,6 @@ endif SQUASHFS_TARGET:=$(IMAGE).squashfs squashfsroot: host-fakeroot makedevs squashfs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(SQUASHFS_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/tar/tarroot.mk b/target/tar/tarroot.mk index 274c4c6f8c..5b33c62139 100644 --- a/target/tar/tarroot.mk +++ b/target/tar/tarroot.mk @@ -25,14 +25,6 @@ ROOTFS_TAR_COPYTO:=$(strip $(subst ",,$(BR2_TARGET_ROOTFS_TAR_COPYTO))) # ")) tarroot: host-fakeroot makedevs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 diff --git a/target/ubifs/ubifsroot.mk b/target/ubifs/ubifsroot.mk index 2f3e96505e..0820dbf68e 100644 --- a/target/ubifs/ubifsroot.mk +++ b/target/ubifs/ubifsroot.mk @@ -77,18 +77,6 @@ UBIFS_TARGET := $(UBIFS_BASE) endif $(UBIFS_BASE): host-fakeroot makedevs mkfs.ubifs - -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true -ifneq ($(BR2_HAVE_MANPAGES),y) - @rm -rf $(TARGET_DIR)/usr/man - @rm -rf $(TARGET_DIR)/usr/share/man -endif -ifneq ($(BR2_HAVE_INFOPAGES),y) - @rm -rf $(TARGET_DIR)/usr/info -endif - @test -d $(TARGET_DIR)/usr/share && \ - rmdir -p --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share || \ - true - $(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null) # Use fakeroot to pretend all target binaries are owned by root rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(UBIFS_TARGET)) touch $(PROJECT_BUILD_DIR)/.fakeroot.00000 -- 2.30.2