aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 1a5c82171b7e0c908aa3698513dae7cd2b48ce6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (c) 2016 Weitian LI <liweitianux@live.com>
# MIT license
#
# Makefile for "fg21sim"
#
# Credit: http://blog.bottlepy.org/2012/07/16/virtualenv-and-makefiles.html
#

# The name (also the directory) of the virtualenv
VENV ?= venv


default:
	@echo "+-------------------------------------------------------------+"
	@echo "|                 Make Utility for fg21sim                    |"
	@echo "+-------------------------------------------------------------+"
	@echo "Available targets:"
	@echo "  + venv"
	@echo "        create virtualenv '${VENV}' and install the dependencies"
	@echo "  + devbuild"
	@echo "        (build and) install the package to the virtualenv"
	@echo "  + test"
	@echo "        run the tests"
	@echo "  + print-<VARIABLE>"
	@echo "        print the value of variable <VARIABLE>"

# Create virtualenv and install/update the dependencies
venv: ${VENV}/bin/activate
${VENV}/bin/activate: requirements.txt
	test -d ./${VENV} || virtualenv --python=python3 ${VENV}
	./${VENV}/bin/pip3 install -r requirements.txt
	touch ${VENV}/bin/activate

# Install this package to the virtualenv
devbuild: venv
	./${VENV}/bin/python3 setup.py install

# Run the tests
test: devbuild
	./${VENV}/bin/python3 setup.py test


# One liner to get the value of any makefile variable
# Credit: http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html
print-%: ; @echo $*=$($*)