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


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