1 # Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com>
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 VERSION
= $(shell grep
-m
1 -o
'[0-9][0-9.]\+' README
)
18 SNAPSHOT_NAME ?
= $(NAME
)-$(VERSION
)-$(shell git rev-parse HEAD | cut
-b
1-8).
tar.gz
19 # Find suitable python version (need python >= 2.6 or 3.1):
20 PYTHON ?
= $(shell python
-c
'import sys; sys.exit(sys.version < "2.6")' && \
21 which python || which python3.2 || which python3.1 || which python3 || \
23 SETUPOPTS ?
= '--record=install_log.txt'
31 @echo
'Run `make options` for a list of all options'
36 @echo
'PYTHON = $(PYTHON)'
37 @echo
'PYOPTIMIZE = $(PYOPTIMIZE)'
38 @echo
'DOCDIR = $(DOCDIR)'
41 @echo
'make: Test and compile ranger.'
42 @echo
'make install: Install $(NAME)'
43 @echo
'make clean: Remove the compiled files (*.pyc, *.pyo)'
44 @echo
'make doc: Create the pydoc documentation'
45 @echo
'make cleandoc: Remove the pydoc documentation'
46 @echo
'make man: Compile the manpage with "pod2man"'
47 @echo
'make manhtml: Compile the html manpage with "pod2html"'
48 @echo
'make snapshot: Create a tar.gz of the current git revision'
49 @echo
'make test: Test all testable modules of ranger'
50 @echo
'make todo: Look for TODO and XXX markers in the source code'
53 $(PYTHON
) setup.py
install $(SETUPOPTS
) \
54 '--root=$(DESTDIR)' --optimize
=$(PYOPTIMIZE
)
57 PYTHONOPTIMIZE
=$(PYOPTIMIZE
) $(PYTHON
) -m compileall
-q ranger
60 find ranger
-regex .\
*.py
[co]\
$$ -delete
61 find ranger
-depth
-name __pycache__
-type d
-exec
rm -rf
-- {} \
;
66 $(PYTHON
) -c
'import pydoc, sys; \
67 sys.path[0] = "$(CWD)"; \
68 pydoc.writedocs("$(CWD)")'
69 find .
-name \
*.html
-exec sed
-i
's|'$(CWD
)'|../..|g' -- {} \
;
72 @for FILE in
$(shell grep
-IHm
1 doctest
-r ranger | cut
-d
: -f1
); do \
73 echo
"Testing $$FILE..."; \
78 pod2man
--stderr
--center
='ranger manual' --date
='$(NAME)-$(VERSION)' \
79 --release
=$(shell date
+%x
) doc
/ranger.pod doc
/ranger
.1
82 pod2html doc
/ranger.pod
--outfile
=doc
/ranger
.1.html
85 test -d
$(DOCDIR
) && rm -f
-- $(DOCDIR
)/*.html || true
88 git archive
--prefix='$(NAME)-$(VERSION)/' --format
=tar HEAD | gzip
> $(SNAPSHOT_NAME
)
91 @grep
--color
-Ion
'\(TODO\|XXX\).*' -r ranger
93 .PHONY
: default options compile
clean doc cleandoc snapshot
install man todo