Refactoring check for docker to fix a bug to use Makefile inside docker (#1735)
* Makefile: refactoring check for docker to fix a bug so Makefile could be used inside of docker container * Makefile: update .PHONY section
This commit is contained in:
29
Makefile
29
Makefile
@@ -19,8 +19,6 @@ ifdef DOCKER_COMPOSE
|
|||||||
DOCKER_BIN:=$(DOCKER_COMPOSE)
|
DOCKER_BIN:=$(DOCKER_COMPOSE)
|
||||||
else ifdef DOCKER_TOOL
|
else ifdef DOCKER_TOOL
|
||||||
DOCKER_BIN:=$(DOCKER_TOOL) compose
|
DOCKER_BIN:=$(DOCKER_TOOL) compose
|
||||||
else
|
|
||||||
$(error ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again)
|
|
||||||
endif # DOCKER_* checks
|
endif # DOCKER_* checks
|
||||||
endif # DOCKER_BIN
|
endif # DOCKER_BIN
|
||||||
|
|
||||||
@@ -71,7 +69,8 @@ list:
|
|||||||
@echo "\t * docker-clean - delete created docker container (but not pre-downloaded data for it)"
|
@echo "\t * docker-clean - delete created docker container (but not pre-downloaded data for it)"
|
||||||
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
|
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
|
||||||
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
|
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
|
||||||
@echo "\t * clean-full - delete files & directories generated by all the targets above "
|
@echo "\t * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
|
||||||
|
@echo "\t * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "NOTES on supported pass-trough targets:"
|
@echo "NOTES on supported pass-trough targets:"
|
||||||
@echo "\t * main Makefile is located in source/ directory and used to build the firmware itself;"
|
@echo "\t * main Makefile is located in source/ directory and used to build the firmware itself;"
|
||||||
@@ -91,16 +90,25 @@ list:
|
|||||||
# bash one-liner to generate langs for "make list":
|
# bash one-liner to generate langs for "make list":
|
||||||
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`"
|
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`"
|
||||||
|
|
||||||
|
# detect availability of docker
|
||||||
|
docker-check:
|
||||||
|
ifeq ($(DOCKER_BIN),)
|
||||||
|
@echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again"
|
||||||
|
@exit 1
|
||||||
|
else
|
||||||
|
@true
|
||||||
|
endif
|
||||||
|
|
||||||
# former start_dev.sh
|
# former start_dev.sh
|
||||||
docker-shell: $(DOCKER_DEPS)
|
docker-shell: docker-check $(DOCKER_DEPS)
|
||||||
$(DOCKER_CMD)
|
$(DOCKER_CMD)
|
||||||
|
|
||||||
# former build.sh
|
# former build.sh
|
||||||
docker-build: $(DOCKER_DEPS)
|
docker-build: docker-check $(DOCKER_DEPS)
|
||||||
$(DOCKER_CMD) /bin/bash /build/ci/buildAll.sh
|
$(DOCKER_CMD) /bin/bash /build/ci/buildAll.sh
|
||||||
|
|
||||||
# delete container
|
# delete container
|
||||||
docker-clean:
|
docker-clean: docker-check
|
||||||
-docker rmi ironos-builder:latest
|
-docker rmi ironos-builder:latest
|
||||||
|
|
||||||
# generate docs in site/ directory (DIR for -d is relative to mkdocs.yml file location, hence use default name/location site by setting up ../site)
|
# generate docs in site/ directory (DIR for -d is relative to mkdocs.yml file location, hence use default name/location site by setting up ../site)
|
||||||
@@ -115,11 +123,14 @@ docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documenta
|
|||||||
%:
|
%:
|
||||||
make -C source/ $@
|
make -C source/ $@
|
||||||
|
|
||||||
# global clean-up target
|
# global clean-up target for produced/generated files inside tree
|
||||||
clean-full: docker-clean
|
clean-build:
|
||||||
make -C source/ clean-all
|
make -C source/ clean-all
|
||||||
rm -Rf site
|
rm -Rf site
|
||||||
rm -Rf scripts/ci/artefacts
|
rm -Rf scripts/ci/artefacts
|
||||||
|
|
||||||
.PHONY: docker-shell docker-build docker-clean docs clean-full
|
# global clean-up target
|
||||||
|
clean-full: clean-build docker-clean
|
||||||
|
|
||||||
|
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user