ARCH     = x86
DDELINUX26DIR = /usr/bigports/ddelinux26
DDEKIT_INCDIR = /usr/bigports/ddekit/include 

CC = gcc
AS = gas
AR = gar
 
VERBOSE = $(if $(CONF_VERBOSE),,@) 


# Linux 2.6 defines some macros on command line
KBUILD_DEFINES = -D"KBUILD_STR(s)=\#s" \
                 -D"KBUILD_BASENAME=KBUILD_STR($(patsubst %.o, %, $(notdir $@)))" \
                 -D"KBUILD_MODNAME=KBUILD_STR($(patsubst %.o, %, $@))"

# for some reasons, Linux 2.6 does not include autoconf.h in the implementation
# files but does so on the command line
ifeq ($(ARCH), x86)
KBUILD_CPPFLAGS = -include linux/autoconf.h
endif

ifeq ($(ARCH), arm)
KBUILD_CPPFLAGS = -include linux/autoconf-arm.h
endif

# includes
MY_DDE_INCDIR = $(DDELINUX26DIR)/include \

SUFFIX_amd64 = x86_64
SUFFIX_x86   = x86
SUFFIX_arm   = arm

MY_LINUX26_INCDIR =  \
                    $(DDELINUX26DIR)/include/dde/linux26 \
                    $(DDELINUX26DIR)/contrib/include \
                    $(DDELINUX26DIR)/contrib/arch/x86/include\
                    $(DDELINUX26DIR)/contrib/arch/x86/include/asm/mach-generic \



# stolen from fiasco/src/Makeconf, checks whether a compiler supports a certain
# parameter
CHECKCC     = $(shell if $(CC)  $(1) -S -o /dev/null -xc   /dev/null \
              > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)


# arch-specific stuff
ifeq ($(ARCH), x86)
MY_DDE_INCDIR += $(OBJ_BASE)/include/l4/dde/linux26/linux-headers/asm/mach-default
endif

PRIVATE_INCDIR += $(MY_LINUX26_INCDIR) $(DDEKIT_INCDIR) $(MY_DDE_INCDIR) 
DEFINES += -DDDE_MINUX -D__KERNEL__ -DDDE_LINUX $(KBUILD_DEFINES) -D"__section(P)="   -D"__section__(P)=" -D"section(P)=" -D"weak=" -D"DDEKIT_INVALID_TIMER_ID=-1"
CPPFLAGS += $(KBUILD_CPPFLAGS)
CFLAGS += 
ASFLAGS += -D__ASSEMBLY__

WARNINGS  += -Wall -Wstrict-prototypes -fno-strict-aliasing
WARNINGS  += $(call CHECKCC, -Wno-unused,)
WARNINGS  += $(call CHECKCC, -Wno-pointer-sign,)
