Change last commit to make tig depend on config.h
[tig] / Makefile
index ba42a90..0ff9e5d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,15 @@
-prefix = $(HOME)
-bindir = $(prefix)/bin
-mandir = $(prefix)/man
-docdir = $(prefix)/share/doc
+## Makefile for tig
+
+all:
+
+# Include setting from the configure script
+-include config.make
+
+prefix ?= $(HOME)
+bindir ?= $(prefix)/bin
+mandir ?= $(prefix)/man
+datarootdir ?= $(prefix)/share
+docdir ?= $(datarootdir)/doc
 # DESTDIR=
 
 # Get version either via git or from VERSION file. Allow either
@@ -23,8 +31,8 @@ RPM_VERLIST = $(filter-out g% dirty,$(subst -, ,$(VERSION))) 0
 RPM_VERSION = $(word 1,$(RPM_VERLIST))
 RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)
 
-LDLIBS = -lcurses
-CFLAGS = -Wall -O2
+LDLIBS ?= -lcurses
+CFLAGS ?= -Wall -O2
 DFLAGS = -g -DDEBUG -Werror
 PROGS  = tig
 MANDOC = tig.1 tigrc.5
@@ -34,6 +42,12 @@ TARNAME      = tig-$(RPM_VERSION)-$(RPM_RELEASE)
 
 override CFLAGS += '-DVERSION="$(VERSION)"'
 
+AUTOHEADER ?= autoheader
+AUTOCONF ?= autoconf
+ASCIIDOC ?= asciidoc
+XMLTO ?= xmlto
+DOCBOOK2PDF ?= docbook2pdf
+
 all: $(PROGS)
 all-debug: $(PROGS)
 all-debug: CFLAGS += $(DFLAGS)
@@ -92,6 +106,10 @@ dist: tig.spec
 rpm: dist
        rpmbuild -ta $(TARNAME).tar.gz
 
+configure: configure.ac
+       $(AUTOHEADER)
+       $(AUTOCONF)
+
 # Maintainer stuff
 release-doc:
        git checkout release && \
@@ -126,34 +144,34 @@ manual.toc: manual.txt
                esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
 
 README.html: README
-       asciidoc -b xhtml11 -d article -a readme $<
+       $(ASCIIDOC) -b xhtml11 -d article -a readme $<
 
 %.pdf : %.xml
-       docbook2pdf $<
+       $(DOCBOOK2PDF) $<
 
 %.1.html : %.1.txt
-       asciidoc -b xhtml11 -d manpage $<
+       $(ASCIIDOC) -b xhtml11 -d manpage $<
 
 %.1.xml : %.1.txt
-       asciidoc -b docbook -d manpage -aversion=$(VERSION) $<
+       $(ASCIIDOC) -b docbook -d manpage -aversion=$(VERSION) $<
 
 %.1 : %.1.xml
-       xmlto -m manpage.xsl man $<
+       $(XMLTO) -m manpage.xsl man $<
 
 %.5.html : %.5.txt
-       asciidoc -b xhtml11 -d manpage $<
+       $(ASCIIDOC) -b xhtml11 -d manpage $<
 
 %.5.xml : %.5.txt
-       asciidoc -b docbook -d manpage -aversion=$(VERSION) $<
+       $(ASCIIDOC) -b docbook -d manpage -aversion=$(VERSION) $<
 
 %.5 : %.5.xml
-       xmlto -m manpage.xsl man $<
+       $(XMLTO) -m manpage.xsl man $<
 
 %.html : %.txt
-       asciidoc -b xhtml11 -d article -n $<
+       $(ASCIIDOC) -b xhtml11 -d article -n $<
 
 %.xml : %.txt
-       asciidoc -b docbook -d article $<
+       $(ASCIIDOC) -b docbook -d article $<
 
 %.html-chunked : %.xml
-       xmlto html -o $@ $<
+       $(XMLTO) html -o $@ $<