diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ -# This Makefile is only used by developers. +PREFIX=/usr/local +export PREFIX PYTHON=python all: $(PYTHON) setup.py build_ext -i -install: - @echo "Read the file README for install instructions." +install: all + $(PYTHON) setup.py install --home="$(PREFIX)" + cd doc && $(MAKE) $(MFLAGS) install clean: -$(PYTHON) setup.py clean --all # ignore errors of this command diff --git a/doc/Makefile b/doc/Makefile --- a/doc/Makefile +++ b/doc/Makefile @@ -1,6 +1,9 @@ SOURCES=$(wildcard *.[0-9].txt) MAN=$(SOURCES:%.txt=%) HTML=$(SOURCES:%.txt=%.html) +PREFIX=/usr/local +MANDIR=$(PREFIX)/man +INSTALL=install -c all: man html @@ -23,5 +26,12 @@ hg.1.gendoc.txt: ../mercurial/commands.p %.html: %.txt asciidoc -b html4 $*.txt || asciidoc -b html $*.txt +install: man + for i in $(MAN) ; do \ + subdir=`echo $$i | sed -n 's/.\+\(\.[0-9]\)$$/man\1/p'` ; \ + mkdir -p $(MANDIR)/$$subdir ; \ + $(INSTALL) $$i $(MANDIR)/$$subdir ; \ + done + clean: $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt