1
0
forked from me/IronOS

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:
Ivan Zorin
2023-07-07 01:39:20 +03:00
committed by GitHub
parent 0be83598f1
commit 7b57cc981f

View File

@@ -19,8 +19,6 @@ ifdef DOCKER_COMPOSE
DOCKER_BIN:=$(DOCKER_COMPOSE)
else ifdef DOCKER_TOOL
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_BIN
@@ -71,7 +69,8 @@ list:
@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-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 "NOTES on supported pass-trough targets:"
@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":
# 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
docker-shell: $(DOCKER_DEPS)
docker-shell: docker-check $(DOCKER_DEPS)
$(DOCKER_CMD)
# former build.sh
docker-build: $(DOCKER_DEPS)
docker-build: docker-check $(DOCKER_DEPS)
$(DOCKER_CMD) /bin/bash /build/ci/buildAll.sh
# delete container
docker-clean:
docker-clean: docker-check
-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)
@@ -115,11 +123,14 @@ docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documenta
%:
make -C source/ $@
# global clean-up target
clean-full: docker-clean
# global clean-up target for produced/generated files inside tree
clean-build:
make -C source/ clean-all
rm -Rf site
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