X-Git-Url: https://git.tokkee.org/?p=tig.git;a=blobdiff_plain;f=Makefile;h=3b211117320d44bddf5e5310255bd0f367b01032;hp=048e97a63e26e326e3cfd31b5bedf5e7c2eef4fb;hb=43fec2264a6cdffc083123ef412d79c95ec44371;hpb=3b0d681fb673dba9402ac3a182e7903b7715712f diff --git a/Makefile b/Makefile index 048e97a..3b21111 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ all: prefix ?= $(HOME) bindir ?= $(prefix)/bin datarootdir ?= $(prefix)/share +sysconfdir ?= $(prefix)/etc docdir ?= $(datarootdir)/doc mandir ?= $(datarootdir)/man # DESTDIR= @@ -33,10 +34,13 @@ RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty) LDLIBS ?= -lcurses CFLAGS ?= -Wall -O2 -DFLAGS = -g -DDEBUG -Werror +DFLAGS = -g -DDEBUG -Werror -O0 PROGS = tig -MANDOC = tig.1 tigrc.5 -HTMLDOC = tig.1.html tigrc.5.html manual.html README.html +TESTS = test-graph +SOURCE = tig.c tig.h io.c io.h graph.c graph.h +TXTDOC = tig.1.txt tigrc.5.txt manual.txt NEWS README INSTALL BUGS TODO +MANDOC = tig.1 tigrc.5 tigmanual.7 +HTMLDOC = tig.1.html tigrc.5.html manual.html README.html NEWS.html ALLDOC = $(MANDOC) $(HTMLDOC) manual.html-chunked manual.pdf # Never include the release number in the tarname for tagged @@ -47,15 +51,17 @@ else TARNAME = tig-$(RPM_VERSION) endif -override CFLAGS += '-DTIG_VERSION="$(VERSION)"' +override CPPFLAGS += '-DTIG_VERSION="$(VERSION)"' +override CPPFLAGS += '-DSYSCONFDIR="$(sysconfdir)"' AUTORECONF ?= autoreconf ASCIIDOC ?= asciidoc +ASCIIDOC_FLAGS = -aversion=$(VERSION) -asysconfdir=$(sysconfdir) XMLTO ?= xmlto DOCBOOK2PDF ?= docbook2pdf -all: $(PROGS) -all-debug: $(PROGS) +all: $(PROGS) $(TESTS) +all-debug: $(PROGS) $(TESTS) all-debug: CFLAGS += $(DFLAGS) doc: $(ALLDOC) doc-man: $(MANDOC) @@ -64,39 +70,62 @@ doc-html: $(HTMLDOC) install: all mkdir -p $(DESTDIR)$(bindir) && \ for prog in $(PROGS); do \ - install -p -m 0755 $$prog $(DESTDIR)$(bindir); \ + install -p -m 0755 "$$prog" "$(DESTDIR)$(bindir)"; \ done install-doc-man: doc-man mkdir -p $(DESTDIR)$(mandir)/man1 \ - $(DESTDIR)$(mandir)/man5 + $(DESTDIR)$(mandir)/man5 \ + $(DESTDIR)$(mandir)/man7 for doc in $(MANDOC); do \ + sed 's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \ case "$$doc" in \ - *.1) install -p -m 0644 $$doc $(DESTDIR)$(mandir)/man1 ;; \ - *.5) install -p -m 0644 $$doc $(DESTDIR)$(mandir)/man5 ;; \ - esac \ + *.1) install -p -m 0644 "$$doc+" "$(DESTDIR)$(mandir)/man1/$$doc" ;; \ + *.5) install -p -m 0644 "$$doc+" "$(DESTDIR)$(mandir)/man5/$$doc" ;; \ + *.7) install -p -m 0644 "$$doc+" "$(DESTDIR)$(mandir)/man7/$$doc" ;; \ + esac; \ + $(RM) "$$doc+"; \ done +install-release-doc-man: + GIT_INDEX_FILE=.tmp-doc-index git read-tree origin/release + GIT_INDEX_FILE=.tmp-doc-index git checkout-index -f --prefix=./ $(MANDOC) + rm -f .tmp-doc-index + $(MAKE) install-doc-man + install-doc-html: doc-html mkdir -p $(DESTDIR)$(docdir)/tig for doc in $(HTMLDOC); do \ + sed 's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \ case "$$doc" in \ - *.html) install -p -m 0644 $$doc $(DESTDIR)$(docdir)/tig ;; \ - esac \ + *.html) install -p -m 0644 "$$doc+" "$(DESTDIR)$(docdir)/tig/$$doc" ;; \ + esac; \ + $(RM) "$$doc+"; \ done +install-release-doc-html: + GIT_INDEX_FILE=.tmp-doc-index git read-tree origin/release + GIT_INDEX_FILE=.tmp-doc-index git checkout-index -f --prefix=./ $(HTMLDOC) + rm -f .tmp-doc-index + $(MAKE) install-doc-html + install-doc: install-doc-man install-doc-html +install-release-doc: install-release-doc-man install-release-doc-html clean: $(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 + $(RM) -r manual.html-chunked autom4te.cache + $(RM) *.toc $(ALLDOC) aclocal.m4 configure + $(RM) config.h config.log config.make config.status config.h.in spell-check: - aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt + for file in $(TXTDOC) tig.c; do \ + aspell --lang=en --dont-backup \ + --personal=./contrib/aspell.dict check $$file; \ + done strip: $(PROGS) strip $(PROGS) @@ -110,33 +139,23 @@ dist: configure tig.spec tar rf $(TARNAME).tar `find $(TARNAME)/*` && \ gzip -f -9 $(TARNAME).tar && \ md5sum $(TARNAME).tar.gz > $(TARNAME).tar.gz.md5 - @rm -rf $(TARNAME) + @$(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 && \ - 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 + $(AUTORECONF) -v -I contrib .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 +io.o: io.c io.h tig.h +graph.o: tig.h +tig.o: tig.c tig.h io.h +tig: tig.o io.o graph.o +test-graph.o: test-graph.c io.h tig.h graph.h +test-graph: io.o graph.o tig.spec: contrib/tig.spec.in sed -e 's/@@VERSION@@/$(RPM_VERSION)/g' \ @@ -152,35 +171,40 @@ manual.toc: manual.txt *) ref="$$ref, $$line" ;; \ esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@ -README.html: README +README.html: README SITES INSTALL asciidoc.conf $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $< -%.pdf : %.xml - $(DOCBOOK2PDF) $< +NEWS.html: NEWS asciidoc.conf + $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article $< -%.1.html : %.1.txt - $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $< +tigmanual.7: manual.txt -%.1.xml : %.1.txt - $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage -aversion=$(VERSION) $< +%.1.html : %.1.txt asciidoc.conf + $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $< -%.1 : %.1.xml - $(XMLTO) -m manpage.xsl man $< +%.1.xml : %.1.txt asciidoc.conf + $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $< -%.5.html : %.5.txt +%.5.html : %.5.txt asciidoc.conf $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $< -%.5.xml : %.5.txt - $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage -aversion=$(VERSION) $< +%.5.xml : %.5.txt asciidoc.conf + $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $< -%.5 : %.5.xml - $(XMLTO) -m manpage.xsl man $< +%.7.xml : %.7.txt asciidoc.conf + $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $< -%.html : %.txt +%.html : %.txt asciidoc.conf $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -n $< -%.xml : %.txt +%.xml : %.txt asciidoc.conf $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d article $< +% : %.xml + $(XMLTO) man $< + %.html-chunked : %.xml $(XMLTO) html -o $@ $< + +%.pdf : %.xml + $(DOCBOOK2PDF) $<