+ $(RM) -r $(TARNAME) *.spec tig-*.tar.gz tig-*.tar.gz.md5
+ $(RM) $(PROGS) core *.o *.xml
+
+distclean: clean
+ $(RM) -r manual.html-chunked *.toc $(ALLDOC)
+ $(RM) -r autom4te.cache aclocal.m4 config.{h,log,make,status} config.h.in configure
+
+spell-check:
+ aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
+
+strip: $(PROGS)
+ strip $(PROGS)
+
+dist: configure tig.spec
+ @mkdir -p $(TARNAME) && \
+ cp tig.spec configure config.h.in aclocal.m4 $(TARNAME) && \
+ echo $(VERSION) > $(TARNAME)/VERSION
+ git archive --format=tar --prefix=$(TARNAME)/ HEAD | \
+ tar --delete $(TARNAME)/VERSION > $(TARNAME).tar && \
+ tar rf $(TARNAME).tar `find $(TARNAME)/*` && \
+ gzip -f -9 $(TARNAME).tar && \
+ md5sum $(TARNAME).tar.gz > $(TARNAME).tar.gz.md5
+ @$(RM) -r $(TARNAME)
+
+rpm: dist
+ rpmbuild -ta $(TARNAME).tar.gz
+
+configure: configure.ac acinclude.m4
+ $(AUTORECONF) -v
+
+# Maintainer stuff
+release-doc:
+ git checkout release && \
+ git merge master && \
+ $(MAKE) distclean doc-man doc-html sysconfdir=++SYSCONFDIR++ && \
+ git add -f $(MANDOC) $(HTMLDOC) && \
+ git commit -m "Sync docs" && \
+ git checkout master
+
+release-dist: release-doc
+ git checkout release && \
+ $(MAKE) dist && \
+ git checkout master
+
+.PHONY: all all-debug doc doc-man doc-html install install-doc \
+ install-doc-man install-doc-html clean spell-check dist rpm
+
+tig.o: tig.c
+tig: tig.o
+
+tig.spec: contrib/tig.spec.in
+ sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \
+ -e 's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@
+
+manual.html: manual.toc
+manual.toc: manual.txt
+ sed -n '/^\[\[/,/\(---\|~~~\)/p' < $< | while read line; do \
+ case "$$line" in \
+ "-----"*) echo ". <<$$ref>>"; ref= ;; \
+ "~~~~~"*) echo "- <<$$ref>>"; ref= ;; \
+ "[["*"]]") ref="$$line" ;; \
+ *) ref="$$ref, $$line" ;; \
+ esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
+
+README.html: README asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $<
+
+%.1.html : %.1.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $<
+
+%.1.xml : %.1.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $<
+
+%.5.html : %.5.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $<
+
+%.5.xml : %.5.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $<
+
+%.html : %.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -n $<
+
+%.xml : %.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d article $<
+
+% : %.xml
+ $(XMLTO) man $<
+
+%.html-chunked : %.xml
+ $(XMLTO) html -o $@ $<