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-4_4 (4485B)


      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 OSTYPE = LINUX
     69 
     70 #
     71 # ORIGIN is used to Optionally select different CFLAGS. It is used to import
     72 # source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
     73 # to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
     74 # added.
     75 #
     76 # Default specifies Broadcom
     77 #
     78 ifndef ORIGIN
     79 	ORIGIN = Broadcom
     80 endif
     81 
     82 #
     83 # STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
     84 # BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
     85 # OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of 
     86 #			 this Makefile, to define local "Extra" flags.
     87 #
     88 ifdef IPROC_BUILD
     89 CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
     90 	    -I$(SDK)/systems/bde/linux/include \
     91 	    -I$(LINUX_INCLUDE) \
     92 	    -I$(LINUX_INCLUDE)/uapi \
     93 	    -I$(LINUX_INCLUDE)/generated/uapi \
     94 	    -I$(KERNDIR)/arch/$(ARCH) \
     95 	    -I$(KERNDIR)/arch/$(ARCH)/include/uapi \
     96 	    -I$(KERNDIR)/arch/$(ARCH)/include/generated \
     97 	    -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
     98 else
     99 CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
    100 	    -I$(SDK)/systems/bde/linux/include \
    101 	    -I$(LINUX_INCLUDE) \
    102 	    -I$(LINUX_INCLUDE)/asm/gcc \
    103 	    -I$(LINUX_INCLUDE)/asm/mach-generic \
    104 	    -I$(LINUX_INCLUDE)/uapi \
    105 	    -I$(LINUX_INCLUDE)/generated/uapi \
    106 	    -I$(KERNDIR)/arch/$(ARCH) \
    107 	    -I$(KERNDIR)/arch/$(ARCH)/include/uapi \
    108 	    -I$(KERNDIR)/arch/$(ARCH)/include/generated \
    109 	    -I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
    110 endif
    111 
    112 CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE
    113 
    114 CFGFLAGS += -D$(OSTYPE)
    115 
    116 # No user sal for the linux kernel
    117 # NO_SAL_APPL=1
    118 
    119 STD_CFLAGS = $(KFLAGS) $(CFGFLAGS)
    120 
    121 
    122 STD_CPPFLAGS = ${STD_CFLAGS}
    123 STD_CXXFLAGS = ${STD_CFLAGS}
    124 
    125 ifndef BCM_CFLAGS
    126 BCM_CFLAGS   = -Wall -Werror
    127 endif
    128 
    129 BCM_CPPFLAGS = ${BCM_CFLAGS}
    130 BCM_CXXFLAGS = ${BCM_CFLAGS}
    131 
    132 ifeq (${ORIGIN}, Broadcom)
    133 	CFLAGS   += ${STD_CFLAGS}   ${BCM_CFLAGS}   ${OPT_CFLAGS}
    134 	CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
    135 	CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
    136 else
    137 	CFLAGS   += ${STD_CFLAGS}   ${OPT_CFLAGS}
    138 	CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
    139 	CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
    140 endif
    141 
    142 #
    143 # Ignore pedantic flag for kernel modules
    144 #
    145 ifdef DEBUG_PEDANTIC
    146 DEBUG_PEDANTIC = FALSE
    147 endif
    148 
    149 #
    150 # DEPEND is used as a command to generate the list of dependencies.
    151 # The format of the output must be 
    152 #	"file.o : file.c a/b/c.h d/e/f.h ...", 
    153 # if it is on multiple lines, each line must end in a backslash. 
    154 # The output MUST be on standard out.
    155 #
    156 DEPEND = ${CC} -M $(CFLAGS) $<
    157