-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
48 lines (36 loc) · 1.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Colors
LOW := \033[0;32m
HIGH := \033[0;31m
NC := \033[0m
# Makefile options and tools, which will be added to .PHONY
MAKEFILE_DEFAULT_OPTIONS = all clean test help check_dependencies
MAKEFILE_EXTRA_OPTIONS = update_version generate_makefile
TOOLS = docker-compose dockle gorin grype lmaop
define HELP_MESSAGE
$(LOW)Usage:$(NC)
$(LOW)make update_version$(NC) Updates the version of Dockerfiles, stacks and others
$(LOW)make generate_makefile$(NC) Generates the makefile for this project (using gorin)
endef
check_dependencies:
@missing=(); \
for cmd in $(TOOLS); do \
if ! command -v $$cmd &> /dev/null; then \
missing+=($$cmd); \
fi; \
done; \
if [ $${#missing[@]} -gt 0 ]; then \
echo "$(HIGH)ERROR: The following required tools are missing: $${missing[@]}.$(NC)"; \
exit 1; \
fi
.DEFAULT_GOAL := help
.PHONY: $(MAKEFILE_DEFAULT_OPTIONS) $(MAKEFILE_EXTRA_OPTIONS) $(TOOLS)
export HELP_MESSAGE
help:
@echo -e "$$HELP_MESSAGE"
update_version:
./update_workflows.sh $(VERSION)
./simplerisk/generate_dockerfile.sh $(VERSION)
./simplerisk-minimal/update_stack_and_workflows.sh $(VERSION)
./simplerisk-minimal/generate_dockerfile.sh $(VERSION)
generate_makefile: check_dependencies
@gorin makefile > Makefile