openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

Makefile.linux-iproc (4169B)


      1 #
      2 #  Copyright 2017 Broadcom
      3 #  
      4 #  This program is free software; you can redistribute it and/or modify
      5 #  it under the terms of the GNU General Public License, version 2, as
      6 #  published by the Free Software Foundation (the "GPL").
      7 #  
      8 #  This program is distributed in the hope that it will be useful, but
      9 #  WITHOUT ANY WARRANTY; without even the implied warranty of
     10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     11 #  General Public License version 2 (GPLv2) for more details.
     12 #  
     13 #  You should have received a copy of the GNU General Public License
     14 #  version 2 (GPLv2) along with this source code.
     15 #
     16 # $Id: Makefile.linux-iproc Exp $
     17 # $Copyright: (c) 2007 Broadcom Corp.
     18 # All Rights Reserved.$
     19 # Makefile for iproc-CMICd
     20 
     21 # User must select one platform from below.By default ARM_LINUX is selected. .
     22 ifeq (,$(BUILD_PLATFORM))
     23 BUILD_PLATFORM=ARM_LINUX
     24 endif
     25 
     26 # TOOLCHAIN_BASE_DIR    Toolchain base directory for iPROC-CMICd devices
     27 # TARGET_ARCHITECTURE   Compiler for target architecture
     28 # KERNDIR               Kernel directory for iPROC-CMICd devices
     29 ifeq (BE,$(ENDIAN_MODE))
     30 #While BE mode is supported, it's use is very limited.  We had a specific customer
     31 #request for BE support but don't currently mainstream it.  So a 5.1.0 version
     32 #has not been built.  Continue using 5.0.3 for any BE support
     33 TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50-be/XLDK32
     34 TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
     35 KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
     36 else
     37 TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk51/XLDK32
     38 TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
     39 KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
     40 endif
     41 
     42 ifeq (,$(CROSS_COMPILE))
     43 CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
     44 endif
     45 
     46 # arm9tools
     47 TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin
     48 override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
     49 LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib
     50 export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
     51 
     52 CROSS_GCC_VER ?= $(shell $(TOOLCHAIN_BIN_DIR)/$(CROSS_COMPILE)gcc -dumpversion)
     53 
     54 # Default Linux include directory
     55 ifeq (,$(LINUX_INCLUDE))
     56 LINUX_INCLUDE := $(KERNDIR)/include
     57 endif
     58 
     59 ifeq (BE,$(ENDIAN_MODE))
     60 CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
     61 ENDIAN = BE_HOST=1
     62 else
     63 CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
     64 ENDIAN = LE_HOST=1
     65 endif
     66 
     67 CFLAGS += -fno-aggressive-loop-optimizations
     68 CFLAGS += -Wno-error=maybe-uninitialized
     69 CFLAGS += -Wno-error=array-bounds
     70 CFLAGS += -fgnu89-inline
     71 ifeq "$(shell expr `echo $(CROSS_GCC_VER) | cut -f1 -d.` \>= 7)" "1"
     72     CFLAGS += -Wno-error=bool-operation
     73 endif
     74 
     75 CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
     76 CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
     77 
     78 ARCH = arm
     79 KBUILD_VERBOSE = 1
     80 
     81 export ARCH KBUILD_VERBOSE
     82 
     83 comma = ,
     84 basetarget = $(basename $(notdir $@))
     85 modname = $(basetarget)
     86 
     87 # Extra variables.
     88 EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
     89 
     90 name-fix = $(subst $(comma),_,$(subst -,_,$1))
     91 basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
     92 modname_flags  = $(if $(filter 1,$(words $(modname))),\
     93                  -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
     94 
     95 KFLAG_INCLD ?= $(LD_LIBRARY_PATH)/gcc/$(TARGET_ARCHITECTURE)/$(CROSS_GCC_VER)/include
     96 
     97 ifeq (,$(KFLAGS))
     98 KFLAGS := -D__LINUX_ARM_ARCH__=7 -D__KERNEL__ -nostdinc  -isystem $(KFLAG_INCLD) -I$(LINUX_INCLUDE) -include $(LINUX_INCLUDE)/generated/autoconf.h -I$(KERNDIR)/arch/arm/include -I$(KERNDIR)/arch/arm/include/generated -I$(KERNDIR)/arch/arm/mach-iproc/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -marm -mabi=aapcs-linux -fno-pic -pipe -msoft-float -ffreestanding -march=armv7-a -mfpu=vfp -mfloat-abi=softfp -fomit-frame-pointer -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign -mlong-calls
     99 KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi
    100 endif
    101 
    102 ifneq ($(targetplat),user)
    103 include ${SDK}/make/Makefile.linux-kernel-3_6
    104 endif