From 3407acc70f8bdbf2fa8338506b68e80e4cc85a93 Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Mon, 14 Oct 2024 09:12:07 +0000 Subject: [PATCH] Allow cleanup of logs as well and convert containerfile to a modifiable variable --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0923bfc..b188bd5 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,10 @@ include config.mk # touch $@ MANIFEST_FILE = ${IMAGE_DIR}/manifest.json +BUILD_INSTRUCTIONS = Containerfile # Autogenerated lists -CONTAINERS := $(shell find ./ -name 'Containerfile' -exec 'dirname' '{}' ';' | cut -d'/' -f2-) +CONTAINERS := $(shell find ./ -name '${BUILD_INSTRUCTIONS}' -exec 'dirname' '{}' ';' | cut -d'/' -f2-) IMAGE_DIRS := $(addsuffix /${IMAGE_DIR},${CONTAINERS}) BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS}) BUILD_LOGS := $(addsuffix /${BUILD_LOG},${CONTAINERS}) @@ -44,7 +45,7 @@ localbuild: $(BUILD_IDS) $(shell cat $<) \ dir:$*/${IMAGE_DIR} -%/${BUILD_ID_OUT}: %/Containerfile +%/${BUILD_ID_OUT}: %/${BUILD_INSTRUCTIONS} buildah build \ --jobs 0 \ --network=none \ @@ -56,7 +57,10 @@ localbuild: $(BUILD_IDS) $* # Clean up -clean: cleanbuild cleandirs +clean: cleanbuild cleandirs cleanlogs + +cleanlogs: + -rm -rv ${BUILD_LOGS} cleanbuild: -rm -rv ${BUILD_IDS} @@ -64,7 +68,7 @@ cleanbuild: cleandirs: -rm -rv ${IMAGE_DIRS} -.PHONY: all clean cleanbuild cleandirs localbuild unified +.PHONY: all clean cleanbuild cleandirs cleanlogs localbuild unified .SUFFIXES: # Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug*