fix flag handling

Make sure we respect CPPFLAGS and don't hardcode

TEST=`emerge-x86-alex rootdev` uses right flags

Change-Id: I668af9e02b842ddc54f60e07d313a564cc927413
Reviewed-by: Liam McLoughlin <>
Commit-Queue: Mike Frysinger <>
Tested-by: Mike Frysinger <>
diff --git a/Makefile b/Makefile
index ed0bbc2..1575f3a 100644
--- a/Makefile
+++ b/Makefile
@@ -2,16 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
+CFLAGS += -Wall -Werror
 $(shell mkdir -p $(OUT))
 all: $(OUT)/rootdev $(OUT)/
 $(OUT)/rootdev: main.c $(OUT)/
-	$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -O2 -Wall
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ -o $@
 $(OUT)/ rootdev.c
-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -fPIC \
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fPIC \
 		-Wl,-soname, $< -o $@
 	ln -s $(@F) $(OUT)/
 	ln -s $(@F) $(OUT)/