From: Jari Aalto <jari.aalto@cante.net>
Subject: Add build flags support

---
 Makefile |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@
 #OPT_WMLIB += -lefence
 
 CC = gcc
-CFLAGS = -g -O2 -Wall
+# CFLAGS = -g -O2 -Wall
 
 BINDIR = $(DESTDIR)$(XROOT)/bin
 MANDIR = $(DESTDIR)$(XROOT)/share/man/man1
@@ -49,32 +49,32 @@
 GTKFLAGS = `pkg-config --cflags gtk+-2.0`
 
 $(PLAINOBJ): %.o: %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
 
 $(X11OBJ): %.o: %.c
-	$(CC) $(CFLAGS) $(X11FLAGS) -c $< -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(X11FLAGS) -c $< -o $@
 
 $(WMOBJ): %.o: %.c
-	$(CC) $(CFLAGS) $(WMFLAGS) -c $< -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(WMFLAGS) -c $< -o $@
 
 $(GTKOBJ): %.o: %.c
-	$(CC) $(CFLAGS) $(GTKFLAGS) -c $< -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(GTKFLAGS) -c $< -o $@
 
 X11LIB = -L$(XROOT)/lib -lX11
 WMLIB = $(X11LIB) $(OPT_WMLIB)
 GTKLIB = `pkg-config --libs gtk+-2.0` -lX11
 
 $(PLAINBIN): %: %.o
-	$(CC) $^ -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ -o $@
 
 $(X11BIN): %: %.o
-	$(CC) $^ $(X11LIB) -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(X11LIB) -o $@
 
 $(WMBIN): %:
-	$(CC) $^ $(WMLIB) -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(WMLIB) -o $@
 
 $(GTKBIN): %: %.o
-	$(CC) $^ $(GTKLIB) -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(GTKLIB) -o $@
 
 AEMAN = aewm.1x aeclients.1x
 AERC = aewmrc clientsrc
