# By default, run the tests.
all: test

version:
	python3 setup.py version

build:
	python3 setup.py build_ext --inplace

dist: sdist
sdist:
	python3 setup.py sdist

install:
	python3 setup.py install

develop:
	python3 setup.py develop

ctrl: flake
flake:
	flake8 nilmtools
lint:
	pylint3 --rcfile=setup.cfg nilmtools

test:
ifneq ($(INSIDE_EMACS),)
# Use the slightly more flexible script
	python3 setup.py build_ext --inplace
	python3 tests/runtests.py
else
# Let setup.py check dependencies, build stuff, and run the test
	python3 setup.py nosetests
endif

clean::
	find . -name '*.pyc' -o -name '__pycache__' -print0 | xargs -0 rm -rf
	rm -f .coverage
	rm -rf nilmtools.egg-info/ build/ .eggs

gitclean::
	git clean -dXf

.PHONY: all version dist sdist install test
.PHONY: ctrl lint flake clean gitclean
