sonic-buildimage/platform/broadcom/saibcm-modules/make/Makefile.linux-kmodule
Judy Joseph 9c4c36e1b5 [broadom]: Upgrade broadcom SAI to 3.7.3.2
[Broadcom] : update saibcm-modules to sdk 6.5.16
[Broadcom SAI] : upgrade Broadcom SAI to 3.7.3.2
2019-12-19 06:28:38 +00:00

82 lines
2.7 KiB
Makefile

#
# Copyright 2017 Broadcom
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation (the "GPL").
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License version 2 (GPLv2) for more details.
#
# You should have received a copy of the GNU General Public License
# version 2 (GPLv2) along with this source code.
#
# $Id: Makefile.linux-kmodule-3_6,v 1.2 Broadcom SDK $
# $Copyright: (c) 2006 Broadcom Corp.
# All Rights Reserved.$
# Due to the extensive use of driver libraries, the SDK usually builds
# kernel modules from a precompiled object. To avoid various warnings
# and conflicts, the pre-compiled object must be named differently
# from the target module, and the object file itself should be
# appended with "_shipped".
# If a module exports any symbols, then the exporting source file must
# be compiled within the kernel source tree for correct generation of
# module symbol versions. The symbol source file should be passed to
# this Makefile via the MODULE_SYM variable.
MODULE := $(MOD_NAME).o
KMODULE := $(MOD_NAME).ko
PRE_COMPILED_OBJ := obj_$(MOD_NAME).o
obj-m := $(MODULE)
$(MOD_NAME)-y := $(MODULE_SYM) $(PRE_COMPILED_OBJ)
ifeq (,$(CROSS_COMPILE))
export CROSS_COMPILE
endif
SAVE_CFLAGS := ${CFLAGS}
include $(SDK)/make/Make.config
PWD := $(shell pwd)
ifneq ($(ARCH),)
# ELDK does not seem to `automatically' define ARCH where other gccs may
A := ARCH=$(ARCH)
export ARCH
endif
# Provide an option in case kernel was built in separate directory
KERNBLDDIR ?= $(KERNDIR)
# Standard SDK include path for building source files that export
# kernel symbols.
override EXTRA_CFLAGS = -I${SDK}/include -I${SDK}/systems/linux/kernel/modules/include -I${SDK}/systems/bde/linux/include
# The precopiled object needs a dummy command file to avoid warnings
# from the Kbuild scripts (modpost stage).
# Kernels before 2.6.17 do not support external module symbols files,
# so we create a dummy to prevent build failures.
$(KMODULE):
rm -f *.o *.ko .*.cmd
rm -fr .tmp_versions
ln -s $(LIBDIR)/$(MODULE) $(PRE_COMPILED_OBJ)_shipped
if [ ! -f $(KERNBLDDIR)/NO_SUPRESS ]; then echo "# suppress warning" > .$(PRE_COMPILED_OBJ).cmd; fi
$(MAKE) -C $(KERNBLDDIR) CROSS_COMPILE=$(CROSS_COMPILE) M=$(PWD) modules
if [ ! -f Module.symvers ]; then echo "old kernel (pre-2.6.17)" > Module.symvers; fi
cp -f $(KMODULE) $(LIBDIR)
rm -f $(PRE_COMPILED_OBJ)_shipped
EXTRA_CFLAGS = $(CFLAGS)
CFLAGS := ${SAVE_CFLAGS}