From c146dcf5f0ee9bcb1b44bfecacb919c0fa179e15 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 19 Jul 2005 03:42:55 +0000 Subject: [PATCH] Detect GCC 3.x versus 4.x and use -I- or -isystem, respectively, to avoid ugly warnings on 4.x with -I-. --- src/Make.config | 12 +++++++++++- src/Makefile.build | 2 +- src/Makefile.userprog | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Make.config b/src/Make.config index 8744f0d..f9822b6 100644 --- a/src/Make.config +++ b/src/Make.config @@ -18,11 +18,21 @@ LD = i386-elf-ld OBJCOPY = i386-elf-objcopy endif +# GCC 3.3 specifies directories for #include <> as "-I- -Idir" +# GCC 4.x specifies directories for #include <> as "-isystem dir" +# Figure out which format to use. +ifeq (0, $(shell $(CC) -v 2>&1 | grep 'gcc version 4' >/dev/null 2>&1; echo $$?)) +SYSINCFLAGS = $(patsubst %,-isystem %,$(SYSINCDIRS)) +else +SYSINCFLAGS = -I- $(patsubst %,-I%,$(SYSINCDIRS)) +endif + # Compiler and assembler invocation. DEFINES = WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wsystem-headers CFLAGS = -g -MMD -msoft-float -masm=intel -CPPFLAGS = -nostdinc -I$(SRCDIR) -I- -I$(SRCDIR)/lib +SYSINCDIRS = $(SRCDIR)/lib +CPPFLAGS = -nostdinc -I$(SRCDIR) $(SYSINCFLAGS) ASFLAGS = -Wa,--gstabs -MMD LDFLAGS = diff --git a/src/Makefile.build b/src/Makefile.build index cf0f9b6..2e1d6e9 100644 --- a/src/Makefile.build +++ b/src/Makefile.build @@ -9,7 +9,7 @@ include ../Make.vars include ../../tests/Make.tests # Compiler and assembler options. -os.dsk: CPPFLAGS += -I$(SRCDIR)/lib/kernel +os.dsk: SYSINCDIRS += $(SRCDIR)/lib/kernel # Core kernel. threads_SRC = threads/init.c # Main program. diff --git a/src/Makefile.userprog b/src/Makefile.userprog index 72e35ce..dddb1aa 100644 --- a/src/Makefile.userprog +++ b/src/Makefile.userprog @@ -2,7 +2,7 @@ include $(SRCDIR)/Make.config -$(PROGS): CPPFLAGS += -I$(SRCDIR)/lib/user -I. +$(PROGS): SYSINCDIRS += $(SRCDIR)/lib/user # Linker flags. $(PROGS): LDFLAGS = -nostdlib -static -Wl,-T,$(LDSCRIPT) -- 2.30.2