Description: Let the user override the compiler/linker flags and some variables.
Forwarded: nowhere-to
Author: Peter Pentchev <roam@ringlet.net>
Last-Update: 2011-03-01
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,20 @@
# what base directory do you want for the installation?
-INSTPREFIX = /usr/local
+INSTPREFIX ?= /usr/local
# your gcc compiler
-CC = /usr/local/bin/gcc
+CC ?= /usr/local/bin/gcc
-# define macro for gcc flags
-CFLAGS := -Wall -D_XOPEN_SOURCE -g $(shell pkg-config --cflags gtk+-2.0) #-D_MANNI_DEBUG
+# define macros for gcc flags
+CFLAGS_COMPAT ?= -D_XOPEN_SOURCE
+CFLAGS_GTK_PKGCONFIG := $(shell pkg-config --cflags gtk+-2.0)
+CFLAGS_GTK ?= ${CFLAGS_GTK_PKGCONFIG}
+CFLAGS_WARN ?= -Wall
+CFLAGS ?= -g
# with optimisation, and without debugging information...
-# CFLAGS = -O3 -Wall -D_XOPEN_SOURCE `gtk-config --cflags`
+# CFLAGS ?= -O3
+
+# combine the lot
+CFLAGS += ${CFLAGS_COMPAT} ${CFLAGS_GTK} ${CFLAGS_WARN}
# define libraries to include
LIBRARIES := $(shell pkg-config --libs gtk+-2.0)
@@ -26,7 +33,7 @@
all: gtkcookie
gtkcookie: gtkcookie.o proctool.o getline.o
- $(CC) $(CFLAGS) -o gtkcookie gtkcookie.o proctool.o getline.o $(LIBRARIES)
+ $(CC) $(LDFLAGS) -o gtkcookie gtkcookie.o proctool.o getline.o $(LIBRARIES)
gtkcookie.o: gtkcookie.c $(HEADERFILES)
$(CC) $(CFLAGS) -c gtkcookie.c