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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/base_2020.html --reformat --quiet --format-js --format-css
  26. .PHONY: build
  27. build: ## Generate the site
  28. @python site.py pages tags feed home
  29. .PHONY: publish
  30. publish: ## Make heavy actions
  31. @python site.py search blogroll
  32. .PHONY: blogroll
  33. blogroll: ## Generate the blogroll
  34. @python site.py blogroll
  35. .PHONY: live
  36. live: ## Rebuild contents on file change.
  37. @echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
  38. ls david/2023/_sources/* | entr -r make build
  39. .PHONY: toot
  40. toot: ## Pre-write the Mastodon message.
  41. @python site.py toot
  42. .PHONY: help
  43. help:
  44. @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
  45. # See https://daniel.feldroy.com/posts/autodocumenting-makefiles
  46. define PRINT_HELP_PYSCRIPT # start of Python section
  47. import re, sys
  48. output = []
  49. # Loop through the lines in this file
  50. for line in sys.stdin:
  51. # if the line has a command and a comment start with
  52. # two pound signs, add it to the output
  53. match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
  54. if match:
  55. target, help = match.groups()
  56. output.append("\033[36m%-10s\033[0m %s" % (target, help))
  57. # Sort the output in alphanumeric order
  58. output.sort()
  59. # Print the help result
  60. print('\n'.join(output))
  61. endef
  62. export PRINT_HELP_PYSCRIPT # End of python section