refactor: split Makefile into task files

This commit is contained in:
Glenn Y. Rolland 2024-09-10 18:43:40 +02:00
parent 1ebd4cbd4f
commit cf07f3b064
5 changed files with 64 additions and 36 deletions

View file

@ -140,9 +140,6 @@ watch-tocupdate-internal:
$(MAKE) images ; \ $(MAKE) images ; \
done done
watch-docs-internal:
pipenv run mkdocs serve --dev-addr 0.0.0.0:$(DOCS_PORT)
watch-slides-internal: .marp/theme.css watch-slides-internal: .marp/theme.css
PORT=$(SLIDES_PORT) \ PORT=$(SLIDES_PORT) \
npx marp \ npx marp \
@ -156,9 +153,6 @@ watch-slides-internal: .marp/theme.css
watch-slides: ## run development server for PDF slides watch-slides: ## run development server for PDF slides
pipenv run honcho start slides autoslide pipenv run honcho start slides autoslide
watch-docs: ## run development server for static docs site
pipenv run honcho start docs toc
serve: watch serve: watch
serve-slides: watch-slides serve-slides: watch-slides
serve-docs: watch-docs 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) 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 .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 help: ## print this help
@echo "Usage: make <target>" @echo "Usage: make <target>"
@echo "" @echo ""
@ -259,17 +233,13 @@ help: ## print this help
## Clean ## Clean
## ##
clean: clean-slides clean-docs # remove generated documents clean: # remove generated documents
clean-slides: .PHONY: clean
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
include tasks/docs.mk include tasks/docs.mk
include tasks/slides.mk
include tasks/docker.mk include tasks/docker.mk
include tasks/utils.mk include tasks/utils.mk
include tasks/images.mk

View file

@ -1,12 +1,60 @@
# vim: set ft=make : # vim: set ft=make :
prepare: prepare-docs ## install prerequisites
prepare-docs: ## install prerequisites for static docs site only prepare-docs: ## install prerequisites for static docs site only
pipenv install pipenv install
.PHONY: prepare-docs
prepare: prepare-docs
sync-docs-internal: sync-docs-internal:
@>&2 echo "ERROR: not implemented" @>&2 echo "ERROR: not implemented"
exit 1 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

0
tasks/images.mk Normal file
View file

7
tasks/slides.mk Normal file
View file

@ -0,0 +1,7 @@
clean-slides:
rm -fr $(BUILD_SLIDES_DIR) # remove generated PDF slides
.PHONY: clean-slides
clean: clean-slides

View file

@ -7,4 +7,7 @@
fixme: fixme:
@egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR) @egrep --color -rni '(fixme)' $(DOCS_DIR) $(SLIDES_DIR)
debug:
echo $(PWD)
.PHONY: fixme .PHONY: fixme