aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2019-02-18 16:44:25 +0000
committerRob Austein <sra@hactrn.net>2019-02-18 16:44:25 +0000
commit70d2b721caaf65f77270f82a5491316786e23aba (patch)
tree055655e5445dc5e9987a9ef9f03eb10881da9404
parent5921fac13d960116add86011b7e35f28674c0af0 (diff)
Clean up conditionals
-rw-r--r--Makefile22
1 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 679192e..69c66ae 100644
--- a/Makefile
+++ b/Makefile
@@ -2,18 +2,22 @@ XILINX_TARBALL := Xilinx_ISE_DS_Lin_14.7_1015_1.tar
XILINX_LICENSE := Xilinx.lic
XILINX_PKGDIR := fs/$(basename ${XILINX_TARBALL})
-BOOT_IMAGE := cryptech-builder:boot
BOOT_CONTAINER := cryptech-builder-boot
+BOOT_IMAGE := cryptech-builder:boot
BASE_IMAGE := cryptech-builder:base
+BASE_IMAGE_EXISTS := $(shell docker image ls -q ${BASE_IMAGE})
+BOOT_IMAGE_EXISTS := $(shell docker image ls -q ${BOOT_IMAGE})
+BOOT_CONTAINER_EXISTS := $(shell docker container ls -a --format='{{.Names}}' --filter='name=^/${BOOT_CONTAINER}$$')
+
ifneq (./,$(sort $(dir ${XILINX_TARBALL} ${XILINX_LICENSE})))
$(error XILINX_TARBALL and XILINX_LICENSE must be in this directory for bind mount)
endif
all:
-ifeq (,$(shell docker image ls -q ${BASE_IMAGE}))
- -docker container rm -f ${BOOT_CONTAINER}
-ifeq (,$(shell docker image ls -q ${BOOT_IMAGE}))
+ifeq (,${BASE_IMAGE_EXISTS})
+ docker container rm -f ${BOOT_CONTAINER} || true
+ifeq (,${BOOT_IMAGE_EXISTS})
rm -rf fs
mkdir fs
sudo /usr/sbin/debootstrap --foreign jessie fs
@@ -30,9 +34,7 @@ endif
${BOOT_IMAGE} \
/cryptech-builder/Builder
rm -rf fs
-ifneq (,$(wildcard /usr/bin/mogrify))
- -mogrify -verbose -format png *.xwd && rm -f *.xwd
-endif
+ mogrify -verbose -format png *.xwd && rm -f *.xwd || true
docker commit ${BOOT_CONTAINER} ${BASE_IMAGE}
docker container rm -f ${BOOT_CONTAINER}
endif
@@ -40,10 +42,10 @@ endif
clean:
git clean -dfx -e ${XILINX_TARBALL} -e ${XILINX_LICENSE}
- -docker container rm -f ${BOOT_CONTAINER}
+ docker container rm -f ${BOOT_CONTAINER} || true
sandblast: clean
- -docker image rm -f ${BOOT_IMAGE}
- -docker image rm -f ${BASE_IMAGE}
+ docker image rm -f ${BOOT_IMAGE} || true
+ docker image rm -f ${BASE_IMAGE} || true
.PHONY: all clean sandblast