Skip to content

Commit

Permalink
Refactoring check for docker to fix a bug to use Makefile inside dock…
Browse files Browse the repository at this point in the history
…er (#1735)

* Makefile: refactoring check for docker to fix a bug so Makefile could be used inside of docker container

* Makefile: update .PHONY section
  • Loading branch information
ia authored Jul 6, 2023
1 parent 0be8359 commit 7b57cc9
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -64,14 +62,15 @@ help:
list:
@echo ""
@echo "Supported top-level targets:"
@echo "\t * help - shows short basic help"
@echo "\t * list - this output"
@echo "\t * help - shows short basic help"
@echo "\t * list - this output"
@echo "\t * docker-shell - start docker container with shell inside to work on IronOS with all tools needed"
@echo "\t * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\""
@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 * 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-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;"
Expand All @@ -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)
Expand All @@ -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

0 comments on commit 7b57cc9

Please sign in to comment.