diff options
-rw-r--r-- | Makefile | 55 |
1 files changed, 4 insertions, 51 deletions
diff --git a/Makefile b/Makefile index 047f4e26..fc5b1cf8 100644 --- a/Makefile +++ b/Makefile @@ -15,17 +15,10 @@ 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 DOCDIR ?= doc/pydoc -PREFIX ?= /usr -MANPREFIX ?= /share/man PYOPTIMIZE ?= 1 -# this finds the shortest item in sys.path that contains "site" or "dist" -# for example: /usr/lib/python2.6/site-packages -PYTHON_SITE_DEST ?= $(shell $(PYTHON) -c 'import sys; \ - dests = sorted([p for p in sys.path if "site" in p or "dist" in p], \ - key=lambda dest: len(dest)); \ - sys.stdout.write(dests[0])' 2> /dev/null) BMCOUNT ?= 5 # how often to run the benchmarks? CWD = $(shell pwd) @@ -38,69 +31,30 @@ options: help @echo 'Options:' @echo 'PYTHON = $(PYTHON)' @echo 'PYOPTIMIZE = $(PYOPTIMIZE)' - @echo 'PYTHON_SITE_DEST = $(PYTHON_SITE_DEST)' - @echo 'PREFIX = $(PREFIX)' - @echo 'MANPREFIX = $(MANPREFIX)' @echo 'DOCDIR = $(DOCDIR)' help: - @echo 'make: Compile $(NAME)' @echo 'make doc: Create the pydoc documentation' - @echo 'make install: Install ranger' @echo 'make clean: Remove the compiled files (*.pyc, *.pyo)' @echo 'make cleandoc: Remove the pydoc documentation' - @echo 'make uninstall: Uninstall ranger' @echo 'make snapshot: Create a tar.gz of the current git revision' @echo 'make test: Run all unittests.' -all: test compile install - -install: - @if [ '$(PYTHON_SITE_DEST)' == '' ]; then \ - echo -n 'Cannot find a suitable destination for the files.'; \ - echo ' Please install $(NAME) manually.'; \ - false; \ - fi - @echo "Installing $(NAME) version $(VERSION)..." - @mkdir -p $(DESTDIR)$(PREFIX)/bin - cp -f ranger.py $(DESTDIR)$(PREFIX)/bin/ranger - @mkdir -p $(DESTDIR)$(PYTHON_SITE_DEST) - cp -fruT ranger $(DESTDIR)$(PYTHON_SITE_DEST)/ranger - @chmod 755 $(DESTDIR)$(PREFIX)/bin/ranger - @chmod -R +rX $(DESTDIR)$(PYTHON_SITE_DEST)/ranger - @mkdir -p $(DESTDIR)$(PREFIX)$(MANPREFIX)/man1 - cp -f doc/ranger.1 $(DESTDIR)$(PREFIX)$(MANPREFIX)/man1/ranger.1 - @chmod 644 $(DESTDIR)$(PREFIX)$(MANPREFIX)/man1/ranger.1 - -uninstall: - rm -f $(PREFIX)/bin/ranger - rm -f '$(PREFIX)$(MANPREFIX)/man1/ranger.1' - @if [ '$(PYTHON_SITE_DEST)' == '' ]; then \ - echo 'Cannot find a possible location of rangers library files'; \ - false; \ - fi - rm -rf '$(PYTHON_SITE_DEST)/ranger/*' - @echo 'NOTE: By default, configuration files are stored at "~/.ranger".' - @echo 'This script will not delete those.' - compile: clean - @echo 'Compiling...' PYTHONOPTIMIZE=$(PYOPTIMIZE) $(PYTHON) -m compileall -q ranger clean: - @echo 'Cleaning...' find . -regex .\*.py[co]\$$ -exec rm -f -- {} \; doc: cleandoc - @echo 'Creating pydoc html documentation...' mkdir -p $(DOCDIR) cd $(DOCDIR); \ $(PYTHON) -c 'import pydoc, sys; \ sys.path[0] = "$(CWD)"; \ pydoc.writedocs("$(CWD)")' + rm $(DOCDIR)/test* cleandoc: - @echo 'Removing pydoc html documentation...' test -d $(DOCDIR) && rm -f -- $(DOCDIR)/*.html test: @@ -110,7 +64,6 @@ bm: @$(PYTHON) test/all_benchmarks.py $(BMCOUNT) snapshot: - git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz + git archive --prefix='$(NAME)-$(VERSION)/' --format=tar HEAD | gzip > $(SNAPSHOT_NAME) -.PHONY: default options all compile clean doc cleandoc test bm \ - install uninstall snapshot +.PHONY: default options compile clean doc cleandoc test bm snapshot |