Skip to content

Commit 7b57cc9

Browse files
authored
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
1 parent 0be8359 commit 7b57cc9

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

Makefile

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ ifdef DOCKER_COMPOSE
1919
DOCKER_BIN:=$(DOCKER_COMPOSE)
2020
else ifdef DOCKER_TOOL
2121
DOCKER_BIN:=$(DOCKER_TOOL) compose
22-
else
23-
$(error ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again)
2422
endif # DOCKER_* checks
2523
endif # DOCKER_BIN
2624

@@ -64,14 +62,15 @@ help:
6462
list:
6563
@echo ""
6664
@echo "Supported top-level targets:"
67-
@echo "\t * help - shows short basic help"
68-
@echo "\t * list - this output"
65+
@echo "\t * help - shows short basic help"
66+
@echo "\t * list - this output"
6967
@echo "\t * docker-shell - start docker container with shell inside to work on IronOS with all tools needed"
7068
@echo "\t * docker-build - compile builds of IronOS for supported models inside docker container and place them to \"scripts/ci/artefacts/\""
7169
@echo "\t * docker-clean - delete created docker container (but not pre-downloaded data for it)"
72-
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
73-
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
74-
@echo "\t * clean-full - delete files & directories generated by all the targets above "
70+
@echo "\t * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
71+
@echo "\t * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
72+
@echo "\t * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
73+
@echo "\t * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
7574
@echo ""
7675
@echo "NOTES on supported pass-trough targets:"
7776
@echo "\t * main Makefile is located in source/ directory and used to build the firmware itself;"
@@ -91,16 +90,25 @@ list:
9190
# bash one-liner to generate langs for "make list":
9291
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`"
9392

93+
# detect availability of docker
94+
docker-check:
95+
ifeq ($(DOCKER_BIN),)
96+
@echo "ERROR: Can't find docker-compose nor docker tool. Please, install docker and try again"
97+
@exit 1
98+
else
99+
@true
100+
endif
101+
94102
# former start_dev.sh
95-
docker-shell: $(DOCKER_DEPS)
103+
docker-shell: docker-check $(DOCKER_DEPS)
96104
$(DOCKER_CMD)
97105

98106
# former build.sh
99-
docker-build: $(DOCKER_DEPS)
107+
docker-build: docker-check $(DOCKER_DEPS)
100108
$(DOCKER_CMD) /bin/bash /build/ci/buildAll.sh
101109

102110
# delete container
103-
docker-clean:
111+
docker-clean: docker-check
104112
-docker rmi ironos-builder:latest
105113

106114
# 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
115123
%:
116124
make -C source/ $@
117125

118-
# global clean-up target
119-
clean-full: docker-clean
126+
# global clean-up target for produced/generated files inside tree
127+
clean-build:
120128
make -C source/ clean-all
121129
rm -Rf site
122130
rm -Rf scripts/ci/artefacts
123131

124-
.PHONY: docker-shell docker-build docker-clean docs clean-full
132+
# global clean-up target
133+
clean-full: clean-build docker-clean
134+
135+
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full
125136

0 commit comments

Comments
 (0)