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 =
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.
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)