Makefile: Add minimal C compiler warning flags
authorErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 10 Jun 2016 23:49:50 +0000 (09:49 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 10 Jun 2016 23:49:50 +0000 (09:49 +1000)
Makefile

index 539fb7112e161a9dfd62747f823abc6bfe43dd51..46fce590ab2bdc7089ff2bc5f6d0b2c8f279b1c2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,9 @@ RANLIB = /usr/bin/ranlib
 CC = gcc
 #CC = cc
 
+# Enable compiler warnings. This is ab absolute minimum.
+CFLAGS += -Wall -Wextra
+
 # Define your optimization flags.  Most compilers understand -O and -O2,
 # Standard (note: Solaris on UltraSparc using gcc 2.8.x might not like this.)
 #
@@ -224,19 +227,19 @@ all:      $(NAME) d$(NAME)
 .SUFFIXES: .c .o .h
 
 $(COMMON_OBJECT): %.o: %.c
-       $(CC) $(OPTS) $(COMMON_DEFS) -o $@ -c $<
+       $(CC) $(CFLAGS) $(OPTS) $(COMMON_DEFS) -o $@ -c $<
 
 $(BLORB_OBJECT): %.o: %.c
-       $(CC) $(OPTS) -o $@ -c $<
+       $(CC) $(CFLAGS) $(OPTS) -o $@ -c $<
 
 $(DUMB_OBJECT): %.o: %.c
-       $(CC) $(OPTS) -o $@ -c $<
+       $(CC) $(CFLAGS) $(OPTS) -o $@ -c $<
 
 $(CURSES_OBJECT): %.o: %.c
-       $(CC) $(OPTS) $(CURSES_DEFS) $(INCL) -o $@ -c $<
+       $(CC) $(CFLAGS) $(OPTS) $(CURSES_DEFS) $(INCL) -o $@ -c $<
 
 $(SDL_OBJECT): %.o: %.c
-       $(CC) $(OPTS) $(SDL_DEFS) $(INCL) -o $@ -c $<
+       $(CC) $(CFLAGS) $(OPTS) $(SDL_DEFS) $(INCL) -o $@ -c $<
 
 
 # If you're going to make this target manually, you'd better know which