Repository with sources and generator of https://larlet.fr/david/ https://larlet.fr/david/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .DEFAULT_GOAL := help
  2. RED=\033[0;31m
  3. GREEN=\033[0;32m
  4. ORANGE=\033[0;33m
  5. BLUE=\033[0;34m
  6. NC=\033[0m # No Color
  7. .PHONY: install
  8. install: ## Install the dependencies
  9. @echo "${GREEN}🤖 Installing dependencies${NC}"
  10. python3 -m pip install --upgrade pip
  11. python3 -m pip install --editable .
  12. .PHONY: dev
  13. dev: install ## Install the development dependencies
  14. python3 -m pip install --editable ".[dev]"
  15. .PHONY: deps
  16. deps: ## Generate dependencies from pyproject.toml
  17. @echo "${GREEN}🤖 Updating requirements${NC}"
  18. python3 -m piptools compile --upgrade --quiet --resolver=backtracking --output-file=requirements.txt pyproject.toml
  19. python3 -m piptools compile --upgrade --quiet --resolver=backtracking --extra=dev --output-file=requirements-dev.txt pyproject.toml
  20. .PHONY: lint
  21. lint: ## Ensure code consistency
  22. @echo "${GREEN}🤖 Linting code${NC}"
  23. @ruff site.py --fix
  24. @black . --quiet
  25. @djlint david/templates/article_2020.html \
  26. david/templates/base_2020.html \
  27. david/templates/blogroll.html \
  28. david/templates/profil.html \
  29. david/templates/recherche.html \
  30. david/templates/tag_2021.html \
  31. --reformat --quiet --format-js --format-css
  32. .PHONY: build
  33. build: ## Generate the site
  34. @python site.py pages tags feed home
  35. .PHONY: publish
  36. publish: ## Make heavy actions
  37. @python site.py search blogroll
  38. .PHONY: blogroll
  39. blogroll: ## Generate the blogroll
  40. @python site.py blogroll
  41. .PHONY: live
  42. live: ## Rebuild contents on file change.
  43. @echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
  44. ls david/2024/_sources/* | entr -r make build
  45. .PHONY: live-templates
  46. live-templates: ## Rebuild contents on templates change.
  47. @echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
  48. ls david/templates/* | entr -r make build
  49. .PHONY: toot
  50. toot: ## Pre-write the Mastodon message.
  51. @python site.py toot
  52. .PHONY: help
  53. help:
  54. @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
  55. # See https://daniel.feldroy.com/posts/autodocumenting-makefiles
  56. define PRINT_HELP_PYSCRIPT # start of Python section
  57. import re, sys
  58. output = []
  59. # Loop through the lines in this file
  60. for line in sys.stdin:
  61. # if the line has a command and a comment start with
  62. # two pound signs, add it to the output
  63. match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
  64. if match:
  65. target, help = match.groups()
  66. output.append("\033[36m%-10s\033[0m %s" % (target, help))
  67. # Sort the output in alphanumeric order
  68. output.sort()
  69. # Print the help result
  70. print('\n'.join(output))
  71. endef
  72. export PRINT_HELP_PYSCRIPT # End of python section