1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Description: use Debian's C*FLAGS and LDFLAGS (esp. for hardening)
Author: Tianon Gravi <tianon@debian.org>
diff --git a/Makefile b/Makefile
index 4482430..f7f3ee0 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,10 @@ PREFIX=/usr/local
XLIBPATH=/usr/X11R6/lib
# Sets some flags for stricter compiling
-CFLAGS=-pedantic -Wall -W -O
+CFLAGS += -pedantic -Wall
+
+CPPFLAGS ?=
+LDFLAGS += -L$(XLIBPATH) -lX11
PKG_CONFIG ?= pkg-config
@@ -32,13 +35,13 @@ all: $(target) $(sources) $(headers)
@echo Build Successful
$(target): $(sources:.c=.o)
- $(CC) $(CFLAGS) \
+ $(CC) $(CPPFLAGS) $(CFLAGS) \
$^ -o $@ \
- -L$(XLIBPATH) -lX11 \
+ $(LDFLAGS) \
`$(PKG_CONFIG) --libs glib-2.0`
%.o: %.c
- $(CC) -c $(CFLAGS) `$(PKG_CONFIG) --cflags glib-2.0` $<
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) `$(PKG_CONFIG) --cflags glib-2.0` $<
version.h: version.h.in Makefile
sed -e "s/@VERSION@/$(VERSION)/" version.h.in > $@
|