Makefile: have cleanup and dependencies
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
1a69fc0059
commit
be0266b073
1 changed files with 16 additions and 7 deletions
23
Makefile
23
Makefile
|
@ -1,21 +1,30 @@
|
||||||
SRC := ./BuildSourceImage.sh
|
SRC := ./BuildSourceImage.sh
|
||||||
CTR_IMAGE := localhost/containers/buildsourceimage
|
CTR_IMAGE := localhost/containers/buildsourceimage
|
||||||
CTR_ENGINE ?= podman
|
CTR_ENGINE ?= podman
|
||||||
|
cleanfiles =
|
||||||
|
|
||||||
all: validate
|
all: validate
|
||||||
|
|
||||||
.PHONY: validate
|
validate: .validate
|
||||||
validate: $(SRC)
|
|
||||||
shellcheck $(SRC)
|
|
||||||
|
|
||||||
.PHONY: build-container
|
cleanfiles += .validate
|
||||||
build-container: Dockerfile
|
.validate: $(SRC)
|
||||||
|
shellcheck $(SRC) && touch $@
|
||||||
|
|
||||||
|
build-container: .build-container
|
||||||
|
|
||||||
|
cleanfiles += .build-container
|
||||||
|
.build-container: .validate Dockerfile $(SRC)
|
||||||
@echo
|
@echo
|
||||||
@echo "Building BuildSourceImage Container"
|
@echo "Building BuildSourceImage Container"
|
||||||
$(CTR_ENGINE) build --quiet --file Dockerfile --tag $(CTR_IMAGE) .
|
$(CTR_ENGINE) build --quiet --file Dockerfile --tag $(CTR_IMAGE) . && touch $@
|
||||||
|
|
||||||
.PHONY: test-integration
|
.PHONY: test-integration
|
||||||
test-integration: build-container
|
test-integration: .build-container
|
||||||
@echo
|
@echo
|
||||||
@echo "Running integration tests"
|
@echo "Running integration tests"
|
||||||
CTR_IMAGE=$(CTR_IMAGE) CTR_ENGINE=$(CTR_ENGINE) bats test/
|
CTR_IMAGE=$(CTR_IMAGE) CTR_ENGINE=$(CTR_ENGINE) bats test/
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
if [ -n "$(cleanfiles)" ] ; then rm -rf $(cleanfiles) ; fi
|
||||||
|
|
Loading…
Reference in a new issue