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-kernel-2_6 (4050B)


      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-kernel-2_6,v 1.40 Broadcom SDK $
     17 # $Copyright: (c) 2005 Broadcom Corp.
     18 # All Rights Reserved.$
     19 
     20 # Configuration Flags
     21 
     22 # Filter out features that cannot or should not be supported in kernel mode
     23 
     24 _FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT
     25 FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST))
     26 
     27 # Tools
     28 
     29 # Conditionally Replaces DEFAULT var
     30 ifeq ($(origin CC),default)
     31 CC	= $(LSRUN) $(CROSS_COMPILE)gcc
     32 endif
     33 
     34 ifeq ($(origin CXX),default)
     35 CXX	= $(CROSS_COMPILE)g++
     36 endif
     37 
     38 ifeq ($(origin LD),default)
     39 LD	= $(CROSS_COMPILE)ld
     40 endif
     41 
     42 ifeq ($(origin AR),default)
     43 AR	= $(CROSS_COMPILE)ar
     44 endif
     45 
     46 ifeq ($(origin AS),default)
     47 AS	= $(CROSS_COMPILE)as
     48 endif
     49 
     50 ifeq ($(origin ARFLAGS),default)
     51 	ARFLAGS	= -rc
     52 endif
     53 
     54 STRIP	= $(CROSS_COMPILE)strip
     55 RANLIB  = $(CROSS_COMPILE)ranlib
     56 OBJCOPY = $(CROSS_COMPILE)objcopy
     57 NM      = $(CROSS_COMPILE)nm
     58 
     59 # Handle differences between gcc 2.x and gcc 3.x
     60 gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi)
     61 
     62 # Configuration Variables
     63 
     64 # OSType Defines: This defines the type of RTOS or microkernel which you
     65 # are compiling the SAL (and its associated driver) for. New platforms
     66 # can be created by porting the routines (system.c) to your platform and
     67 # adding the define in this Makefile.
     68 
     69 OSTYPE = LINUX
     70 
     71 #
     72 # ORIGIN is used to Optionally select different CFLAGS. It is used to import
     73 # source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
     74 # to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
     75 # added.
     76 #
     77 # Default specifies Broadcom
     78 #
     79 ifndef ORIGIN
     80 	ORIGIN = Broadcom
     81 endif
     82 
     83 #
     84 # STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
     85 # BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
     86 # OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of 
     87 #			 this Makefile, to define local "Extra" flags.
     88 #
     89 
     90 ifdef IPROC_BUILD
     91 CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
     92 	    -I$(SDK)/systems/bde/linux/include \
     93 	    -I$(LINUX_INCLUDE) \
     94             -I$(KERNDIR)/arch/$(ARCH)
     95 else
     96 CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
     97 	    -I$(SDK)/systems/bde/linux/include \
     98 	    -I$(LINUX_INCLUDE) \
     99 	    -I$(LINUX_INCLUDE)/asm/gcc \
    100 	    -I$(LINUX_INCLUDE)/asm/mach-generic \
    101             -I$(KERNDIR)/arch/$(ARCH)
    102 endif
    103 
    104 CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE
    105 
    106 CFGFLAGS += -D$(OSTYPE)
    107 
    108 # No user sal for the linux kernel
    109 # NO_SAL_APPL=1
    110 
    111 STD_CFLAGS = $(KFLAGS) $(CFGFLAGS)
    112 
    113 
    114 STD_CPPFLAGS = ${STD_CFLAGS}
    115 STD_CXXFLAGS = ${STD_CFLAGS}
    116 
    117 ifndef BCM_CFLAGS
    118 BCM_CFLAGS   = -Wall -Werror
    119 endif
    120 
    121 BCM_CPPFLAGS = ${BCM_CFLAGS}
    122 BCM_CXXFLAGS = ${BCM_CFLAGS}
    123 
    124 ifeq (${ORIGIN}, Broadcom)
    125 	CFLAGS   += ${STD_CFLAGS}   ${BCM_CFLAGS}   ${OPT_CFLAGS}
    126 	CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
    127 	CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
    128 else
    129 	CFLAGS   += ${STD_CFLAGS}   ${OPT_CFLAGS}
    130 	CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
    131 	CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
    132 endif
    133 
    134 #
    135 # Ignore pedantic flag for kernel modules
    136 #
    137 ifdef DEBUG_PEDANTIC
    138 DEBUG_PEDANTIC = FALSE
    139 endif
    140 
    141 #
    142 # DEPEND is used as a command to generate the list of dependencies.
    143 # The format of the output must be 
    144 #	"file.o : file.c a/b/c.h d/e/f.h ...", 
    145 # if it is on multiple lines, each line must end in a backslash. 
    146 # The output MUST be on standard out.
    147 #
    148 DEPEND = ${CC} -M $(CFLAGS) $<