summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRubens Panfili <rubens.panfili@gmail.com>2021-07-17 12:14:28 +0200
committerRubens Panfili <rubens.panfili@gmail.com>2021-07-17 12:14:28 +0200
commitb2e0a0e4023217cd031c6b5b40742282d7dbab60 (patch)
tree9593388d021ce972770852b6cd756be754241f48 /Makefile
parentf4a63717c4eaaffd0fb143da0b44aca313c8ea96 (diff)
Makefile pipeline
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4419763
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,52 @@
+#SHELL := /bin/sh
+
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+current_dir := $(dir $(mkfile_path))
+
+source_dir := ${current_dir}"src"
+artifact_dir := ${current_dir}"things"
+
+DOCKER_CMD := "docker"
+.DEFAULT_GOAL := help
+
+help: ## Will print this help.
+ @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
+.PHONY: help
+
+.DELETE_ON_ERROR:
+
+build: build-container config build-models ## Build everything. Executes the complete pipeline.
+ @echo "\nAll done"
+.PHONY: build
+
+check-requirements: # private
+ @if ! command -v ${DOCKER_CMD} %> /dev/null; then \
+ echo "Docker executable not found (\`${DOCKER_CMD}\`)." && \
+ exit 1; \
+ fi
+.PHONY: check-requirements
+
+build-container: check-requirements ## Build docker container.
+ @echo "\nBuilding container..\n" && \
+ ${DOCKER_CMD} build -t dactyl-keyboard -f docker/Dockerfile . && \
+ echo "Done"
+.PHONY: build-container
+
+config: check-requirements ## Generate configuration.
+ @echo "\nGenerate configuration..\n" && \
+ ${DOCKER_CMD} run --rm --name DM-config -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i generate_configuration.py && \
+ echo "Done"
+.PHONY: config
+
+build-models: check-requirements ## Build models.
+ @echo "\nGenerate models..\n" && \
+ cd ${current_dir} && \
+ ${DOCKER_CMD} run --rm --name DM-run -v ${source_dir}:/app/src -v ${artifact_dir}:/app/things dactyl-keyboard python3 -i dactyl_manuform.py && \
+ echo "Done"
+.PHONY: config
+
+shell: check-requirements ## Open an interactive shell inside a container.
+ @${DOCKER_CMD} run --rm -it --name DM-shell -v "src:/app/src" -v "things:/app/things" dactyl-keyboard bash && \
+ echo "\nBye!"
+.PHONY: shell
+