123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- .DEFAULT_GOAL := help
-
- include .env
-
- SERVER_OUTPUT = $(TARGET_SERVER_OUTPUT) # user@server.url:/path/to/website
-
- # See https://daniel.feldroy.com/posts/autodocumenting-makefiles
- define PRINT_HELP_PYSCRIPT # start of Python section
- import re, sys
-
- output = []
- # Loop through the lines in this file
- for line in sys.stdin:
- # if the line has a command and a comment start with
- # two pound signs, add it to the output
- match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
- if match:
- target, help = match.groups()
- output.append("\033[36m%-10s\033[0m %s" % (target, help))
- # Sort the output in alphanumeric order
- output.sort()
- # Print the help result
- print('\n'.join(output))
- endef
- export PRINT_HELP_PYSCRIPT # End of python section
-
- .PHONY: install
- install: ## Install the dependencies to build the website
- python -m pip install -r requirements.txt
-
- .PHONY: build
- build: ## Build the website
- python revelateur.py
-
- .PHONY: ulid
- ulid: ## Generate a ULID (useful for passwords)
- @python -c 'from ulid import ULID;print(str(ULID()))'
-
- .PHONY: clean
- clean: ## Clean output files
- rm -rf ./output ./__pycache__
-
- .PHONY: serve
- serve: build ## Serve the website (development)
- cd output && python -m http.server 8080
-
- .PHONY: publish
- publish: build ## Publish the website online (rsync)
- # With rsync 3.1.0 you can use `--info=progress2`
- rsync -P -rzc --stats --cvs-exclude --delete ./output/ $(SERVER_OUTPUT)
-
- .PHONY: help
- help:
- @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|