From 22ba98fa15a217b42c9256d8f4d322c2642e9cde Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 14 Jan 2014 10:34:08 +0000
Subject: Allow overriding compiler and build flags

Patch-Name: makefile-variables.patch
---
 Makefile | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index d65c44f..5315759 100644
--- a/Makefile
+++ b/Makefile
@@ -8,30 +8,34 @@
 #SGI: cc
 
 
+CC := gcc
+CFLAGS := -O2 -g -Wall
+LDFLAGS :=
+
 browser-history: browser-history.c
-	gcc -ansi -O2 -g -Wall -I/usr/X11R6/include browser-history.c \
-             -o browser-history -L/usr/X11R6/lib -lXmu -lX11
+	$(CC) -ansi $(CFLAGS) -I/usr/X11R6/include browser-history.c \
+             -o browser-history -L/usr/X11R6/lib -lXmu -lX11 $(LDFLAGS)
 all:
-	gcc  -ansi -O2 -g -Wall -I/usr/X11R6/include browser-history.c \
-             -o browser-history -L/usr/X11R6/lib -lXmu -lX11
+	$(CC)  -ansi $(CFLAGS) -I/usr/X11R6/include browser-history.c \
+             -o browser-history -L/usr/X11R6/lib -lXmu -lX11 $(LDFLAGS)
 
 cc:
 	cc  -I/usr/X11R6/include -ansi -O -o browser-history browser-history.c \
 	     -L/usr/X11R6/lib -lXmu -lX11
 
 bsd:
-	gcc  -I/usr/X11R6/include -ansi -O -Wall -DBSD browser-history.c -o browser-history \
+	$(CC)  -I/usr/X11R6/include -ansi -O -Wall -DBSD browser-history.c -o browser-history \
 	     -L/usr/X11R6/lib -lXmu -lX11
 
 solaris:
-	gcc  -I/usr/X11R6/include -ansi -O -Wall browser-history.c -o browser-history \
+	$(CC)  -I/usr/X11R6/include -ansi -O -Wall browser-history.c -o browser-history \
 	     -R/usr/X11R6/lib \
 	     -L/usr/X11R6/lib -lXmu -lX11 -ldl -lsocket -lnsl 
 
 
 debug :
-	gcc -I/usr/X11R6/include -DDEBUG -ansi -g -Wall browser-history.c -o browser-history \
-	     -L/usr/X11R6/lib -lXmu -lX11
+	$(CC) -I/usr/X11R6/include -DDEBUG -ansi -g -Wall browser-history.c -o browser-history \
+	     -L/usr/X11R6/lib -lXmu -lX11 $(LDFLAGS)
 
 tar:
 	cd ..;tar cfvz browser-history/browser-history.tgz `cat browser-history/FILES_DIST`
