Add help target to the Makefile

It is often expected to have a `help` target in a Makefile. This one is
automatically generated from comments in the Makefile so it is easier to
maintain.

This commit only documents targets that seem the most important.
This commit is contained in:
Marien Fressinaud 2018-08-30 21:31:48 +02:00
parent 2eafb7260c
commit be1a1af47a

View file

@ -7,8 +7,8 @@ DOC_STAMP = $(VENV)/.doc_env_installed.stamp
INSTALL_STAMP = $(VENV)/.install.stamp INSTALL_STAMP = $(VENV)/.install.stamp
TEMPDIR := $(shell mktemp -d) TEMPDIR := $(shell mktemp -d)
all: install all: install ## Alias for install
install: virtualenv $(INSTALL_STAMP) install: virtualenv $(INSTALL_STAMP) ## Install dependencies
$(INSTALL_STAMP): $(INSTALL_STAMP):
$(VENV)/bin/pip install -U pip $(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -r requirements.txt $(VENV)/bin/pip install -r requirements.txt
@ -18,7 +18,7 @@ virtualenv: $(PYTHON)
$(PYTHON): $(PYTHON):
$(VIRTUALENV) $(VENV) $(VIRTUALENV) $(VENV)
install-dev: $(INSTALL_STAMP) $(DEV_STAMP) install-dev: $(INSTALL_STAMP) $(DEV_STAMP) ## Install development dependencies
$(DEV_STAMP): $(PYTHON) dev-requirements.txt $(DEV_STAMP): $(PYTHON) dev-requirements.txt
$(VENV)/bin/pip install -Ur dev-requirements.txt $(VENV)/bin/pip install -Ur dev-requirements.txt
touch $(DEV_STAMP) touch $(DEV_STAMP)
@ -26,33 +26,36 @@ $(DEV_STAMP): $(PYTHON) dev-requirements.txt
remove-install-stamp: remove-install-stamp:
rm $(INSTALL_STAMP) rm $(INSTALL_STAMP)
update: remove-install-stamp install update: remove-install-stamp install ## Update the dependencies
serve: install serve: install ## Run the ihatemoney server
$(PYTHON) -m ihatemoney.manage runserver $(PYTHON) -m ihatemoney.manage runserver
test: $(DEV_STAMP) test: $(DEV_STAMP) ## Run the tests
$(VENV)/bin/tox $(VENV)/bin/tox
release: $(DEV_STAMP) release: $(DEV_STAMP) ## Release a new version (see https://ihatemoney.readthedocs.io/en/latest/contributing.html#how-to-release)
$(VENV)/bin/fullrelease $(VENV)/bin/fullrelease
build-translations: build-translations: ## Build the translations
$(VENV)/bin/pybabel compile -d ihatemoney/translations $(VENV)/bin/pybabel compile -d ihatemoney/translations
update-translations: update-translations: ## Extract new translations from source code
$(VENV)/bin/pybabel extract --strip-comments --omit-header --no-location --mapping-file ihatemoney/babel.cfg -o ihatemoney/messages.pot ihatemoney $(VENV)/bin/pybabel extract --strip-comments --omit-header --no-location --mapping-file ihatemoney/babel.cfg -o ihatemoney/messages.pot ihatemoney
$(VENV)/bin/pybabel update -i ihatemoney/messages.pot -d ihatemoney/translations/ $(VENV)/bin/pybabel update -i ihatemoney/messages.pot -d ihatemoney/translations/
create-database-revision: create-database-revision: ## Create a new database revision
@read -p "Please enter a message describing this revision: " rev_message; \ @read -p "Please enter a message describing this revision: " rev_message; \
$(PYTHON) -m ihatemoney.manage db migrate -d ihatemoney/migrations -m "$${rev_message}" $(PYTHON) -m ihatemoney.manage db migrate -d ihatemoney/migrations -m "$${rev_message}"
build-requirements: build-requirements: ## Save currently installed packages to requirements.txt
$(VIRTUALENV) $(TEMPDIR) $(VIRTUALENV) $(TEMPDIR)
$(TEMPDIR)/bin/pip install -U pip $(TEMPDIR)/bin/pip install -U pip
$(TEMPDIR)/bin/pip install -Ue "." $(TEMPDIR)/bin/pip install -Ue "."
$(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt $(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt
clean: clean: ## Destroy the virtual environment
rm -rf .venv rm -rf .venv
help: ## Show the help indications
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'