docmachine-containers/tasks/slides.mk

116 lines
3 KiB
Makefile
Raw Normal View History

2024-09-22 21:42:11 +00:00
.PHONY: clean-slides
clean-slides:
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
2024-09-22 21:42:11 +00:00
.PHONY: clean
clean: clean-slides
2024-09-22 21:42:11 +00:00
.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
2024-09-22 23:03:10 +00:00
.PHONY: build-slides-pdf
build-pdf: build-slides-pdf ## build slides as PDF files
.PHONY: build-slides-html
build-html: build-slides-html ## build slides as HTML files
.PHONY: build-slides-pptx
build-pptx: build-slides-pptx ## build slides as PPTX files