prefix ?= $(HOME)
bindir ?= $(prefix)/bin
datarootdir ?= $(prefix)/share
+sysconfdir ?= $(prefix)/etc
docdir ?= $(datarootdir)/doc
mandir ?= $(datarootdir)/man
# DESTDIR=
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
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
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" ;; \
+ esac; \
+ $(RM) "$$doc+"; \
done
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-doc: install-doc-man install-doc-html
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
release-doc:
git checkout release && \
git merge master && \
- $(MAKE) distclean doc-man doc-html && \
+ $(MAKE) distclean doc-man doc-html sysconfdir=++SYSCONFDIR++ && \
git add -f $(MANDOC) $(HTMLDOC) && \
git commit -m "Sync docs" && \
git checkout master
*) ref="$$ref, $$line" ;; \
esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
-README.html: README
+README.html: README asciidoc.conf
$(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $<
-%.pdf : %.xml
- $(DOCBOOK2PDF) $<
-
-%.1.html : %.1.txt
+%.1.html : %.1.txt asciidoc.conf
$(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d manpage $<
-%.1.xml : %.1.txt
- $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage -aversion=$(VERSION) $<
+%.1.xml : %.1.txt asciidoc.conf
+ $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b docbook -d manpage $<
-%.1 : %.1.xml
- $(XMLTO) man $<
-
-%.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 : %.5.xml
- $(XMLTO) man $<
+%.5.xml : %.5.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) $<