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 (3665B)


      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 TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50-be/XLDK32
     31 TARGET_ARCHITECTURE:=armeb-broadcom-linux-uclibcgnueabi
     32 KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
     33 else
     34 TOOLCHAIN_BASE_DIR ?= /projects/ntsw-tools/linux/iproc_ldks/xldk50/XLDK32
     35 TARGET_ARCHITECTURE:= arm-broadcom-linux-uclibcgnueabi
     36 KERNDIR ?= $(TOOLCHAIN_BASE_DIR)/kernel/linux
     37 endif
     38 
     39 ifeq (,$(CROSS_COMPILE))
     40 CROSS_COMPILE:= $(TARGET_ARCHITECTURE)-
     41 endif
     42 
     43 # arm9tools
     44 TOOLCHAIN_BIN_DIR=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/bin
     45 override PATH:=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/$(TARGET_ARCHITECTURE)/bin:$(TOOLCHAIN_BIN_DIR):$(PATH)
     46 LD_LIBRARY_PATH=$(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib
     47 
     48 export TOOLCHAIN_BIN_DIR LD_LIBRARY_PATH
     49 
     50 # Default Linux include directory
     51 ifeq (,$(LINUX_INCLUDE))
     52 LINUX_INCLUDE := $(KERNDIR)/include
     53 endif
     54 
     55 ifeq (BE,$(ENDIAN_MODE))
     56 CFGFLAGS += -DSYS_BE_PIO=1 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=1
     57 ENDIAN = BE_HOST=1
     58 else
     59 CFGFLAGS += -DSYS_BE_PIO=0 -DSYS_BE_PACKET=0 -DSYS_BE_OTHER=0
     60 ENDIAN = LE_HOST=1
     61 endif
     62 
     63 CFLAGS += -fno-aggressive-loop-optimizations
     64 
     65 CFGFLAGS += -D$(ENDIAN) -DIPROC_CMICD
     66 CFGFLAGS += -DBCM_PLATFORM_STRING=\"IPROC_CMICD\"
     67 
     68 ARCH = arm
     69 KBUILD_VERBOSE = 1
     70 
     71 export ARCH KBUILD_VERBOSE
     72 
     73 comma = ,
     74 basetarget = $(basename $(notdir $@))
     75 modname = $(basetarget)
     76 
     77 # Extra variables.
     78 EXTRA_CFLAGS = -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags)
     79 
     80 name-fix = $(subst $(comma),_,$(subst -,_,$1))
     81 basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
     82 modname_flags  = $(if $(filter 1,$(words $(modname))),\
     83                  -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
     84 
     85 KFLAG_INCLD ?= $(TOOLCHAIN_BASE_DIR)/buildroot/host/usr/lib/gcc/$(TARGET_ARCHITECTURE)/4.9.4/include
     86 
     87 ifeq (,$(KFLAGS))
     88 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
     89 KFLAGS += -I$(LINUX_INCLUDE)/uapi -I$(LINUX_INCLUDE)/generated/uapi -I$(KERNDIR)/arch/arm/include/uapi -I$(KERNDIR)/arch/arm/include/generated/uapi
     90 endif
     91 
     92 ifneq ($(targetplat),user)
     93 include ${SDK}/make/Makefile.linux-kernel-3_6
     94 endif