.PHONY: help

VENV_NAME?=env
PYTHON=${VENV_NAME}/bin/python3

.DEFAULT: help
help:
	@echo "make env"
	@echo "       create and prepares the environment"
	@echo "make clean"
	@echo "       clean the development environment"
	@echo "make data"
	@echo "       download and unpack the data"
	@echo "make lint"
	@echo "       run pylint and mpy"

data: images
images:
	wget https://s3.us-east-2.amazonaws.com/naturalimages02/images.tar.gz		
	tar -xzf images.tar.gz

env: $(VENV_NAME)/bin/activate images
$(VENV_NAME)/bin/activate:
	test -d $(VENV_NAME) || python3 -m venv $(VENV_NAME) 
	${PYTHON} -m pip install -U pip
	${PYTHON} -m pip install --upgrade tensorflow
	${PYTHON} -m pip install keras
	${PYTHON} -m pip install matplotlib
	${PYTHON} -m pip install keras_vggface
	${PYTHON} -m pip install pylint
	${PYTHON} -m pip install mypy
	touch $(VENV_NAME)/bin/activate

lint:
	${PYTHON} -m pylint --ignored-modules=tensorflow.keras linear_regression.py

clean:
	rm -rf $(VENV_NAME)
	rm -rf images
	rm -f images.tar.gz
	rm -f fine_tune.h5
	rm -rf .mypy_cache