Add gcc compiler warnings
authorTim Rühsen <tim.ruehsen@gmx.de>
Fri, 11 Mar 2016 12:36:38 +0000 (13:36 +0100)
committerTim Rühsen <tim.ruehsen@gmx.de>
Fri, 11 Mar 2016 12:36:38 +0000 (13:36 +0100)
lib/Makefile

index ac83147..4beecfd 100644 (file)
@@ -4,6 +4,8 @@ TARGETS = libquickder.a libquickder.so
 
 PREFIX = /usr/local
 
+CFLAGS=-Wall -Wextra -pedantic -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wmissing-prototypes
+
 all: $(TARGETS)
 
 install: $(TARGETS)
@@ -20,14 +22,14 @@ clean:
        rm -f $(OBJS) $(TARGETS)
 
 .c.o:
-       gcc -fPIC -Os -c -I../include -o "$@" "$<"
+       gcc -fPIC $(CFLAGS) -c -I../include -o "$@" "$<"
 
 libquickder.a: $(OBJS)
        rm -rf "$@"
        ar rc "$@" $(OBJS)
 
 libquickder.so: $(OBJS)
-       gcc -I../include --shared -Os -o "$@" $(OBJS)
+       gcc -I../include --shared $(CFLAGS) -o "$@" $(OBJS)
 
 stats: $(OBJS)
        @for o in *.o ; do objdump -h -j .text $$o | sed -e '/\.text/!d' -e 's/^.*\.text[ \t]*\([^ \t]*\).*/\1'" $${o%.o}/" ;done | while read sz fun ; do printf '%5d %s\n' 0x$$sz $$fun ; done