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_18 (3950B)


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