mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-05 20:51:49 +02:00
Add .PHONY instructions to the Makefile
`.PHONY` instructs Make to not look, for instance, for an `install` file before executing the corresponding target. If such a file would exist, the command would not be performed at all. This is because Make is initially intended to create files (i.e. targets) and consider there is nothing to do if the file already exists. More information on https://stackoverflow.com/a/2145605.
This commit is contained in:
parent
da54ca97aa
commit
d99cbb5133
1 changed files with 15 additions and 0 deletions
15
Makefile
15
Makefile
|
@ -7,56 +7,71 @@ 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)
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
all: install ## Alias for install
|
all: install ## Alias for install
|
||||||
|
.PHONY: install
|
||||||
install: virtualenv $(INSTALL_STAMP) ## Install dependencies
|
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
|
||||||
touch $(INSTALL_STAMP)
|
touch $(INSTALL_STAMP)
|
||||||
|
|
||||||
|
.PHONY: virtualenv
|
||||||
virtualenv: $(PYTHON)
|
virtualenv: $(PYTHON)
|
||||||
$(PYTHON):
|
$(PYTHON):
|
||||||
$(VIRTUALENV) $(VENV)
|
$(VIRTUALENV) $(VENV)
|
||||||
|
|
||||||
|
.PHONY: install-dev
|
||||||
install-dev: $(INSTALL_STAMP) $(DEV_STAMP) ## Install development dependencies
|
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)
|
||||||
|
|
||||||
|
.PHONY: remove-install-stamp
|
||||||
remove-install-stamp:
|
remove-install-stamp:
|
||||||
rm $(INSTALL_STAMP)
|
rm $(INSTALL_STAMP)
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
update: remove-install-stamp install ## Update the dependencies
|
update: remove-install-stamp install ## Update the dependencies
|
||||||
|
|
||||||
|
.PHONY: serve
|
||||||
serve: install ## Run the ihatemoney server
|
serve: install ## Run the ihatemoney server
|
||||||
@echo 'Running ihatemoney on http://localhost:5000'
|
@echo 'Running ihatemoney on http://localhost:5000'
|
||||||
$(PYTHON) -m ihatemoney.manage runserver
|
$(PYTHON) -m ihatemoney.manage runserver
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
test: $(DEV_STAMP) ## Run the tests
|
test: $(DEV_STAMP) ## Run the tests
|
||||||
$(VENV)/bin/tox
|
$(VENV)/bin/tox
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
release: $(DEV_STAMP) ## Release a new version (see https://ihatemoney.readthedocs.io/en/latest/contributing.html#how-to-release)
|
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
|
||||||
|
|
||||||
|
.PHONY: build-translations
|
||||||
build-translations: ## Build the translations
|
build-translations: ## Build the translations
|
||||||
$(VENV)/bin/pybabel compile -d ihatemoney/translations
|
$(VENV)/bin/pybabel compile -d ihatemoney/translations
|
||||||
|
|
||||||
|
.PHONY: update-translations
|
||||||
update-translations: ## Extract new translations from source code
|
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/
|
||||||
|
|
||||||
|
.PHONY: create-database-revision
|
||||||
create-database-revision: ## Create a new 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}"
|
||||||
|
|
||||||
|
.PHONY: build-requirements
|
||||||
build-requirements: ## Save currently installed packages to requirements.txt
|
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
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
clean: ## Destroy the virtual environment
|
clean: ## Destroy the virtual environment
|
||||||
rm -rf .venv
|
rm -rf .venv
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
help: ## Show the help indications
|
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}'
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
Loading…
Reference in a new issue