]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - config.mk
Added support for KwikByte KB920x boards (based on AT91RM9200)
[karo-tx-uboot.git] / config.mk
index ef3c7037edf4c4bc053e7938fa6be8f7ec606c43..d85ac36b5e602c3e80c67c8c5cb1d767f6f49680 100644 (file)
--- a/config.mk
+++ b/config.mk
 
 #########################################################################
 
+# clean the slate ...
+PLATFORM_RELFLAGS =
+PLATFORM_CPPFLAGS =
+PLATFORM_LDFLAGS =
+
 #
 # When cross-compiling on NetBSD, we have to define __PPC__ or else we
 # will pick up a va_list declaration that is incompatible with the
@@ -54,6 +59,9 @@ endif
 ifdef  CPU
 sinclude $(TOPDIR)/cpu/$(CPU)/config.mk        # include  CPU  specific rules
 endif
+ifdef  SOC
+sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include  SoC  specific rules
+endif
 ifdef  VENDOR
 BOARDDIR = $(VENDOR)/$(BOARD)
 else
@@ -78,6 +86,12 @@ HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTSTRIP      = strip
 
 #########################################################################
+#
+# Option checker (courtesy linux kernel) to ensure
+# only supported compiler options are used
+#
+cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
 #
 # Include the make variables (CC, etc...)
@@ -96,15 +110,19 @@ RANLIB     = $(CROSS_COMPILE)RANLIB
 RELFLAGS= $(PLATFORM_RELFLAGS)
 DBGFLAGS= -g #-DDEBUG
 OPTFLAGS= -Os #-fomit-frame-pointer
-#LDSCRIPT := board/$(BOARDDIR)/u-boot.lds.debug
+ifndef LDSCRIPT
+#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
-OBJCFLAGS := --gap-fill=0xff
+endif
+OBJCFLAGS += --gap-fill=0xff
+
+gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)                \
        -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE)           \
        -I$(TOPDIR)/include                             \
-       -fno-builtin                                    \
-       -pipe $(PLATFORM_CPPFLAGS)
+       -fno-builtin -ffreestanding -nostdinc -isystem  \
+       $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 
 ifdef BUILD_TAG
 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \
@@ -113,10 +131,18 @@ else
 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
 endif
 
+# avoid trigraph warnings while parsing pci.h (produced by NIOS gcc-2.9)
+# this option have to be placed behind -Wall -- that's why it is here
+ifeq ($(ARCH),nios)
+ifeq ($(findstring 2.9,$(shell $(CC) --version)),2.9)
+CFLAGS := $(CPPFLAGS) -Wall -Wno-trigraphs
+endif
+endif
+
 AFLAGS_DEBUG := -Wa,-gstabs
 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
 
-LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE)
+LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
 
 # Location of a usable BFD library, where we define "usable" as
 # "built for ${HOST}, supports ${TARGET}".  Sensible values are
@@ -131,11 +157,19 @@ LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE)
 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
 BFD_ROOT_DIR =         /usr/local/tools
 else
+ifeq ($(HOSTARCH),$(ARCH))
+# native
+BFD_ROOT_DIR =         /usr
+else
 #BFD_ROOT_DIR =                /LinuxPPC/CDK           # Linux/i386
 #BFD_ROOT_DIR =                /usr/pkg/cross          # NetBSD/i386
-#BFD_ROOT_DIR =                /usr                    # native
 BFD_ROOT_DIR =         /opt/powerpc
 endif
+endif
+
+ifeq ($(PCI_CLOCK),PCI_66M)
+CFLAGS := $(CFLAGS) -DPCI_66M
+endif
 
 #########################################################################