ihatemoney/Makefile
Toover 41ede04a59 Fix makefile: Python lookup and virtualenv setup (#201)
* Fix Python lookup in the Makefile

* Improve the Makefile

To make sure calling for "make serve"
works straight away, the dependencies are
automatically prepared. A "make clean" has
been added, to test this feature.
2017-04-15 19:33:34 +02:00

42 lines
1 KiB
Makefile

VIRTUALENV = virtualenv --python=python3
SPHINX_BUILDDIR = docs/_build
VENV := $(shell realpath $${VIRTUAL_ENV-.venv})
PYTHON = $(VENV)/bin/python3
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
DOC_STAMP = $(VENV)/.doc_env_installed.stamp
INSTALL_STAMP = $(VENV)/.install.stamp
TEMPDIR := $(shell mktemp -d)
all: install
install: virtualenv $(INSTALL_STAMP)
$(INSTALL_STAMP):
$(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -r requirements.txt
touch $(INSTALL_STAMP)
virtualenv: $(PYTHON)
$(PYTHON):
$(VIRTUALENV) $(VENV)
install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
$(VENV)/bin/pip install -Ur dev-requirements.txt
touch $(DEV_STAMP)
serve: install
cd budget; $(PYTHON) run.py
test: $(DEV_STAMP)
$(VENV)/bin/tox
release: $(DEV_STAMP)
$(VENV)/bin/fullrelease
build-requirements:
$(VIRTUALENV) $(TEMPDIR)
$(TEMPDIR)/bin/pip install -U pip
$(TEMPDIR)/bin/pip install -Ue "."
$(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt
clean:
rm -rf .venv