- rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
- rm -f $(CGIT_SCRIPT_PATH)/cgit.css
- rm -rf $(CACHE_ROOT)
-
-clean:
- rm -f cgit VERSION *.o
- cd git && $(MAKE) clean
-
-distclean: clean
- git clean -d -x
- cd git && git clean -d -x
+ rm -f $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
+ rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
+ rm -f $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
+ rm -f $(DESTDIR)$(CGIT_DATA_PATH)/favicon.ico
+
+uninstall-doc: uninstall-man uninstall-html uninstall-pdf
+
+uninstall-man:
+ @for i in $(DOC_MAN5); do \
+ rm -fv $(DESTDIR)$(mandir)/man5/$$i; \
+ done
+
+uninstall-html:
+ @for i in $(DOC_HTML); do \
+ rm -fv $(DESTDIR)$(htmldir)/$$i; \
+ done
+
+uninstall-pdf:
+ @for i in $(DOC_PDF); do \
+ rm -fv $(DESTDIR)$(pdfdir)/$$i; \
+ done
+
+doc: doc-man doc-html doc-pdf
+doc-man: doc-man5
+doc-man5: $(DOC_MAN5)
+doc-html: $(DOC_HTML)
+doc-pdf: $(DOC_PDF)
+
+%.5 : %.5.txt
+ a2x -f manpage $<
+
+$(DOC_HTML): %.html : %.txt
+ $(TXT_TO_HTML) -o $@+ $< && \
+ mv $@+ $@
+
+$(DOC_PDF): %.pdf : %.txt
+ a2x -f pdf cgitrc.5.txt
+
+clean: clean-doc
+ $(RM) cgit VERSION CGIT-CFLAGS *.o tags
+ $(RM) -r .deps
+
+cleanall: clean
+ $(MAKE) -C git clean
+
+clean-doc:
+ $(RM) cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
+
+get-git:
+ curl -L $(GIT_URL) | tar -xJf - && rm -rf git && mv git-$(GIT_VER) git
+
+tags:
+ $(QUIET_TAGS)find . -name '*.[ch]' | xargs ctags
+
+.PHONY: all cgit git get-git
+.PHONY: clean clean-doc cleanall
+.PHONY: doc doc-html doc-man doc-pdf
+.PHONY: install install-doc install-html install-man install-pdf
+.PHONY: tags test
+.PHONY: uninstall uninstall-doc uninstall-html uninstall-man uninstall-pdf