about summary refs log tree commit diff stats
path: root/Makefile
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-06-18 16:04:43 +0200
committerhut <hut@lavabit.com>2010-06-18 16:04:43 +0200
commit582f3519f70332f88fea0055cdd1b2291e029a2e (patch)
tree2f66aec84da65f9f592ab09e0f2dae717e61a36c /Makefile
parent636d93936d26fccdf6fe530568db1b4c41c3f2bf (diff)
downloadranger-582f3519f70332f88fea0055cdd1b2291e029a2e.tar.gz
Rewrote INSTALL and "make (un)install"
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index fc5b1cf8..2f2417de 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,11 @@
 NAME = ranger
 VERSION = $(shell cat README | grep -m 1 -o '[0-9][0-9.]\+')
 SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz
-PYTHON ?= python
+# Find suitable python version (need python >= 2.6 or 3.1):
+PYTHON ?= $(shell python -c 'import sys; sys.exit(sys.version < "2.6")' && \
+	which python || which python3.1 || which python3 || which python2.6)
 DOCDIR ?= doc/pydoc
+DESTDIR ?= /
 PYOPTIMIZE ?= 1
 BMCOUNT ?= 5  # how often to run the benchmarks?
 
@@ -40,6 +43,13 @@ help:
 	@echo 'make snapshot: Create a tar.gz of the current git revision'
 	@echo 'make test: Run all unittests.'
 
+install:
+	$(PYTHON) setup.py install --record=uninstall_info \
+		'--root=$(DESTDIR)' --optimize=$(PYOPTIMIZE)
+
+uninstall:
+	cd $(DESTDIR) && cat $(CWD)/uninstall_info | xargs -d "\n" rm --
+
 compile: clean
 	PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger
 
@@ -66,4 +76,4 @@ bm:
 snapshot:
 	git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME)
 
-.PHONY: default options compile clean doc cleandoc test bm snapshot
+.PHONY: default options compile clean doc cleandoc test bm snapshot install uninstall