2018-04-20 15:27:59 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
2021-12-06 13:59:18 +00:00
|
|
|
## System-wide installation of python/node ?
|
|
|
|
SYSTEM_INSTALL=0
|
|
|
|
|
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
|
2021-07-23 14:15:53 +00:00
|
|
|
CACHE_DIR=_cache
|
|
|
|
|
|
|
|
## Internal directories
|
|
|
|
CACHE_SLIDES_DIR=$(CACHE_DIR)/slides
|
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
|
|
|
|
|
2021-11-25 15:59:13 +00:00
|
|
|
BUILD_VERSION=v$(shell date "+%Y%m%d-%H%M")
|
2021-07-23 14:15:53 +00:00
|
|
|
|
2020-11-09 09:05:12 +00:00
|
|
|
## 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
|
2024-02-16 22:57:43 +00:00
|
|
|
SLIDES_MDPP=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.mdpp' ! -regex '.*/_.*' \))
|
2021-07-23 14:15:53 +00:00
|
|
|
SLIDES_MDPP_MD=$(patsubst $(SLIDES_DIR)/%.mdpp,$(CACHE_SLIDES_DIR)/%.mdpp.md,$(SLIDES_MDPP))
|
|
|
|
SLIDES_MDPP_MD_PDF=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MDPP_MD))
|
2022-06-20 10:13:22 +00:00
|
|
|
SLIDES_MDPP_MD_PPTX=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MDPP_MD))
|
2021-07-23 14:15:53 +00:00
|
|
|
|
2024-02-16 22:57:43 +00:00
|
|
|
SLIDES_MD=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \)) $(SLIDES_MDPP_MD)
|
2021-07-23 14:15:53 +00:00
|
|
|
SLIDES_MD_PDF=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MD))
|
2022-06-20 10:13:22 +00:00
|
|
|
SLIDES_MD_PPTX=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MD))
|
2021-07-23 14:15:53 +00:00
|
|
|
|
2023-04-06 18:15:54 +00:00
|
|
|
SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD) $(SLIDES_DIR)/autoslide.md
|
|
|
|
SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF) $(BUILD_SLIDES_DIR)/autoslide.pdf
|
|
|
|
SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX) $(BUILD_SLIDES_DIR)/autoslide.pptx
|
|
|
|
|
2024-02-16 22:57:43 +00:00
|
|
|
DOCS_MD=$(shell find -L $(DOCS_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \))
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-04-10 10:38:42 +00:00
|
|
|
## Find .uml graphs
|
2024-02-16 22:57:43 +00:00
|
|
|
DOCS_IMAGES_UML=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.uml' ! -regex '.*/_.*' \))
|
2021-04-10 10:38:42 +00:00
|
|
|
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
|
2024-02-16 22:57:43 +00:00
|
|
|
DOCS_IMAGES_DOT=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.dot' ! -regex '.*/_.*' \))
|
2020-11-09 09:05:12 +00:00
|
|
|
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
|
2024-02-16 22:57:43 +00:00
|
|
|
DOCS_IMAGES_CIRCO=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.circo' ! -regex '.*/_.*' \))
|
2020-11-09 09:05:12 +00:00
|
|
|
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
|
2024-02-16 22:57:43 +00:00
|
|
|
DOCS_IMAGES_ORA=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.ora' ! -regex '.*/_.*' \))
|
2021-04-10 10:53:44 +00:00
|
|
|
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
|
|
|
|
2024-08-05 10:36:47 +00:00
|
|
|
prepare: prepare-slides
|
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
|
2024-02-16 22:57:43 +00:00
|
|
|
npm rebuild node-sass
|
2021-03-09 07:57:23 +00:00
|
|
|
npx browserslist@latest --update-db
|
2024-08-05 10:36:47 +00:00
|
|
|
.PHONY: prepare prepare-slides
|
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)"
|
2024-02-16 22:57:43 +00:00
|
|
|
for dir in $$(find -L $(DOCS_DIR) -type d -regextype sed -regex '.*/[0-9][^/]*/images$$') $(DOCS_DIR)/images ; do \
|
|
|
|
rsync -av $$dir/ $(SLIDES_DIR)/images/ || exit 1 ; \
|
|
|
|
done
|
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-07-23 14:15:53 +00:00
|
|
|
$(CACHE_SLIDES_DIR)/%.mdpp.md: $(SLIDES_DIR)/%.mdpp
|
|
|
|
mkdir -p "$$(dirname "$@")"
|
|
|
|
m4 -d -I$(SLIDES_DIR) -I$(CACHE_SLIDES_DIR) $< > $@ \
|
|
|
|
|| ( rm -f $@ && exit 1 )
|
|
|
|
|
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
|
2023-01-12 07:47:21 +00:00
|
|
|
$(MAKE) autoslide
|
2020-04-19 10:03:37 +00:00
|
|
|
pipenv run honcho start
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2023-04-06 18:15:54 +00:00
|
|
|
autoslide: $(SLIDES_DIR)/autoslide.md | $(BUILD_SLIDES_DIR)
|
|
|
|
|
|
|
|
$(SLIDES_DIR)/autoslide.md: $(DOCS_MD)
|
2024-02-16 22:57:43 +00:00
|
|
|
find -L $(DOCS_DIR) -regextype sed \( -regex '.*/[0-9][^/]*\.md' ! -regex '.*/_.*' \) -print0 \
|
2024-04-17 15:05:16 +00:00
|
|
|
| sort -z \
|
|
|
|
| xargs -0 sed '/^---$$/,/^---$$/d' \
|
2022-06-20 10:04:10 +00:00
|
|
|
> $(SLIDES_DIR)/autoslide.md
|
|
|
|
|
|
|
|
watch-autoslide-internal:
|
2024-02-16 22:57:43 +00:00
|
|
|
# FIXME: use watchexec instead
|
2022-06-20 10:04:10 +00:00
|
|
|
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
|
|
|
|
sleep 0.25 ; \
|
|
|
|
$(MAKE) autoslide ; \
|
|
|
|
done
|
|
|
|
|
2021-06-27 19:20:25 +00:00
|
|
|
watch-tocupdate-internal:
|
2024-02-16 22:57:43 +00:00
|
|
|
# FIXME: use watchexec instead
|
2022-06-20 10:13:08 +00:00
|
|
|
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
|
2021-06-27 21:44:08 +00:00
|
|
|
sleep 2 ; \
|
2021-06-27 19:20:25 +00:00
|
|
|
$(MAKE) images ; \
|
|
|
|
done
|
|
|
|
|
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 \
|
2024-02-16 22:57:43 +00:00
|
|
|
--allow-local-files \
|
2020-11-09 09:05:12 +00:00
|
|
|
--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
|
2022-06-20 10:04:10 +00:00
|
|
|
pipenv run honcho start slides autoslide
|
2020-09-03 09:30:31 +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
|
|
|
|
|
|
|
|
2021-12-06 11:22:19 +00:00
|
|
|
$(BUILD_SLIDES_DIR)/%.pdf: $(CACHE_SLIDES_DIR)/%.mdpp.md | $(BUILD_SLIDES_DIR) .marp/theme.css
|
2021-07-23 14:15:53 +00:00
|
|
|
npx marp --allow-local-files \
|
|
|
|
--engine $$(pwd)/.marp/engine.js \
|
|
|
|
--html \
|
|
|
|
--theme $$(pwd)/.marp/theme.css \
|
|
|
|
$< \
|
|
|
|
-o $@
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2021-12-06 11:22:19 +00:00
|
|
|
$(BUILD_SLIDES_DIR)/%.pdf: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
|
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
|
|
|
|
2022-06-20 10:13:22 +00:00
|
|
|
$(BUILD_SLIDES_DIR)/%.pptx: $(SLIDES_DIR)/%.md | $(BUILD_SLIDES_DIR) .marp/theme.css
|
|
|
|
npx marp --allow-local-files \
|
|
|
|
--engine $$(pwd)/.marp/engine.js \
|
|
|
|
--html \
|
|
|
|
--theme $$(pwd)/.marp/theme.css \
|
|
|
|
$< \
|
|
|
|
-o $@
|
|
|
|
|
2021-07-23 14:15:53 +00:00
|
|
|
$(BUILD_SLIDES_DIR):
|
|
|
|
mkdir -p $(BUILD_SLIDES_DIR)
|
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
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build: build-pdf build-html ## build all documents as PDF and HTML files
|
|
|
|
|
2022-06-20 10:13:22 +00:00
|
|
|
build-pptx: build-slides-pptx ## build slides as PPTX files
|
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-pdf: build-docs-pdf build-slides-pdf ## build both docs and slides as PDF files
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-html: build-docs-html build-slides-html ## build both docs and slides as HTML files
|
2021-12-21 15:39:51 +00:00
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-docs: build-docs-pdf build-docs-html ## build only docs as PDF and HTML
|
2021-12-21 15:39:51 +00:00
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-slides: build-slides-pdf build-slides-html ## build only slides as PDF and HTML
|
2021-12-21 18:54:12 +00:00
|
|
|
|
2023-04-06 18:20:15 +00:00
|
|
|
build-slides-pptx: $(SLIDES_PPTX_ALL) $(SLIDES_MD_ALL) ## build PPTX slides only
|
2021-12-21 15:39:51 +00:00
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-slides-pdf: $(SLIDES_PDF_ALL) $(SLIDES_MD_ALL) ## build PDF slides only
|
2021-07-23 14:15:53 +00:00
|
|
|
|
2022-06-20 10:13:08 +00:00
|
|
|
build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only
|
2021-12-21 18:54:12 +00:00
|
|
|
|
2021-07-23 14:15:53 +00:00
|
|
|
merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL)
|
2020-04-19 10:03:37 +00:00
|
|
|
|
|
|
|
.PHONY: build build-slides
|
|
|
|
|
|
|
|
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
|
|
|
|
##
|
|
|
|
|
2024-09-10 16:43:40 +00:00
|
|
|
clean: # remove generated documents
|
2020-04-19 10:03:37 +00:00
|
|
|
|
2024-09-10 16:43:40 +00:00
|
|
|
.PHONY: clean
|
2018-04-20 15:27:59 +00:00
|
|
|
|
2024-08-05 10:36:47 +00:00
|
|
|
include tasks/docs.mk
|
2024-09-10 16:43:40 +00:00
|
|
|
include tasks/slides.mk
|
2024-08-05 10:36:47 +00:00
|
|
|
include tasks/docker.mk
|
|
|
|
include tasks/utils.mk
|
2024-09-10 16:43:40 +00:00
|
|
|
include tasks/images.mk
|
2021-11-25 15:59:13 +00:00
|
|
|
|