ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)

TOPDIR  := $(KERNELSOURCE)

HPATH           = $(TOPDIR)/include

HOSTCC          =gcc
HOSTCFLAGS      =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

LD      =$(CROSS_COMPILE)ld
CC      =$(CROSS_COMPILE)gcc
MODFLAGS = -DMODULE

include .config

#
# standard CFLAGS
#

CPPFLAGS := -D__KERNEL__ -I$(HPATH)

ifdef CONFIG_SMP
CPPFLAGS += -D__SMP__
endif

CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

# use '-fno-strict-aliasing', but only if the compiler can take it
CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)

export CPPFLAGS CFLAGS

include $(KERNELRELEASE)/Makefile.$(ARCH)

ifdef CONFIG_MODULES
ifdef CONFIG_MODVERSIONS
MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
endif
else
error:
	@echo "The present kernel configuration has modules disabled."
	@exit 1
endif

