2024-08-12 11:43:25 +02:00
|
|
|
# See: https://www.mkdocs.org/user-guide/deploying-your-docs/
|
|
|
|
# Running 'make' uses poetry-installed mkdocs
|
|
|
|
# Running 'USE_DOCKER=true make' uses docker mkdocs
|
2019-07-31 08:25:51 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
.PHONY: prepare_docs generate_docs deploy test_docs
|
2019-07-31 08:25:51 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
MKDOCS_DOCKER_IMAGE := squidfunk/mkdocs-material
|
2019-08-02 10:28:08 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
DOCS_DIST_DIR := ./docs
|
2019-07-31 08:25:51 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
DOCS_SRC_DIR := ./documentation
|
2019-07-31 08:25:51 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
USE_DOCKER ?=
|
2019-08-02 10:28:08 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
.DEFAULT_GOAL := generate_docs
|
2019-08-02 10:28:08 +02:00
|
|
|
|
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
prepare_docs:
|
|
|
|
@echo "Preparing documentation."
|
2024-08-24 11:20:28 +02:00
|
|
|
poetry install --with docs,unstable
|
2024-08-12 11:43:25 +02:00
|
|
|
poetry run python $(DOCS_SRC_DIR)/generate_documentation.py
|
|
|
|
mkdir -p $(DOCS_DIST_DIR)/logos
|
|
|
|
mkdir -p $(DOCS_DIST_DIR)/expansion/logos
|
|
|
|
mkdir -p $(DOCS_DIST_DIR)/export_mod/logos
|
|
|
|
mkdir -p $(DOCS_DIST_DIR)/import_mod/logos
|
|
|
|
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/logos
|
|
|
|
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/expansion/logos
|
|
|
|
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/export_mod/logos
|
|
|
|
cp -R $(DOCS_SRC_DIR)/logos/* $(DOCS_DIST_DIR)/import_mod/logos
|
|
|
|
cp $(DOCS_SRC_DIR)/mkdocs/*.md $(DOCS_DIST_DIR)
|
|
|
|
cp LICENSE $(DOCS_DIST_DIR)/license.md
|
|
|
|
|
2019-08-02 10:28:08 +02:00
|
|
|
|
2024-08-12 11:43:25 +02:00
|
|
|
generate_docs: prepare_docs
|
|
|
|
ifeq ($(USE_DOCKER), true)
|
|
|
|
@echo "Generating documentation using '$(MKDOCS_DOCKER_IMAGE)'."
|
|
|
|
docker run --rm -it -v $(PWD):/docs $(MKDOCS_DOCKER_IMAGE) build
|
|
|
|
else
|
|
|
|
@echo "Generating docunentation."
|
|
|
|
poetry run mkdocs build
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
deploy: generate_docs
|
|
|
|
ifeq ($(USE_DOCKER), true)
|
|
|
|
@echo "Deploying documentation using '$(MKDOCS_DOCKER_IMAGE)'."
|
|
|
|
docker run --rm -it -v $(PWD):/docs -v /home/$(whoami)/.docker:/root/.docker:ro $(MKDOCS_DOCKER_IMAGE) gh-deploy
|
|
|
|
else
|
|
|
|
@echo "Deploying docunentation."
|
|
|
|
poetry run mkdocs gh-deploy
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
test_docs: prepare_docs
|
|
|
|
ifeq ($(USE_DOCKER), true)
|
|
|
|
@echo "Serving documentation using '$(MKDOCS_DOCKER_IMAGE)'."
|
|
|
|
docker run --rm -it -v $(PWD):/docs -p 8000:8000 $(MKDOCS_DOCKER_IMAGE)
|
|
|
|
else
|
|
|
|
@echo "Serving docunentation."
|
|
|
|
poetry run mkdocs serve
|
|
|
|
endif
|