From b132282088693eb44888fe2dd79b8ff84be93fff Mon Sep 17 00:00:00 2001 From: Jan Stastny Date: Thu, 30 Jan 2020 11:42:02 +0100 Subject: [PATCH] Possibility to override versions This enables running: `make all IMAGEMAGICK_VERSION=7.0.9-20` We conditionally pass parameters like `IMAGEMAGICK_VERSION=7.0.9-20` when invoking `make` inside Docker. The `DOCKER_MAKE_PARAMS` contains conditions to only have the parameters that are not empty. Otherwise we would pass empty variables like `IMAGEMAGICK_VERSION=` and the conditional parameter in `Makefile_ImageMagick` like `IMAGEMAGICK_VERSION ?= 7.0.8-45` would not get applied. --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1f5f66b..608c911 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,17 @@ MOUNTS = -v $(PROJECT_ROOT):/var/task \ -v $(PROJECT_ROOT)result:$(TARGET) DOCKER = docker run -it --rm -w=/var/task/build -build result: + +DOCKER_MAKE_PARAMS = TARGET_DIR=$(TARGET) \ + $(if $(LIBPNG_VERSION),LIBPNG_VERSION=$(LIBPNG_VERSION)) \ + $(if $(LIBJPG_VERSION),LIBJPG_VERSION=$(LIBJPG_VERSION)) \ + $(if $(OPENJP2_VERSION),OPENJP2_VERSION=$(OPENJP2_VERSION)) \ + $(if $(LIBTIFF_VERSION),LIBTIFF_VERSION=$(LIBTIFF_VERSION)) \ + $(if $(BZIP2_VERSION),BZIP2_VERSION=$(BZIP2_VERSION)) \ + $(if $(LIBWEBP_VERSION),LIBWEBP_VERSION=$(LIBWEBP_VERSION)) \ + $(if $(IMAGEMAGICK_VERSION),IMAGEMAGICK_VERSION=$(IMAGEMAGICK_VERSION)) + +build result: mkdir $@ clean: @@ -20,7 +30,7 @@ bash: $(DOCKER) $(MOUNTS) --entrypoint /bin/bash -t $(DOCKER_IMAGE) all libs: - $(DOCKER) $(MOUNTS) --entrypoint /usr/bin/make -t $(DOCKER_IMAGE) TARGET_DIR=$(TARGET) -f ../Makefile_ImageMagick $@ + $(DOCKER) $(MOUNTS) --entrypoint /usr/bin/make -t $(DOCKER_IMAGE) $(DOCKER_MAKE_PARAMS) -f ../Makefile_ImageMagick $@ STACK_NAME ?= imagemagick-layer