sonic-buildimage/platform/broadcom/saibcm-modules/make/Makefile.linux-kernel-4_4
Guohan Lu aa2e340f5a [broadcom]: build broadcom kernel modules from gpl source codes
Signed-off-by: Guohan Lu <gulv@microsoft.com>
2018-08-11 09:09:03 +00:00

159 lines
4.6 KiB
Makefile

#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Makefile.linux-kernel-2_6,v 1.40 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
# Configuration Flags
# Filter out features that cannot or should not be supported in kernel mode
_FEATURE_EXCLUDE_LIST += EDITLINE TCL OOB_RCPU CINT APIMODE DUNE_UI C_UNIT
FEATURE_EXCLUDE_LIST = $(sort $(_FEATURE_EXCLUDE_LIST))
# Tools
# Conditionally Replaces DEFAULT var
ifeq ($(origin CC),default)
CC = $(LSRUN) $(CROSS_COMPILE)gcc
endif
ifeq ($(origin CXX),default)
CXX = $(CROSS_COMPILE)g++
endif
ifeq ($(origin LD),default)
LD = $(CROSS_COMPILE)ld
endif
ifeq ($(origin AR),default)
AR = $(CROSS_COMPILE)ar
endif
ifeq ($(origin AS),default)
AS = $(CROSS_COMPILE)as
endif
ifeq ($(origin ARFLAGS),default)
ARFLAGS = -rc
endif
STRIP = $(CROSS_COMPILE)strip
RANLIB = $(CROSS_COMPILE)ranlib
OBJCOPY = $(CROSS_COMPILE)objcopy
NM = $(CROSS_COMPILE)nm
# Handle differences between gcc 2.x and gcc 3.x
gcc-tune-flag = $(shell if ${CC} -dumpspecs | grep mcpu >/dev/null; then echo cpu; else echo tune; fi)
# Configuration Variables
# OSType Defines: This defines the type of RTOS or microkernel which you
# are compiling the SAL (and its associated driver) for. New platforms
# can be created by porting the routines (system.c) to your platform and
# adding the define in this Makefile.
OSTYPE = LINUX
#
# ORIGIN is used to Optionally select different CFLAGS. It is used to import
# source from other vendors. If SOURCE=Broadcom, then the BCM_ flags are added
# to those passed to the compiler. If SOURCE != Broadcom, BCM_ flags are NOT
# added.
#
# Default specifies Broadcom
#
ifndef ORIGIN
ORIGIN = Broadcom
endif
#
# STD_{C|CPP|CXX}FLAGS - Standard flags used by ALL compilations
# BCM_{C|CPP|CXX}FLAGS - Flags used for Broadcom source files
# OPT_{C|CPP|CXX}FLAGS - Defined in local make files BEFORE inclusion of
# this Makefile, to define local "Extra" flags.
#
ifdef IPROC_BUILD
CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
-I$(SDK)/systems/bde/linux/include \
-I$(LINUX_INCLUDE) \
-I$(LINUX_INCLUDE)/uapi \
-I$(LINUX_INCLUDE)/generated/uapi \
-I$(KERNDIR)/arch/$(ARCH) \
-I$(KERNDIR)/arch/$(ARCH)/include/uapi \
-I$(KERNDIR)/arch/$(ARCH)/include/generated \
-I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
else
CFGFLAGS += -I$(SDK)/systems/linux/kernel/modules/include \
-I$(SDK)/systems/bde/linux/include \
-I$(LINUX_INCLUDE) \
-I$(LINUX_INCLUDE)/asm/gcc \
-I$(LINUX_INCLUDE)/asm/mach-generic \
-I$(LINUX_INCLUDE)/uapi \
-I$(LINUX_INCLUDE)/generated/uapi \
-I$(KERNDIR)/arch/$(ARCH) \
-I$(KERNDIR)/arch/$(ARCH)/include/uapi \
-I$(KERNDIR)/arch/$(ARCH)/include/generated \
-I$(KERNDIR)/arch/$(ARCH)/include/generated/uapi
endif
CFGFLAGS += -DNO_FILEIO -DNO_CTRL_C -DNO_MEMTUNE
CFGFLAGS += -D$(OSTYPE)
# No user sal for the linux kernel
# NO_SAL_APPL=1
STD_CFLAGS = $(KFLAGS) $(CFGFLAGS)
STD_CPPFLAGS = ${STD_CFLAGS}
STD_CXXFLAGS = ${STD_CFLAGS}
ifndef BCM_CFLAGS
BCM_CFLAGS = -Wall -Werror
endif
BCM_CPPFLAGS = ${BCM_CFLAGS}
BCM_CXXFLAGS = ${BCM_CFLAGS}
ifeq (${ORIGIN}, Broadcom)
CFLAGS += ${STD_CFLAGS} ${BCM_CFLAGS} ${OPT_CFLAGS}
CPPFLAGS += ${STD_CPPFLAGS} ${BCM_CPPFLAGS} ${OPT_CPPFLAGS}
CXXFLAGS += ${STD_CXXFLAGS} ${BCM_CXXFLAGS} ${OPT_CXXFLAGS}
else
CFLAGS += ${STD_CFLAGS} ${OPT_CFLAGS}
CPPFLAGS += ${STD_CPPFLAGS} ${OPT_CPPFLAGS}
CXXFLAGS += ${STD_CXXFLAGS} ${OPT_CXXFLAGS}
endif
#
# Ignore pedantic flag for kernel modules
#
ifdef DEBUG_PEDANTIC
DEBUG_PEDANTIC = FALSE
endif
#
# DEPEND is used as a command to generate the list of dependencies.
# The format of the output must be
# "file.o : file.c a/b/c.h d/e/f.h ...",
# if it is on multiple lines, each line must end in a backslash.
# The output MUST be on standard out.
#
DEPEND = ${CC} -M $(CFLAGS) $<