Add timestamp offset for block header
[p2pool.git] / Makefile
1 # === makefile ------------------------------------------------------------===
2
3 ROOT=$(shell pwd)
4 CACHE_ROOT=${ROOT}/.cache
5 PKG_ROOT=${ROOT}/.pkg
6
7 -include Makefile.local
8
9 .PHONY: all
10 all: ${PKG_ROOT}/.stamp-h
11
12 .PHONY: check
13 check: all
14         "${PKG_ROOT}"/bin/coverage run "${PKG_ROOT}"/bin/trial p2pool
15         "${PKG_ROOT}"/bin/coverage xml -o build/report/coverage.xml
16
17 .PHONY: run
18 run: all
19         "${PKG_ROOT}"/bin/python run_p2pool.py
20
21 .PHONY: shell
22 shell: all
23         "${PKG_ROOT}"/bin/ipython
24
25 .PHONY: mostlyclean
26 mostlyclean:
27         -rm -rf build
28         -rm -rf .coverage
29
30 .PHONY: clean
31 clean: mostlyclean
32         -rm -rf "${PKG_ROOT}"
33
34 .PHONY: distclean
35 distclean: clean
36         -rm -rf "${CACHE_ROOT}"
37
38 .PHONY: maintainer-clean
39 maintainer-clean: distclean
40         @echo 'This command is intended for maintainers to use; it'
41         @echo 'deletes files that may need special tools to rebuild.'
42
43 .PHONY: dist
44 dist:
45
46 # ===--------------------------------------------------------------------===
47
48 ${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz:
49         mkdir -p ${CACHE_ROOT}/virtualenv
50         sh -c "cd ${CACHE_ROOT}/virtualenv && curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz"
51
52 ${PKG_ROOT}/.stamp-h: conf/requirements*.pip ${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz
53         # Because build and run-time dependencies are not thoroughly tracked,
54         # it is entirely possible that rebuilding the development environment
55         # on top of an existing one could result in a broken build. For the
56         # sake of consistency and preventing unnecessary, difficult-to-debug
57         # problems, the entire development environment is rebuilt from scratch
58         # everytime this make target is selected.
59         ${MAKE} clean
60         
61         # The ``${PKG_ROOT}`` directory, if it exists, is removed by the
62         # ``clean`` target. The PyPI cache is nonexistant if this is a freshly
63         # checked-out repository, or if the ``distclean`` target has been run.
64         # This might cause problems with build scripts executed later which
65         # assume their existence, so they are created now if they don't
66         # already exist.
67         mkdir -p "${PKG_ROOT}"
68         mkdir -p "${CACHE_ROOT}"/pypi
69         
70         # ``virtualenv`` is used to create a separate Python installation for
71         # this project in ``${PKG_ROOT}``.
72         tar \
73           -C "${CACHE_ROOT}"/virtualenv --gzip \
74           -xf "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1.tar.gz
75         python "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1/virtualenv.py \
76           --clear \
77           --distribute \
78           --never-download \
79           --prompt="(p2pool) " \
80           "${PKG_ROOT}"
81         -rm -rf "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1
82         
83         # readline is installed here to get around a bug on Mac OS X which is
84         # causing readline to not build properly if installed from pip.
85         "${PKG_ROOT}"/bin/easy_install readline
86         
87         # pip is used to install Python dependencies for this project.
88         for reqfile in conf/requirements*.pip; do \
89           "${PKG_ROOT}"/bin/python "${PKG_ROOT}"/bin/pip install \
90             --download-cache="${CACHE_ROOT}"/pypi \
91             -r $$reqfile; \
92         done
93         
94         # All done!
95         touch "${PKG_ROOT}"/.stamp-h
96
97 # ===--------------------------------------------------------------------===
98 # End of File
99 # ===--------------------------------------------------------------------===