Extend & improve cleanup functions
authorDaniel Abrecht <public@danielabrecht.ch>
Wed, 25 Sep 2019 18:59:53 +0000 (18:59 +0000)
committerDaniel Abrecht <public@danielabrecht.ch>
Wed, 25 Sep 2019 18:59:53 +0000 (18:59 +0000)
chroot-build-helper/real-makefile
makefile
src/make-helper-functions.mk

index b98fdaf7205335a872b0ea5227d7f0bde571188c..b57a1f833597c32a94e4dd921bcccc39c37c2f37 100644 (file)
@@ -101,3 +101,6 @@ clean-build: clean-buildenv
        rm -rf bin/$(DISTRO)/$(RELEASE)
        rmdir bin/$(DISTRO)/ || true
        rmdir bin || true
+
+clean-build-all:
+       uexec rm -rf "$(CURDIR)/build-env/" "$(CURDIR)/bin/"
index a986b4c71774430f63427a54ba8b3dcf955be1e0..05b687dfa734a2dad92b9ee30b0d75686f18ed3b 100644 (file)
--- a/makefile
+++ b/makefile
@@ -15,12 +15,10 @@ extra_packages:
        $(MAKE) -C chroot-build-helper
 
 clean-fs-all:
-       rm -rf build/
+       rm -rf build/*.img
 
 clean-fs:
-       rm -f "build/$(IMAGE_NAME)/bootfs.tar"
-       rm -f "build/$(IMAGE_NAME)/rootfs.tar"
-       rmdir "build/$(IMAGE_NAME)/" || true
+       rm -rf "build/$(IMAGE_NAME)/"
 
 clean-image-all:
        rm -f bin/*.img
@@ -162,11 +160,18 @@ reset-repo: reset-repo@fuseloop reset-repo@usernsexec reset-repo@tar2ext
        $(MAKE) -C kernel reset-repo
        $(MAKE) -C chroot-build-helper reset-repo
 
-clean-build:
+clean-build: clean-image clean-fs
        $(MAKE) -C uboot clean-build
        $(MAKE) -C kernel clean-build
        $(MAKE) -C chroot-build-helper clean-build
-       rm -rf bin/ build/
+       rm -rf build/bin/
+       rmdir build/ 2>/dev/null || true
+
+clean-build-all: clean-image-all clean-fs-all
+       $(MAKE) -C uboot clean-build
+       $(MAKE) -C kernel clean-build
+       $(MAKE) -C chroot-build-helper clean-build-all
+       rm -rf build/
 
 emulate: bin/$(IMAGE_NAME) kernel/bin/linux-image.deb
        qemu-system-aarch64 -M virt -cpu cortex-a53 -m 3G -kernel repo/linux/debian/tmp/boot/vmlinuz-* -append "root=/dev/vda3" -drive if=none,file=bin/"$(IMAGE_NAME)",format=raw,id=hd -device virtio-blk-device,drive=hd -nographic
index 6d2ec18348aa1b01aff56f14e006b3d70bf49903..1f11d6ef70b6c20f4dc7af50122f23a719d600a1 100644 (file)
@@ -83,7 +83,7 @@ chroot@%:
        uexec --allow-setgroups chroot_qemu_static.sh "$(realpath $(patsubst chroot@%,%,$@))" /bin/bash
 
 clean:
-       ! echo -n "Please use one of:\n * make clean-build\t# remove all build files\n * make clean-repo\t# remove the downloaded repos\n * make reset-repo\t# clean up all changes made to the repo & update it if possible\n * make clean-all\t# do all of the above\n * make reset # do all of the above, but keep the repos\n"
+       ! echo -n "Please use one of:\n * make clean-build\t# remove all files built for the target image (includes the image)\n * make clean-build-all\t# remove all files that have been built\n * make clean-repo\t# remove the downloaded repos\n * make reset-repo\t# clean up all changes made to the repo & update it if possible\n * make clean-all\t# same as 'make clean-repo clean-build'\n * make clean-all-all\t# same as 'make clean-repo clean-build-all'\n * make reset\t\t# same as 'make reset-repo clean-build'\n * make reset-all\t# same as 'make reset-repo clean-build-all'\n"
 
 repo/%/.repo:
        branch="$(repo-branch@$(patsubst repo/%/.repo,%,$@))"; \
@@ -155,4 +155,6 @@ config-unset@%:
        @ $(MAKE) --no-print-directory OLD_VALUE="$($(patsubst config-unset@%,%,$@))" "config-after-update@$(patsubst config-unset@%,%,$@)"
 
 clean-all: clean-repo clean-build
+clean-all-all: clean-repo clean-build-all
 reset: reset-repo clean-build
+reset-all: reset-repo clean-build-all