Makefile: replace -W -Wall with centralized $(GCCWARN)
authorH. Peter Anvin <hpa@zytor.com>
Sun, 10 Jan 2010 20:48:06 +0000 (12:48 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 10 Jan 2010 20:49:30 +0000 (12:49 -0800)
Replace -W -Wall hardcoded into a bunch of Makefiles with $(GCCWARN),
a centralized variable defined in the root MCONFIG.  Add
-Wstrict-prototypes to the list of global warnings: we should never
have non-prototyped declarations.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
MCONFIG
MCONFIG.embedded
com32/MCONFIG
com32/lib/MCONFIG
com32/rosh/MCONFIG
extlinux/Makefile
linux/Makefile
memdisk/Makefile
mtools/Makefile
utils/Makefile
win32/Makefile

diff --git a/MCONFIG b/MCONFIG
index a716c6c..c73520b 100644 (file)
--- a/MCONFIG
+++ b/MCONFIG
@@ -60,6 +60,9 @@ WGET   = wget
 
 com32    = $(topdir)/com32
 
+# Common warnings we want for all gcc-generated code
+GCCWARN := -W -Wall -Wstrict-prototypes
+
 # Common stanza to make gcc generate .*.d dependency files
 MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d
 
index 586afc3..37abe91 100644 (file)
@@ -28,7 +28,7 @@ GCCOPT    := $(call gcc_ok,-m32,) \
 LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)
 
 LD        += -m elf_i386
-CFLAGS     = $(GCCOPT) -g -W -Wall -Wno-sign-compare $(OPTFLAGS) $(INCLUDES)
+CFLAGS     = $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES)
 SFLAGS     = $(CFLAGS) -D__ASSEMBLY__
 
 .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss
index f8d9d97..578e283 100644 (file)
@@ -32,11 +32,11 @@ GPLLIB     =
 GPLINCLUDE =
 endif
 
-CFLAGS     = $(GCCOPT) -W -Wall -march=i386 \
+CFLAGS     = $(GCCOPT) $(GCCWARN) -march=i386 \
             -fomit-frame-pointer -D__COM32__ \
             -nostdinc -iwithprefix include \
             -I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE)
-SFLAGS     = $(GCCOPT) -W -Wall -march=i386 \
+SFLAGS     = $(GCCOPT) $(GCCWARN) -march=i386 \
             -fomit-frame-pointer -D__COM32__ \
             -nostdinc -iwithprefix include \
             -I$(com32)/libutil/include -I$(com32)/include $(GPLINCLUDE)
@@ -45,7 +45,7 @@ COM32LD          = $(com32)/lib/com32.ld
 LDFLAGS    = -m elf_i386 -T $(COM32LD)
 LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)
 
-LNXCFLAGS  = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
+LNXCFLAGS  = -I$(com32)/libutil/include $(GCCWARN) -O -g -D_GNU_SOURCE
 LNXSFLAGS  = -g
 LNXLDFLAGS = -g
 
index 1eb18db..1ae83bc 100644 (file)
@@ -24,7 +24,7 @@ REQFLAGS  = $(GCCOPT) -g -mregparm=3 -DREGPARM=3 -D__COM32__ \
            -nostdinc -iwithprefix include -I. -I./sys -I../include
 OPTFLAGS  = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \
            -falign-labels=0 -ffast-math -fomit-frame-pointer
-WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline
+WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline
 
 CFLAGS  = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS)
 LDFLAGS        = -m elf32_i386
index 30029d1..25c4139 100644 (file)
 ## Include the COM32 common configurables
 include ../MCONFIG
 
-# CFLAGS     = $(GCCOPT) -W -Wall -march=i386 \
+# CFLAGS     = $(GCCOPT) $(GCCWARN) -march=i386 \
 #           -fomit-frame-pointer -D__COM32__ \
 #           -nostdinc -iwithprefix include \
 #           -I$(com32)/libutil/include -I$(com32)/include
 #       -g3 -dD
 
-# LNXCFLAGS  = -I$(com32)/libutil/include -W -Wall -O -g3 -D_GNU_SOURCE -dD
+# LNXCFLAGS  = -I$(com32)/libutil/include $(GCCWARN) -O -g3 -D_GNU_SOURCE -dD
 #       -U__GNUC__
index 4810533..23ffd40 100644 (file)
@@ -19,7 +19,7 @@ include $(topdir)/MCONFIG
 
 OPTFLAGS = -g -Os
 INCLUDES = -I. -I.. -I../libinstaller
-CFLAGS  = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+CFLAGS  = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
           $(OPTFLAGS) $(INCLUDES)
 LDFLAGS         = # -s
 
index a469cef..8872c0f 100644 (file)
@@ -19,7 +19,7 @@ include $(topdir)/MCONFIG
 
 OPTFLAGS = -g -Os
 INCLUDES = -I. -I.. -I../libinstaller
-CFLAGS  = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
+CFLAGS  = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
 LDFLAGS         = -s
 
 SRCS     = syslinux.c \
index 09f17c8..2e6330f 100644 (file)
@@ -91,7 +91,7 @@ memdisk: memdisk16.bin memdisk32.bin postprocess.pl
        $(PERL) postprocess.pl $@ memdisk16.bin memdisk32.bin
 
 e820test: e820test.c e820func.c msetup.c
-       $(CC) -m32 -g -W -Wall -DTEST -o $@ $^
+       $(CC) -m32 -g $(GCCWARN) -DTEST -o $@ $^
 
 # This file contains the version number, so add a dependency for it
 setup.s: ../version
index b551780..91b6852 100644 (file)
@@ -3,7 +3,7 @@ include $(topdir)/MCONFIG
 
 OPTFLAGS = -g -Os
 INCLUDES = -I. -I.. -I../libfat -I../libinstaller
-CFLAGS  = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
+CFLAGS  = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
 LDFLAGS         = -s
 
 SRCS     = syslinux.c \
index 39adf7d..7fdf631 100644 (file)
@@ -17,7 +17,7 @@
 topdir = ..
 include $(topdir)/MCONFIG
 
-CFLAGS   = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
+CFLAGS   = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
 LDFLAGS  = -O2 -s
 
 TARGETS         = mkdiskimage isohybrid gethostip
index 964b74c..a0be1d4 100644 (file)
@@ -21,7 +21,7 @@ OSTYPE   = $(shell uname -msr)
 ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
 ## Compiling on Cygwin
 WINPREFIX  :=
-WINCFLAGS  := -mno-cygwin -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
+WINCFLAGS  := -mno-cygwin $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
 WINLDFLAGS := -mno-cygwin -Os -s
 else
 ## Compiling on some variant of MinGW
@@ -30,7 +30,7 @@ WINPREFIX  :=
 else
 WINPREFIX  := $(shell ./find-mingw.sh gcc)
 endif
-WINCFLAGS  := -W -Wall -Wno-sign-compare -Os -fomit-frame-pointer \
+WINCFLAGS  := $(GCCWARN) -Wno-sign-compare -Os -fomit-frame-pointer \
              -D_FILE_OFFSET_BITS=64
 WINLDFLAGS := -Os -s
 endif