Allow cleanup of logs as well and convert containerfile to a modifiable variable

This commit is contained in:
Alex D. 2024-10-14 09:12:07 +00:00
parent a6da1589c1
commit 3407acc70f
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 8 additions and 4 deletions

View File

@ -18,9 +18,10 @@ include config.mk
# touch $@ # touch $@
MANIFEST_FILE = ${IMAGE_DIR}/manifest.json MANIFEST_FILE = ${IMAGE_DIR}/manifest.json
BUILD_INSTRUCTIONS = Containerfile
# Autogenerated lists # 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}) IMAGE_DIRS := $(addsuffix /${IMAGE_DIR},${CONTAINERS})
BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS}) BUILD_IDS := $(addsuffix /${BUILD_ID_OUT},${CONTAINERS})
BUILD_LOGS := $(addsuffix /${BUILD_LOG},${CONTAINERS}) BUILD_LOGS := $(addsuffix /${BUILD_LOG},${CONTAINERS})
@ -44,7 +45,7 @@ localbuild: $(BUILD_IDS)
$(shell cat $<) \ $(shell cat $<) \
dir:$*/${IMAGE_DIR} dir:$*/${IMAGE_DIR}
%/${BUILD_ID_OUT}: %/Containerfile %/${BUILD_ID_OUT}: %/${BUILD_INSTRUCTIONS}
buildah build \ buildah build \
--jobs 0 \ --jobs 0 \
--network=none \ --network=none \
@ -56,7 +57,10 @@ localbuild: $(BUILD_IDS)
$* $*
# Clean up # Clean up
clean: cleanbuild cleandirs clean: cleanbuild cleandirs cleanlogs
cleanlogs:
-rm -rv ${BUILD_LOGS}
cleanbuild: cleanbuild:
-rm -rv ${BUILD_IDS} -rm -rv ${BUILD_IDS}
@ -64,7 +68,7 @@ cleanbuild:
cleandirs: cleandirs:
-rm -rv ${IMAGE_DIRS} -rm -rv ${IMAGE_DIRS}
.PHONY: all clean cleanbuild cleandirs localbuild unified .PHONY: all clean cleanbuild cleandirs cleanlogs localbuild unified
.SUFFIXES: .SUFFIXES:
# Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug* # Somehow GNU make forgets these are intermediates if not explicitly stated, feel free to look into it *shrug*