Add system-wide configuration file and new config file environment vars
[tig] / Makefile
index 1801bb5..c2d6b60 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,9 +7,10 @@ all:
 
 prefix ?= $(HOME)
 bindir ?= $(prefix)/bin
-mandir ?= $(prefix)/man
 datarootdir ?= $(prefix)/share
+sysconfdir ?= $(prefix)/etc
 docdir ?= $(datarootdir)/doc
+mandir ?= $(datarootdir)/man
 # DESTDIR=
 
 # Get version either via git or from VERSION file. Allow either
@@ -47,10 +48,12 @@ 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
 
@@ -152,35 +155,32 @@ manual.toc: manual.txt
                *)         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) -m manpage.xsl 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) -m manpage.xsl 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) $<