Source

hgopenurl / Makefile

Full commit
# If you want to change PREFIX, do not just edit it below. The changed
# value wont get passed on to recursive make calls. You should instead
# override the variable on the command like:
#
# % make PREFIX=/opt/ install

PREFIX=/usr/local
PYTHON=python

TESTS=tests/*.t

help:
	@echo 'Commonly used make targets:'
	@echo '  all          - build program and documentation'
	@echo '  install      - install program and man pages to PREFIX ($(PREFIX))'
	@echo '  install-home - install with setup.py install --home=HOME ($(HOME))'
	@echo '  tests        - run all tests in the automatic test suite'
	@echo '  test-foo     - run only specified tests (e.g. test-merge1)'
	@echo '  dist         - run all tests and create a source tarball in dist/'
	@echo '  clean        - remove files created by other targets'
	@echo '                 (except installed files or dist source tarball)'
	@echo
	@echo 'Example for a system-wide installation under /usr/local:'
	@echo '  make all && su -c "make install" && hg version'

all: build

build: tests
	$(PYTHON) setup.py build

clean:
	-$(PYTHON) setup.py clean --all # ignore errors from this command
	find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
	rm -f MANIFEST hgopenurl/__version__.py tests/*.err
	rm -rf build

install: build
	$(PYTHON) setup.py install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force

install-home: build
	$(PYTHON) setup.py install --home="$(HOME)" --force

MANIFEST:
	hg manifest > MANIFEST
	echo hgopenurl/__version__.py >> MANIFEST

dist:	tests dist-notests

dist-notests: MANIFEST
	TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" \
	  $(PYTHON) setup.py -q sdist

check tests:
	$(PYTHON) tests/cram/cram.py $(TESTFLAGS) $(TESTS)

test-%:
	$(PYTHON) tests/cram/cram.py $(TESTFLAGS) $@

.PHONY: help all build clean install install-home dist dist-notests tests