From cf07f3b064ee78b27145f94c076e6b2080464e07 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Tue, 10 Sep 2024 18:43:40 +0200 Subject: [PATCH] refactor: split Makefile into task files --- Makefile | 38 ++++-------------------------------- tasks/docs.mk | 52 +++++++++++++++++++++++++++++++++++++++++++++++-- tasks/images.mk | 0 tasks/slides.mk | 7 +++++++ tasks/utils.mk | 3 +++ 5 files changed, 64 insertions(+), 36 deletions(-) create mode 100644 tasks/images.mk create mode 100644 tasks/slides.mk diff --git a/Makefile b/Makefile index 8165299..77c76ed 100755 --- a/Makefile +++ b/Makefile @@ -140,9 +140,6 @@ watch-tocupdate-internal: $(MAKE) images ; \ done -watch-docs-internal: - pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT) - watch-slides-internal: .marp/theme.css PORT=$(SLIDES_PORT) \ npx marp \ @@ -156,9 +153,6 @@ watch-slides-internal: .marp/theme.css watch-slides: ## run development server for PDF slides pipenv run honcho start slides autoslide -watch-docs: ## run development server for static docs site - pipenv run honcho start docs toc - serve: watch serve-slides: watch-slides serve-docs: watch-docs @@ -220,28 +214,8 @@ build-slides-html: $(SLIDES_HTML_ALL) ## build HTML slides only merge-slides: $(SLIDES_MDPP_MD) $(SLIDES_MD_ALL) -build-docs-pdf: ## build pdf docs only - mkdir -p $(BUILD_DOCS_DIR) - rm -f $(BUILD_DOCS_DIR)/combined.pdf - PYTHONUTF8=1 \ - ENABLE_PDF_EXPORT=1 \ - pipenv run mkdocs build \ - --site-dir $(BUILD_DOCS_DIR) - pdftk \ - $$(find -L $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \ - cat output $(BUILD_DOCS_DIR)/docs.pdf - -build-docs-html: ## build static docs site only - mkdir -p $(BUILD_DOCS_DIR) - pipenv run mkdocs build \ - --site-dir $(BUILD_DOCS_DIR) - .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 " @echo "" @@ -259,17 +233,13 @@ help: ## print this help ## Clean ## -clean: clean-slides clean-docs # remove generated documents +clean: # remove generated documents -clean-slides: - rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides - -clean-docs: - rm -fr $(BUILD_DOCS_DIR) # remove generated static docs site - -.PHONY: clean clean-slides clean-docs +.PHONY: clean include tasks/docs.mk +include tasks/slides.mk include tasks/docker.mk include tasks/utils.mk +include tasks/images.mk diff --git a/tasks/docs.mk b/tasks/docs.mk index 43ed290..0940253 100644 --- a/tasks/docs.mk +++ b/tasks/docs.mk @@ -1,12 +1,60 @@ # vim: set ft=make : -prepare: prepare-docs ## install prerequisites prepare-docs: ## install prerequisites for static docs site only pipenv install +.PHONY: prepare-docs +prepare: prepare-docs + sync-docs-internal: @>&2 echo "ERROR: not implemented" exit 1 -.PHONY: prepare-docs +clean-docs: ## remove generated static docs site + rm -fr $(BUILD_DOCS_DIR) + +.PHONY: clean-docs +clean: clean-docs + +deploy-docs: ## deploy static docs site to github + git push $(DEPLOY_REPO) + pipenv run mkdocs gh-deploy $(DEPLOY_OPTS) + +.PHONY: deploy-docs +deploy: deploy-docs + +build-docs-pdf: ## build pdf docs only + mkdir -p $(BUILD_DOCS_DIR) + rm -f $(BUILD_DOCS_DIR)/combined.pdf + PYTHONUTF8=1 \ + ENABLE_PDF_EXPORT=1 \ + pipenv run mkdocs build \ + --site-dir $(BUILD_DOCS_DIR) + pdftk \ + $$(find -L $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \ + cat output $(BUILD_DOCS_DIR)/docs.pdf + +.PHONY: build-docs-pdf +build-docs: build-docs-pdf + +build-docs-html: ## build static docs site only + mkdir -p $(BUILD_DOCS_DIR) + pipenv run mkdocs build \ + --site-dir $(BUILD_DOCS_DIR) + +.PHONY: build-docs-html +build-docs: build-docs-html + +build: build-docs + +watch-docs-internal: + pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT) +.PHONY: watch-docs-internal + +watch-docs: ## run development server for static docs site + pipenv run honcho start docs toc + +.PHONY: watch-docs +watch: watch-docs + diff --git a/tasks/images.mk b/tasks/images.mk new file mode 100644 index 0000000..e69de29 diff --git a/tasks/slides.mk b/tasks/slides.mk new file mode 100644 index 0000000..d0334bb --- /dev/null +++ b/tasks/slides.mk @@ -0,0 +1,7 @@ + +clean-slides: + rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides + +.PHONY: clean-slides +clean: clean-slides + diff --git a/tasks/utils.mk b/tasks/utils.mk index fb6db7e..a44b6a7 100644 --- a/tasks/utils.mk +++ b/tasks/utils.mk @@ -7,4 +7,7 @@ fixme: @egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR) +debug: + echo $(PWD) + .PHONY: fixme