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 =