1- # ------------------------------------------
1+ # -------------------------------------- #
22# Practicalli: Makefile
33#
44# Consistent set of targets to support local book development
5- # ------------------------------------------
5+ # -------------------------------------- #
66
7+ # -- Makefile task config -------------- #
78# .PHONY: ensures target used rather than matching file name
89# https://makefiletutorial.com/#phony
910.PHONY : all clean docs lint pre-commit-check test
11+ # -- Makefile Variables ---------------- #
1012
11- # ------- Makefile Variables --------- #
13+ # -- Makefile Variables ------- --------- #
1214# run help if no target specified
1315.DEFAULT_GOAL := help
1416SHELL := /usr/bin/zsh
1517
1618# Column the target description is printed from
1719HELP-DESCRIPTION-SPACING := 24
1820
19- # Tool Commands
20- MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" -- remove-container
21+ # Tool variables
22+ MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
2123MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
24+ OUTDATED_FILE := outdated-$(shell date +% y-% m-% d-% T) .md
25+ # -------------------------------------- #
26+
27+ # -- Help ------------------------------ #
28+ # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
29+
30+ help : # # Describe available tasks in Makefile
31+ @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
32+ sort | \
33+ awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
34+ # -------------------------------------- #
2235
23- # Makefile file and directory name wildcard
24- EDN-FILES := $(wildcard * .edn)
25- # ------------------------------------ #
2636
27- # ------ Quality Checks ------------ #
37+ # ------ Quality Checks -------------- #
2838pre-commit-check : lint
2939
3040lint : # # Run MegaLinter with custom configuration (node.js required)
@@ -42,31 +52,50 @@ lint-clean: ## Clean MegaLinter report information
4252megalinter-upgrade : # # Upgrade MegaLinter config to latest version
4353 $(info --------- MegaLinter Upgrade Config ---------)
4454 npx mega-linter-runner@latest --upgrade
45- # ------------------------------------ #
4655
47- # --- Documentation Generation ------ #
48- python-venv : # # Enable Python Virtual Environment for MkDocs
49- $(info --------- Mkdocs Local Server ---------)
56+ dependencies-outdated : # # Report new versions of library dependencies and GitHub action
57+ $(info -- Search for outdated libraries ---------)
58+ - clojure -T:search/outdated > $(OUTDATED_FILE )
59+
60+ dependencies-update : # # Update all library dependencies and GitHub action
61+ $(info -- Search for outdated libraries ---------)
62+ - clojure -T:update/dependency-versions > $(OUTDATED_FILE )
63+ # -------------------------------------- #
64+
65+ # ------- Version Control -------------- #
66+ git-sr : # # status list of git repos under current directory
67+ $(info -- Multiple Git Repo Status --------------)
68+ mgitstatus -e --flatten
69+
70+ git-status : # # status details of git repos under current directory
71+ $(info -- Multiple Git Status -------------------)
72+ mgitstatus
73+ # -------------------------------------- #
74+
75+ # --- Documentation Generation -------- #
76+
77+ python-venv : # # Create Python Virtual Environment
78+ $(info -- Create Python Virtual Environment -----)
79+ python3 -m venv ~ /.local/venv
80+
81+ python-venv-activate : # # Active Python Virtual Environment
82+ $(info -- Mkdocs Local Server -------------------)
5083 source ~ /.local/venv/bin/activate
5184
85+ mkdocs-install :
86+ $(info -- Install Material for MkDocs -----------)
87+ source ~ /.local/venv/bin/activate; pip install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects mkdocs-rss-plugin pillow cairosvg --upgrade
88+
5289docs : # # Build and run mkdocs in local server (python venv)
53- $(info --------- Mkdocs Local Server ---------)
90+ $(info -- MkDocs Local Server ---------- ---------)
5491 source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER )
5592
5693docs-changed : # # Build only changed files and run mkdocs in local server (python venv)
57- $(info --------- Mkdocs Local Server ---------)
94+ $(info -- Mkdocs Local Server ---------- ---------)
5895 source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER ) --dirtyreload
5996
6097docs-build : # # Build mkdocs (python venv)
61- $(info --------- Mkdocs Local Server ---------)
98+ $(info -- Mkdocs Local Server ---------- ---------)
6299 source ~ /.local/venv/bin/activate && mkdocs build
63- # ------------------------------------ #
64-
65- # ------------ Help ------------------ #
66- # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
100+ # -------------------------------------- #
67101
68- help : # # Describe available tasks in Makefile
69- @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
70- sort | \
71- awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
72- # ------------------------------------ #
0 commit comments