Add autoconf-based build infrastructure for tig
[tig] / Makefile
index ba42a90..ff62390 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,13 @@
-prefix = $(HOME)
-bindir = $(prefix)/bin
-mandir = $(prefix)/man
-docdir = $(prefix)/share/doc
+## Makefile for tig
+
+# 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
@@ -24,7 +30,7 @@ RPM_VERSION = $(word 1,$(RPM_VERLIST))
 RPM_RELEASE = $(word 2,$(RPM_VERLIST))$(if $(WTDIRTY),.dirty)
 
 LDLIBS = -lcurses
-CFLAGS = -Wall -O2
+CFLAGS ?= -Wall -O2
 DFLAGS = -g -DDEBUG -Werror
 PROGS  = tig
 MANDOC = tig.1 tigrc.5
@@ -34,6 +40,9 @@ TARNAME       = tig-$(RPM_VERSION)-$(RPM_RELEASE)
 
 override CFLAGS += '-DVERSION="$(VERSION)"'
 
+AUTOHEADER ?= autoheader
+AUTOCONF ?= autoconf
+
 all: $(PROGS)
 all-debug: $(PROGS)
 all-debug: CFLAGS += $(DFLAGS)
@@ -92,6 +101,10 @@ dist: tig.spec
 rpm: dist
        rpmbuild -ta $(TARNAME).tar.gz
 
+configure: configure.ac
+       $(AUTOHEADER)
+       $(AUTOCONF)
+
 # Maintainer stuff
 release-doc:
        git checkout release && \