util/docker: Update makefile target names

- Use dashes instead of underscores for consistency and to match other
coreboot targets
- Fix a couple of places where old target names were referenced
- Remove double 'help' target from .PHONEY target list

Change-Id: I3b464ebf74653a8cc880e982316fd883757ec728
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/18000
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-12-30 16:26:13 -07:00 committed by Martin Roth
parent af25fd78e8
commit 9ee70ce587
1 changed files with 23 additions and 24 deletions

View File

@ -16,42 +16,41 @@ export top=$(abspath $(CURDIR)/../..)
export crossgcc_version=$(shell $(top)/util/crossgcc/buildgcc --version | grep 'cross toolchain' | sed 's/^.*\sv//' | sed 's/\s.*$$//') export crossgcc_version=$(shell $(top)/util/crossgcc/buildgcc --version | grep 'cross toolchain' | sed 's/^.*\sv//' | sed 's/\s.*$$//')
export DOCKER:=$(shell env sh -c "command -v docker") export DOCKER:=$(shell env sh -c "command -v docker")
test_docker: test-docker:
$(if $(DOCKER),,\ $(if $(DOCKER),,\
$(warning Docker command not found. Please install docker) \ $(warning Docker command not found. Please install docker) \
$(warning https://docs.docker.com/engine/installation ) \ $(warning https://docs.docker.com/engine/installation ) \
$(error halting)) $(error halting))
test_docker_login: test_docker test-docker-login: test-docker
$(if $(shell if [ ! -f ~/.docker/config.json ]; then \ $(if $(shell if [ ! -f ~/.docker/config.json ]; then \
echo "docker authentication file not found"; fi), \ echo "docker authentication file not found"; fi), \
$(error Docker authentication file not found. Run 'docker login')) $(error Docker authentication file not found. Run 'docker login'))
coreboot-sdk: test_docker coreboot-sdk: test-docker
$(DOCKER) build -t coreboot/coreboot-sdk:$(crossgcc_version) coreboot-sdk $(DOCKER) build -t coreboot/coreboot-sdk:$(crossgcc_version) coreboot-sdk
upload-coreboot-sdk: test_docker_login upload-coreboot-sdk: test-docker-login
$(DOCKER) push coreboot/coreboot-sdk:$(crossgcc_version) $(DOCKER) push coreboot/coreboot-sdk:$(crossgcc_version)
coreboot-jenkins-node: test_docker coreboot-jenkins-node: test-docker
$(DOCKER) build -t coreboot/coreboot-jenkins-node:$(crossgcc_version) coreboot-jenkins-node $(DOCKER) build -t coreboot/coreboot-jenkins-node:$(crossgcc_version) coreboot-jenkins-node
upload-coreboot-jenkins-node: test_docker_login upload-coreboot-jenkins-node: test-docker-login
$(DOCKER) push coreboot/coreboot-jenkins-node:$(crossgcc_version) $(DOCKER) push coreboot/coreboot-jenkins-node:$(crossgcc_version)
docker-killall: test_docker docker-killall: test-docker
@if [ -n "$$($(DOCKER) ps | grep 'coreboot')" ]; then \ @if [ -n "$$($(DOCKER) ps | grep 'coreboot')" ]; then \
$(DOCKER) kill $$($(DOCKER) ps | grep 'coreboot' | cut -f1 -d ' '); \ $(DOCKER) kill $$($(DOCKER) ps | grep 'coreboot' | cut -f1 -d ' '); \
fi fi
clean_coreboot_containers: docker-killall clean-coreboot-containers: docker-killall
$(DOCKER) rm $(docker ps -a | grep 'coreboot' | sed 's|\s.*$||') $(DOCKER) rm $(docker ps -a | grep 'coreboot' | sed 's|\s.*$||')
clean_coreboot_images: docker-killall clean-coreboot-images: docker-killall
$(DOCKER) rmi $(docker images | grep coreboot | sed 's|^\S\+\s\+\S\+\s\+||' | sed 's|\s.*$||') $(DOCKER) rmi $(docker images | grep coreboot | sed 's|^\S\+\s\+\S\+\s\+||' | sed 's|\s.*$||')
docker_build_coreboot: test_docker docker-build-coreboot: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \ $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
--rm coreboot/coreboot-sdk:$(crossgcc_version) \ --rm coreboot/coreboot-sdk:$(crossgcc_version) \
/bin/bash -c "cd /home/coreboot/coreboot && \ /bin/bash -c "cd /home/coreboot/coreboot && \
@ -61,7 +60,7 @@ docker_build_coreboot: test_docker
@echo "Exiting now will leave built files owned by root" @echo "Exiting now will leave built files owned by root"
sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top) sudo chown -R $$(whoami):$$(id -gn $$(whoami)) $(top)
docker_abuild: test_docker docker-abuild: test-docker
$(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \ $(DOCKER) run -u root -it -v $(top):/home/coreboot/coreboot \
--rm coreboot/coreboot-sdk:$(crossgcc_version) \ --rm coreboot/coreboot-sdk:$(crossgcc_version) \
/bin/bash -c "cd /home/coreboot/coreboot && \ /bin/bash -c "cd /home/coreboot/coreboot && \
@ -73,20 +72,20 @@ docker_abuild: test_docker
help: help:
@echo "Commands for working with docker images:" @echo "Commands for working with docker images:"
@echo " build-coreboot-sdk - Build coreboot-sdk container" @echo " coreboot-sdk - Build coreboot-sdk container"
@echo " upload-coreboot-sdk - Upload coreboot-sdk to hub.docker.com" @echo " upload-coreboot-sdk - Upload coreboot-sdk to hub.docker.com"
@echo " build-coreboot-jenkins-node - Build coreboot-jenkins-node container" @echo " coreboot-jenkins-node - Build coreboot-jenkins-node container"
@echo " upload-coreboot-jenkins-node - Upload coreboot-jenkins-node to hub.docker.com" @echo " upload-coreboot-jenkins-node - Upload coreboot-jenkins-node to hub.docker.com"
@echo " clean_coreboot_containers - remove all docker coreboot containers" @echo " clean-coreboot-containers - remove all docker coreboot containers"
@echo " clean_coreboot_images - remove all docker coreboot images" @echo " clean-coreboot-images - remove all docker coreboot images"
@echo @echo
@echo "Commands for using docker images" @echo "Commands for using docker images"
@echo " docker_build_coreboot <BUILD_CMD=target> - Build coreboot under coreboot-sdk" @echo " docker-build-coreboot <BUILD_CMD=target> - Build coreboot under coreboot-sdk"
@echo " docker_abuild <ABUILD_ARGS='-a -B'> - Run abuild under coreboot-sdk" @echo " docker-abuild <ABUILD_ARGS='-a -B'> - Run abuild under coreboot-sdk"
.PHONY: test_docker test_docker_login help .PHONY: test-docker test-docker-login
.PHONY: build-coreboot-jenkins-node upload-coreboot-jenkins-node .PHONY: coreboot-jenkins-node upload-coreboot-jenkins-node
.PHONY: build-coreboot-sdk upload-coreboot-sdk .PHONY: coreboot-sdk upload-coreboot-sdk
.PHONY: clean_coreboot_containers clean_coreboot_images .PHONY: clean-coreboot-containers clean-coreboot-images
.PHONY: docker_build_coreboot docker_abuild .PHONY: docker-abuild
.PHONY: help .PHONY: help