2018-04-20 15:27:59 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
## Configure this part if you wish to
|
|
|
|
DEPLOY_REPO=
|
|
|
|
DEPLOY_OPTS=
|
2020-11-09 09:05:12 +00:00
|
|
|
|
|
|
|
## Input directories
|
|
|
|
SLIDES_DIR=slides
|
|
|
|
DOCS_DIR=docs
|
|
|
|
IMAGES_DIR=images
|
2020-04-19 10:03:37 +00:00
|
|
|
BUILD_DIR=_build
|
2020-11-09 09:05:12 +00:00
|
|
|
|
|
|
|
## Output directories
|
|
|
|
BUILD_SLIDES_DIR=$(BUILD_DIR)/slides
|
|
|
|
BUILD_DOCS_DIR=$(BUILD_DIR)/docs
|
|
|
|
BUILD_IMAGES_DIR=images
|
|
|
|
|
|
|
|
## Ports
|
2020-04-19 10:44:17 +00:00
|
|
|
DOCS_PORT=5100
|
|
|
|
SLIDES_PORT=5200
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-11-09 09:05:12 +00:00
|
|
|
## Find .md slides
|
|
|
|
SLIDES_MD=$(shell find $(SLIDES_DIR) \( -name '*.md' ! -name '_*' \))
|
|
|
|
SLIDES_PDF=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MD))
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-04-10 10:38:42 +00:00
|
|
|
## Find .uml graphs
|
|
|
|
DOCS_IMAGES_UML=$(shell find $(IMAGES_DIR) \( -name '*.uml' ! -name '_*' \))
|
|
|
|
DOCS_IMAGES_UML_SVG=$(patsubst $(IMAGES_DIR)/%.uml,$(BUILD_IMAGES_DIR)/%.uml.svg,$(DOCS_IMAGES_UML))
|
|
|
|
|
2020-11-09 09:05:12 +00:00
|
|
|
## Find .dot graphs
|
|
|
|
DOCS_IMAGES_DOT=$(shell find $(IMAGES_DIR) \( -name '*.dot' ! -name '_*' \))
|
|
|
|
DOCS_IMAGES_DOT_SVG=$(patsubst $(IMAGES_DIR)/%.dot,$(BUILD_IMAGES_DIR)/%.dot.svg,$(DOCS_IMAGES_DOT))
|
2020-09-03 09:30:31 +00:00
|
|
|
|
2020-11-09 09:05:12 +00:00
|
|
|
## Find .circo graphs
|
|
|
|
DOCS_IMAGES_CIRCO=$(shell find $(IMAGES_DIR) \( -name '*.circo' ! -name '_*' \))
|
|
|
|
DOCS_IMAGES_CIRCO_SVG=$(patsubst $(IMAGES_DIR)/%.circo,$(BUILD_IMAGES_DIR)/%.circo.svg,$(DOCS_IMAGES_CIRCO))
|
2021-04-10 10:53:44 +00:00
|
|
|
|
|
|
|
## Find .ora images
|
|
|
|
DOCS_IMAGES_ORA=$(shell find $(IMAGES_DIR) \( -name '*.ora' ! -name '_*' \))
|
|
|
|
DOCS_IMAGES_ORA_PNG=$(patsubst $(IMAGES_DIR)/%.ora,$(BUILD_IMAGES_DIR)/%.ora.png,$(DOCS_IMAGES_ORA))
|
|
|
|
|
|
|
|
## Merge all lists
|
2021-04-10 10:38:42 +00:00
|
|
|
DOCS_IMAGES_SVG=$(DOCS_IMAGES_DOT_SVG) $(DOCS_IMAGES_CIRCO_SVG) $(DOCS_IMAGES_UML_SVG)
|
2021-04-10 10:53:44 +00:00
|
|
|
DOCS_IMAGES_PNG=$(DOCS_IMAGES_ORA_PNG)
|
2020-09-03 09:30:31 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
all: help
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
##
|
|
|
|
## Install prerequisites
|
|
|
|
##
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
prepare: prepare-slides prepare-docs ## install prerequisites
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
prepare-slides: ## install prerequisites for PDF slides only
|
|
|
|
npm install
|
2021-03-09 07:57:23 +00:00
|
|
|
npx browserslist@latest --update-db
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
prepare-docs: ## install prerequisites for static docs site only
|
|
|
|
pipenv install
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
.PHONY: prepare prepare-slides prepare-docs
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-04-10 10:53:44 +00:00
|
|
|
images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
|
|
|
|
@echo "Source:"
|
|
|
|
@echo " ora: $(DOCS_IMAGES_ORA)"
|
|
|
|
@echo " uml: $(DOCS_IMAGES_UML)"
|
|
|
|
@echo " dot: $(DOCS_IMAGES_DOT)"
|
|
|
|
@echo " circo: $(DOCS_IMAGES_CIRCO)"
|
|
|
|
@echo "Built: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG)"
|
2021-06-27 19:20:25 +00:00
|
|
|
|
2020-09-03 09:30:31 +00:00
|
|
|
.PHONY: images
|
|
|
|
|
2021-04-10 10:53:44 +00:00
|
|
|
%.ora.png: %.ora
|
|
|
|
TMPDIR="$$(mktemp -d)" \
|
|
|
|
&& unzip -q $< -d "$$TMPDIR" mergedimage.png \
|
|
|
|
&& touch "$$TMPDIR/mergedimage.png" \
|
|
|
|
&& mv "$$TMPDIR/mergedimage.png" $@
|
|
|
|
|
2021-04-10 10:38:42 +00:00
|
|
|
%.uml.svg: %.uml
|
|
|
|
plantuml -pipe -tsvg < $< > $@
|
|
|
|
|
2020-09-03 09:30:31 +00:00
|
|
|
%.dot.svg: %.dot
|
|
|
|
dot -Tsvg $< > $@
|
|
|
|
|
|
|
|
%.circo.svg: %.circo
|
|
|
|
circo -Tsvg $< > $@
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-04-15 13:42:45 +00:00
|
|
|
.marp/theme.css:
|
|
|
|
cd .marp && $(MAKE) theme.css
|
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
watch: ## run development server
|
|
|
|
pipenv run honcho start
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-06-27 19:20:25 +00:00
|
|
|
watch-tocupdate-internal:
|
|
|
|
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r docs ; do \
|
|
|
|
sleep 0.2 ; \
|
|
|
|
$(MAKE) images ; \
|
|
|
|
pipenv run ./scripts/update-toc $(DOCS_DIR) ; \
|
|
|
|
done
|
|
|
|
|
2020-09-03 09:30:31 +00:00
|
|
|
watch-docs-internal:
|
|
|
|
pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT)
|
|
|
|
|
2021-04-15 13:42:45 +00:00
|
|
|
watch-slides-internal: .marp/theme.css
|
2020-11-09 09:05:12 +00:00
|
|
|
PORT=$(SLIDES_PORT) \
|
|
|
|
npx marp \
|
|
|
|
--engine $$(pwd)/.marp/engine.js \
|
|
|
|
--html \
|
|
|
|
--theme $$(pwd)/.marp/theme.css \
|
|
|
|
-w $(SLIDES_DIR) \
|
|
|
|
-s
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-09-03 09:30:31 +00:00
|
|
|
watch-slides: ## run development server for PDF slides
|
|
|
|
pipenv run honcho start slides
|
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
watch-docs: ## run development server for static docs site
|
2020-09-03 09:30:31 +00:00
|
|
|
pipenv run honcho start docs toc
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
serve: watch
|
|
|
|
serve-slides: watch-slides
|
|
|
|
serve-docs: watch-docs
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-09-03 09:30:31 +00:00
|
|
|
.PHONY: watch watch-slides watch-docs watch-slides-internal watch-docs-internal serve serve-docs serve-slides
|
2018-04-20 15:27:59 +00:00
|
|
|
|
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
tocupdate:
|
2021-06-27 19:20:25 +00:00
|
|
|
pipenv run ./scripts/update-toc $(DOCS_DIR) ; \
|
|
|
|
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-11-09 09:05:12 +00:00
|
|
|
$(BUILD_SLIDES_DIR)/%.pdf: $(SLIDES_DIR)/%.md
|
|
|
|
mkdir -p $(BUILD_SLIDES_DIR)
|
2020-04-19 10:03:37 +00:00
|
|
|
npx marp --allow-local-files \
|
2020-09-03 09:30:31 +00:00
|
|
|
--engine $$(pwd)/.marp/engine.js \
|
2020-04-19 10:03:37 +00:00
|
|
|
--html \
|
2020-09-29 14:41:52 +00:00
|
|
|
--theme $$(pwd)/.marp/theme.css \
|
2020-04-19 10:03:37 +00:00
|
|
|
$< \
|
|
|
|
-o $@
|
2018-04-20 15:27:59 +00:00
|
|
|
|
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
##
|
|
|
|
## Build final documents
|
|
|
|
##
|
|
|
|
## slides => PDF
|
|
|
|
## docs => static web site
|
|
|
|
##
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
build: build-docs build-slides ## build all documents
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2020-04-19 10:03:37 +00:00
|
|
|
build-slides: $(SLIDES_PDF) $(SLIDES_MD) ## build PDF slides only
|
|
|
|
|
2021-06-27 19:20:25 +00:00
|
|
|
build-docs: ## build static docs site only
|
|
|
|
$(MAKE) tocupdate
|
2020-11-09 09:05:12 +00:00
|
|
|
mkdir -p $(BUILD_DOCS_DIR)
|
|
|
|
pipenv run mkdocs build \
|
|
|
|
--site-dir $(BUILD_DOCS_DIR)
|
2020-04-19 10:03:37 +00:00
|
|
|
|
|
|
|
.PHONY: build build-slides
|
|
|
|
|
|
|
|
deploy-docs: ## deploy static docs site to github
|
|
|
|
git push $(DEPLOY_REPO)
|
|
|
|
pipenv run mkdocs gh-deploy $(DEPLOY_OPTS)
|
|
|
|
|
|
|
|
help: ## print this help
|
|
|
|
@echo "Usage: make <target>"
|
|
|
|
@echo ""
|
|
|
|
@echo "With one of following targets:"
|
|
|
|
@echo ""
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} \
|
|
|
|
/^[a-zA-Z_-]+:.*?## / \
|
|
|
|
{ sub("\\\\n",sprintf("\n%22c"," "), $$2); \
|
|
|
|
printf("\033[36m%-20s\033[0m %s\n", $$1, $$2); \
|
|
|
|
}' $(MAKEFILE_LIST)
|
|
|
|
@echo ""
|
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
## Clean
|
|
|
|
##
|
|
|
|
|
|
|
|
clean: clean-slides clean-docs # remove generated documents
|
|
|
|
|
|
|
|
clean-slides:
|
2020-11-09 09:05:12 +00:00
|
|
|
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
|
2020-04-19 10:03:37 +00:00
|
|
|
|
|
|
|
clean-docs:
|
2020-11-09 09:05:12 +00:00
|
|
|
rm -fr $(BUILD_DOCS_DIR) # remove generated static docs site
|
2020-04-19 10:03:37 +00:00
|
|
|
|
|
|
|
.PHONY: clean clean-slides clean-docs
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-06-27 19:20:25 +00:00
|
|
|
##
|
|
|
|
## Utilities
|
|
|
|
##
|
|
|
|
|
|
|
|
fixme:
|
|
|
|
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
|
|
|
|
|
|
|
|
.PHONY: fixme
|