Makefile (2653B)
1 # +-----------------------------------------------------------+ 2 # * Docker tests for the autobuild script 3 # +-----------------------------------------------------------+ 4 5 # List of available OS. 6 DOCKER_OS = $(patsubst %.Dockerfile.in, %, \ 7 $(notdir $(wildcard docker/templates/*.Dockerfile.in))) 8 9 # Arguments to pass to docker build . 10 DOCKER_BUILD_ARGS = -q -t 11 12 # Advice make not to delete these "intermediate" files. 13 .PRECIOUS: docker/%.Dockerfile docker/.%.build docker/.%.container 14 15 # Avoid conflicts with real files 16 SUBDIRS = docker 17 .PHONY: subdirs $(SUBDIRS) 18 19 all: docker/test 20 test: docker/test 21 check: docker/test 22 23 # Create the Podman VM, if it hasn't already been created 24 create-vm: 25 podman machine init --cpus 8 --memory 8192 --disk-size 50 || exit 0 26 27 # Start Podman, if it isn't running 28 start-vm: create-vm 29 podman machine start || exit 0 30 touch .$@ 31 32 # Stop Podman 33 stop-vm: 34 podman machine stop 35 36 # Create the Dockerfile 37 docker/%.Dockerfile: docker/templates/%.Dockerfile.in \ 38 docker/templates/Dockerfile.common.in 39 @echo Creating Dockerfile for target $* 40 cat $^ > $@ 41 42 # Build the Docker Image. Since we are building a new image, remove the existing container. 43 docker/.%.build: docker/%.Dockerfile ../autobuild docker/lib 44 @echo Building target image $* 45 podman image build $(DOCKER_BUILD_ARGS) epdfinfo/$* -f $< ../../ 46 touch $@ 47 48 # Build the Docker Container 49 docker/.%.container: docker/.%.build 50 @echo Building target container $* 51 podman container create $(DOCKER_BUILD_ARGS) --name epdfinfo-$* epdfinfo/$* 52 touch $@ 53 54 # Run the Containers generated by the dockerfile 55 docker/%: docker/.%.container 56 @echo Running tests on target $* 57 podman container start -a epdfinfo-$* 58 59 # Run all Dockerfiles 60 docker/test: docker/build $(patsubst %, docker/%, $(DOCKER_OS)) 61 62 # Build all Dockerfiles 63 docker/build: $(patsubst %, docker/.%.build, $(DOCKER_OS)) 64 65 docker/.%.clean: 66 @echo Cleaning target $* 67 podman container rm epdfinfo-$* || exit 0 68 69 docker/clean: $(patsubst %, docker/.%.clean, $(DOCKER_OS)) 70 71 test: docker/test 72 73 clean: docker/clean 74 rm -f -- docker/.[^.]*.build 75 rm -f -- docker/.[^.]*.container 76 rm -f -- docker/*.Dockerfile 77 78 print: 79 @echo List of Operating systems where server compilation is tested [via Docker]: 80 @for os in $(DOCKER_OS); do echo - $$os; done | sort 81 82 print-failing: FAILING_OS := $(patsubst %.Dockerfile.in.FAILING, %, \ 83 $(notdir $(wildcard docker/templates/*.Dockerfile.in.FAILING))) 84 85 print-failing: 86 @echo List of Operating systems where server compilation is not tested: 87 @for os in $(FAILING_OS); do echo - $$os; done | sort 88 @echo PLEASE help support your favorite OS! More details at: https://pdftools.wiki/A401543C