defaults/options: default sorting method is now "natural"
[ranger.git] / Makefile
blob5d8ba2f9e95af5855a0132a70cd76c1739affe43
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/>.
16 NAME = ranger
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 || \
22 which python2.6)
23 SETUPOPTS ?= '--record=install_log.txt'
24 DOCDIR ?= doc/pydoc
25 DESTDIR ?= /
26 PYOPTIMIZE ?= 1
28 CWD = $(shell pwd)
30 default: compile
31 @echo 'Run `make options` for a list of all options'
33 options: help
34 @echo
35 @echo 'Options:'
36 @echo 'PYTHON = $(PYTHON)'
37 @echo 'PYOPTIMIZE = $(PYOPTIMIZE)'
38 @echo 'DOCDIR = $(DOCDIR)'
40 help:
41 @echo 'make install: Install $(NAME)'
42 @echo 'make clean: Remove the compiled files (*.pyc, *.pyo)'
43 @echo 'make doc: Create the pydoc documentation'
44 @echo 'make cleandoc: Remove the pydoc documentation'
45 @echo 'make man: Compile the manpage with "pod2man"'
46 @echo 'make manhtml: Compile the html manpage with "pod2html"'
47 @echo 'make snapshot: Create a tar.gz of the current git revision'
48 @echo 'make todo: Look for TODO and XXX markers in the source code'
50 install:
51 $(PYTHON) setup.py install $(SETUPOPTS) \
52 '--root=$(DESTDIR)' --optimize=$(PYOPTIMIZE)
54 compile: clean
55 PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger
57 clean:
58 find ranger -regex .\*.py[co]\$$ -delete
59 find ranger -depth -name __pycache__ -type d -exec rm -rf -- {} \;
61 doc: cleandoc
62 mkdir -p $(DOCDIR)
63 cd $(DOCDIR); \
64 $(PYTHON) -c 'import pydoc, sys; \
65 sys.path[0] = "$(CWD)"; \
66 pydoc.writedocs("$(CWD)")'
67 find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \;
69 man:
70 pod2man --stderr --center='ranger manual' --date='$(NAME)-$(VERSION)' \
71 --release=$(shell date +%x) doc/ranger.pod doc/ranger.1
73 manhtml:
74 pod2html doc/ranger.pod --outfile=doc/ranger.1.html
76 cleandoc:
77 test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html || true
79 snapshot:
80 git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME)
82 todo:
83 @grep --color -Ion '\(TODO\|XXX\).*' -r ranger
85 .PHONY: default options compile clean doc cleandoc snapshot install man todo