refactor: move tasks in subfiles

This commit is contained in:
Glenn Y. Rolland 2024-09-22 23:42:11 +02:00
parent a58dcec4ca
commit acec55dfff
4 changed files with 114 additions and 93 deletions

View file

@ -70,13 +70,8 @@ all: help
## Install prerequisites
##
prepare: prepare-slides
prepare-slides: ## install prerequisites for PDF slides only
npm install
npm rebuild node-sass
npx browserslist@latest --update-db
.PHONY: prepare prepare-slides
.PHONY: prepare
prepare:
images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images
@echo "Source:"
@ -111,81 +106,16 @@ $(CACHE_SLIDES_DIR)/%.mdpp.md: $(SLIDES_DIR)/%.mdpp
m4 -d -I$(SLIDES_DIR) -I$(CACHE_SLIDES_DIR) $< > $@ \
|| ( rm -f $@ && exit 1 )
.marp/theme.css:
cd .marp && $(MAKE) theme.css
watch: ## run development server
$(MAKE) autoslide
pipenv run honcho start
autoslide: $(SLIDES_DIR)/autoslide.md | $(BUILD_SLIDES_DIR)
$(SLIDES_DIR)/autoslide.md: $(DOCS_MD)
find -L $(DOCS_DIR) -regextype sed \( -regex '.*/[0-9][^/]*\.md' ! -regex '.*/_.*' \) -print0 \
| sort -z \
| xargs -0 sed '/^---$$/,/^---$$/d' \
> $(SLIDES_DIR)/autoslide.md
watch-autoslide-internal:
# FIXME: use watchexec instead
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
watch-tocupdate-internal:
# FIXME: use watchexec instead
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 2 ; \
$(MAKE) images ; \
done
watch-slides-internal: .marp/theme.css
PORT=$(SLIDES_PORT) \
npx marp \
--allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
-w $(SLIDES_DIR) \
-s
watch-slides: ## run development server for PDF slides
pipenv run honcho start slides autoslide
pipenv run honcho start
serve: watch
serve-slides: watch-slides
serve-docs: watch-docs
.PHONY: watch watch-slides watch-docs watch-slides-internal watch-docs-internal serve serve-docs serve-slides
$(BUILD_SLIDES_DIR)/%.pdf: $(CACHE_SLIDES_DIR)/%.mdpp.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pdf: $(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 $@
$(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 $@
$(BUILD_SLIDES_DIR):
mkdir -p $(BUILD_SLIDES_DIR)
.PHONY: watch serve
.PHONY: watch-docs serve-docs
.PHONY: watch-docs-internal
##
## Build final documents
@ -204,17 +134,7 @@ build-html: build-docs-html build-slides-html ## build both docs and slides as
build-docs: build-docs-pdf build-docs-html ## build only docs as PDF and HTML
build-slides: build-slides-pdf build-slides-html ## build only slides as PDF and HTML
build-slides-pptx: $(SLIDES_PPTX_ALL) $(SLIDES_MD_ALL) ## build PPTX slides only
build-slides-pdf: $(SLIDES_PDF_ALL) $(SLIDES_MD_ALL) ## build PDF slides only
build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only
merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL)
.PHONY: build build-slides
.PHONY: build
help: ## print this help
@echo "Usage: make <target>"

View file

@ -1,5 +1,7 @@
docs: make watch-docs-internal
slides: make watch-slides-internal
toc: make watch-tocupdate-internal
autoslide: make watch-autoslide-internal
# src-docs: make sync-docs-internal
# src-slides: make sync-slides-internal
src-autoslide: make watch-autoslide-internal
watch-docs: make watch-docs-internal
watch-slides: make watch-slides-internal
watch-toc: make watch-tocupdate-internal
# proxy: caddy

View file

@ -53,7 +53,7 @@ watch-docs-internal:
.PHONY: watch-docs-internal
watch-docs: ## run development server for static docs site
pipenv run honcho start docs toc
pipenv run honcho start watch-docs watch-toc
.PHONY: watch-docs
watch: watch-docs

View file

@ -1,7 +1,106 @@
.PHONY: clean-slides
clean-slides:
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
.PHONY: clean-slides
.PHONY: clean
clean: clean-slides
.PHONY: watch-slides-internal
watch-slides-internal: .marp/theme.css
PORT=$(SLIDES_PORT) \
npx marp \
--allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
-w $(SLIDES_DIR) \
-s
.PHONY: watch-slides serve-slides
watch-slides: ## run development server for PDF slides
pipenv run honcho start watch-slides src-autoslide
.PHONY: prepare
prepare: prepare-slides
.PHONY: prepare-slides
prepare-slides: ## install prerequisites for PDF slides only
npm install
npm rebuild node-sass
npx browserslist@latest --update-db
$(BUILD_SLIDES_DIR)/%.pdf: $(CACHE_SLIDES_DIR)/%.mdpp.md | $(BUILD_SLIDES_DIR) .marp/theme.css
npx marp --allow-local-files \
--engine $$(pwd)/.marp/engine.js \
--html \
--theme $$(pwd)/.marp/theme.css \
$< \
-o $@
$(BUILD_SLIDES_DIR)/%.pdf: $(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 $@
$(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 $@
.marp/theme.css:
cd .marp && $(MAKE) theme.css
$(BUILD_SLIDES_DIR):
mkdir -p $(BUILD_SLIDES_DIR)
.PHONY: build-slides
build-slides: build-slides-pdf build-slides-html ## build only slides as PDF and HTML
.PHONY: build-slides-pptx
build-slides-pptx: $(SLIDES_PPTX_ALL) $(SLIDES_MD_ALL) ## build PPTX slides only
.PHONY: build-slides-pdf
build-slides-pdf: $(SLIDES_PDF_ALL) $(SLIDES_MD_ALL) ## build PDF slides only
.PHONY: build-slides-html
build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only
.PHONY: merge-slides
merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL)
.PHONY: watch-slides
serve-slides: watch-slides
.PHONY: autoslide
autoslide: $(SLIDES_DIR)/autoslide.md | $(BUILD_SLIDES_DIR)
$(SLIDES_DIR)/autoslide.md: $(DOCS_MD)
find -L $(DOCS_DIR) -regextype sed \( -regex '.*/[0-9][^/]*\.md' ! -regex '.*/_.*' \) -print0 \
| sort -z \
| xargs -0 sed '/^---$$/,/^---$$/d' \
> $(SLIDES_DIR)/autoslide.md
.PHONY: watch-autoslide-internal
watch-autoslide-internal:
# FIXME: use watchexec instead
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
.PHONY: watch-tocupdate-internal
watch-tocupdate-internal:
# FIXME: use watchexec instead
while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \
sleep 2 ; \
$(MAKE) images ; \
done