dockcross/Makefile

187 lines
6.0 KiB
Makefile
Raw Normal View History

#
# Parameters
#
# Name of the docker executable
DOCKER = docker
# Docker organization to pull the images from
ORG = dockcross
# Directory where to generate the dockcross script for each images (e.g bin/dockcross-manylinux-x64)
BIN = ./bin
# These images are built using the "build implicit rule"
STANDARD_IMAGES = linux-s390x android-arm android-arm64 linux-x86 linux-x64 linux-arm64 linux-armv5 linux-armv6 linux-armv7 linux-mips linux-mipsel linux-ppc64le windows-x86 windows-x64 windows-x64-posix
# Generated Dockerfiles.
2018-07-15 12:43:55 +02:00
GEN_IMAGES = linux-s390x linux-mips manylinux-x86 manylinux-x64 browser-asmjs linux-arm64 windows-x86 windows-x64 windows-x64-posix linux-armv7 linux-armv5
GEN_IMAGE_DOCKERFILES = $(addsuffix /Dockerfile,$(GEN_IMAGES))
# These images are expected to have explicit rules for *both* build and testing
NON_STANDARD_IMAGES = browser-asmjs manylinux-x64 manylinux-x86
DOCKER_COMPOSITE_SOURCES = common.docker common.debian common.manylinux common.crosstool common.windows
# This list all available images
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
IMAGES = $(STANDARD_IMAGES) $(NON_STANDARD_IMAGES)
# Optional arguments for test runner (test/run.py) associated with "testing implicit rule"
linux-ppc64le.test_ARGS = --languages C
windows-x86.test_ARGS = --exe-suffix ".exe"
windows-x64.test_ARGS = --exe-suffix ".exe"
windows-x64-posix.test_ARGS = --exe-suffix ".exe"
# On CircleCI, do not attempt to delete container
# See https://circleci.com/docs/docker-btrfs-error/
RM = --rm
ifeq ("$(CIRCLECI)", "true")
RM =
endif
# Tag images with date and Git short hash in addition to revision
TAG = $(shell date '+%Y%m%d')-$(shell git rev-parse --short HEAD)
#
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
# images: This target builds all IMAGES (because it is the first one, it is built by default)
#
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
images: base $(IMAGES)
#
# test: This target ensures all IMAGES are built and run the associated tests
#
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
test: base.test $(addsuffix .test,$(IMAGES))
#
# Generic Targets (can specialize later).
#
$(GEN_IMAGE_DOCKERFILES) Dockerfile: %Dockerfile: %Dockerfile.in $(DOCKER_COMPOSITE_SOURCES)
sed \
-e '/common.docker/ r common.docker' \
-e '/common.debian/ r common.debian' \
-e '/common.manylinux/ r common.manylinux' \
-e '/common.crosstool/ r common.crosstool' \
-e '/common.windows/ r common.windows' \
$< > $@
#
# browser-asmjs
#
browser-asmjs: browser-asmjs/Dockerfile
mkdir -p $@/imagefiles && cp -r imagefiles $@/
cp -r test browser-asmjs/
2017-08-27 05:48:47 +02:00
$(DOCKER) build -t $(ORG)/browser-asmjs:latest \
--build-arg IMAGE=$(ORG)/browser-asmjs \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
browser-asmjs
$(DOCKER) build -t $(ORG)/browser-asmjs:$(TAG) \
--build-arg IMAGE=$(ORG)/browser-asmjs \
--build-arg VERSION=$(TAG) \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
browser-asmjs
rm -rf browser-asmjs/test
rm -rf $@/imagefiles
2015-05-19 23:34:05 +02:00
browser-asmjs.test: browser-asmjs
cp -r test browser-asmjs/
$(DOCKER) run $(RM) dockcross/browser-asmjs > $(BIN)/dockcross-browser-asmjs && chmod +x $(BIN)/dockcross-browser-asmjs
$(BIN)/dockcross-browser-asmjs python test/run.py --exe-suffix ".js"
rm -rf browser-asmjs/test
#
# manylinux-x64
2016-09-20 17:35:18 +02:00
manylinux-x64: manylinux-x64/Dockerfile
mkdir -p $@/imagefiles && cp -r imagefiles $@/
2017-08-27 05:48:47 +02:00
$(DOCKER) build -t $(ORG)/manylinux-x64:latest \
--build-arg IMAGE=$(ORG)/manylinux-x64 \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-f manylinux-x64/Dockerfile .
$(DOCKER) tag $(ORG)/manylinux-x64:latest $(ORG)/manylinux-x64:$(TAG)
rm -rf $@/imagefiles
manylinux-x64.test: manylinux-x64
$(DOCKER) run $(RM) dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64
2016-09-20 17:35:18 +02:00
$(BIN)/dockcross-manylinux-x64 /opt/python/cp35-cp35m/bin/python test/run.py
#
# manylinux-x86
#
2016-09-25 05:14:33 +02:00
manylinux-x86: manylinux-x86/Dockerfile
mkdir -p $@/imagefiles && cp -r imagefiles $@/
2017-08-27 05:48:47 +02:00
$(DOCKER) build -t $(ORG)/manylinux-x86:latest \
--build-arg IMAGE=$(ORG)/manylinux-x86 \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-f manylinux-x86/Dockerfile .
$(DOCKER) tag $(ORG)/manylinux-x86:latest $(ORG)/manylinux-x86:$(TAG)
rm -rf $@/imagefiles
2016-09-25 05:14:33 +02:00
manylinux-x86.test: manylinux-x86
$(DOCKER) run $(RM) dockcross/manylinux-x86 > $(BIN)/dockcross-manylinux-x86 && chmod +x $(BIN)/dockcross-manylinux-x86
2016-09-25 05:14:33 +02:00
$(BIN)/dockcross-manylinux-x86 /opt/python/cp35-cp35m/bin/python test/run.py
#
# base
#
base: Dockerfile imagefiles/
2017-08-27 05:48:47 +02:00
$(DOCKER) build -t $(ORG)/base:latest \
--build-arg IMAGE=$(ORG)/base \
--build-arg VCS_URL=`git config --get remote.origin.url` \
.
base.test: base
$(DOCKER) run $(RM) dockcross/base > $(BIN)/dockcross-base && chmod +x $(BIN)/dockcross-base
#
# display
#
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
display_images:
for image in $(IMAGES); do echo $$image; done
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
$(VERBOSE).SILENT: display_images
#
# build implicit rule
#
$(STANDARD_IMAGES): %: %/Dockerfile base
mkdir -p $@/imagefiles && cp -r imagefiles $@/
2017-08-27 05:48:47 +02:00
$(DOCKER) build -t $(ORG)/$@:latest \
--build-arg IMAGE=$(ORG)/$@ \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg VCS_URL=`git config --get remote.origin.url` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
$@
$(DOCKER) tag $(ORG)/$@:latest $(ORG)/$@:$(TAG)
rm -rf $@/imagefiles
#
# testing implicit rule
#
.SECONDEXPANSION:
$(addsuffix .test,$(STANDARD_IMAGES)): $$(basename $$@)
$(DOCKER) run $(RM) dockcross/$(basename $@) > $(BIN)/dockcross-$(basename $@) && chmod +x $(BIN)/dockcross-$(basename $@)
$(BIN)/dockcross-$(basename $@) python test/run.py $($@_ARGS)
#
# testing prerequisites implicit rule
#
test.prerequisites:
mkdir -p $(BIN)
$(addsuffix .test,base $(IMAGES)): test.prerequisites
Makefile: All images are tested. Remove ALL_IMAGES and DEFAULT_IMAGES vars. To confirm that the Makefiles works as expected after this patch, the list of executed commands before and after has been compared. Before: ``` make --dry-run > ../dockcross-make-baseline make test --dry-run > ../dockcross-make-test-baseline ``` After: ``` make --dry-run > ../dockcross-make-current; make test --dry-run > ../dockcross-make-test-current for target in make make-test; do diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current> /dev/null 2>&1 [[ $? == 1 ]] && \ echo "" && \ echo "-------------------------------" && \ echo "Here is output of:" && \ echo " diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current" && \ echo "" && \ diff --ignore-trailing-space ../dockcross-$target-baseline ../dockcross-$target-current done ``` Output: ``` ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-baseline ../dockcross-make-current 8a9 > docker build -t dockcross/linux-ppc64le linux-ppc64le 10a12,14 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test ------------------------------- Here is output of: diff --ignore-trailing-space ../dockcross-make-test-baseline ../dockcross-make-test-current 24a25,27 > docker build -t dockcross/linux-ppc64le linux-ppc64le > docker run --rm dockcross/linux-ppc64le > bin/dockcross-linux-ppc64le && chmod +x bin/dockcross-linux-ppc64le > bin/dockcross-linux-ppc64le python test/run.py --languages C 30a34,38 > cp -r test browser-asmjs/ > docker build -t dockcross/browser-asmjs browser-asmjs > rm -rf browser-asmjs/test > docker run --rm dockcross/browser-asmjs > bin/dockcross-browser-asmjs && chmod +x bin/dockcross-browser-asmjs > bin/dockcross-browser-asmjs python test/run.py --exe-suffix ".js" ```
2016-09-26 05:28:23 +02:00
.PHONY: base images $(IMAGES) test %.test