sonic-buildimage/platform/broadcom/saibcm-modules/make/Make.config
Mahesh Maddikayala bc2a13136a [BCMSAI] Update BCMSAI debian to 4.3.0.10 with 6.5.21 SDK, and opennsl module to 6.5.21 (#6526)
BCMSAI 4.3.0.10, 6.5.21 SDK release with enhancements and fixes for vxlan, TD3 MMU, TD4-X9 EA support, etc.
2021-02-05 16:08:04 -08:00

372 lines
8.9 KiB
Plaintext

#
# Copyright 2007-2020 Broadcom Inc. All rights reserved.
#
# Permission is granted to use, copy, modify and/or distribute this
# software under either one of the licenses below.
#
# License Option 1: GPL
#
# 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.
#
#
# License Option 2: Broadcom Open Network Switch APIs (OpenNSA) license
#
# This software is governed by the Broadcom Open Network Switch APIs license:
# https://www.broadcom.com/products/ethernet-connectivity/software/opennsa
#
# $Id: Make.config,v 1.3 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
ifneq ($(strip $(override-target)),)
override TARGET=$(override-target)
endif
export TARGET
#
# Set up the target name, and the target base variables.
#
# target = The full name of the target such as vxworks-bmw
# targetbase = 1st part of target (e.g. vxworks)
# targetplat = 2nd part of target (e.g. x86) if any; otherwise same as 1st
#
target = ${TARGET}
targetsplt = $(subst -, , ${target}) # change hyphens to spaces
targetbase = $(word 1,${targetsplt})
targetplat = $(subst ${targetbase}-,,${TARGET})
#
# Common configuration for all platforms
# (Additional platform-dependent configurations are in Makefile.xxx)
#
#
# THIS FILE SHOULD NOT BE MODIFIED LOCALLY, to override, add a file
# $SDK/make/Make.local that sets your local settings, and/or provide
# a path to your settings using the MAKE_LOCAL variable. If
# either of these files exists, their values will override those in this makefile.
#
ifdef MAKE_LOCAL
-include ${MAKE_LOCAL}
endif
-include ${SDK}/make/Make.local
ifdef ALL_CHIPS
ESW_CHIPS = 1
endif # ALL_CHIPS
#
# By default, turn off the "changing directory" message.
#
MAKEFLAGS += --no-print-directory
#
# Use gmake by default
#
include ${SDK}/make/Make.tools
include ${SDK}/make/Makefile.${target}
# use QUIET=1 to control printing of compilation lines
ifdef QUIET
Q:=@
else
Q:=
endif
#
# Suffix to add to the "target" files to allow local builds with different
# flags. Set "target_suffix" to XXX to cause the build to put built objects
# in ${target}${target_suffix}. This allows things like building a debug
# version with different flags. This may also be set in another Makefile.
#
#target_suffix :=
#
# Optional suffix to add to the build directory and output binary files
# to allow multiple builds to co-exist for various reasons.
#
#chip_suffix := -$(shell echo $(CHIP) | tr A-Z a-z)
#
# Combined suffixes
#
all_suffix = ${chip_suffix}${target_suffix}
#
# Default location to place binaries and make depend files for building
# purposes.
#
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDROOTWITHDRIVE = ${SDK}/build/${target}${all_suffix}${bldroot_suffix}
BLDROOT = ${SDK_NO_DRIVE_NAME}/build/${target}${all_suffix}${bldroot_suffix}
else # ifeq "$(HOSTTYPE)" "Windows2000PC"
ifndef SDKBUILD
SDKBUILD :=build
endif
BLDROOT = ${SDK}/${SDKBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${target}${all_suffix}${bldroot_suffix}
endif # ifeq "$(HOSTTYPE)" "Windows2000PC"
# This is needed because we cannot include Make.vxworks before Make.config
ifndef DEST_DIR_SUFFIX
export DEST_DIR_SUFFIX :=$(subst $(realpath $(SDK))/systems,,$(realpath $(CURDIR)/$(dir ($(firstword $(MAKEFILE_LIST))))))
ifeq ($(MAKELEVEL),0)
endif
endif
ifeq ($(DEST_DIR),)
export DEST_DIR :=${SDK}/${SDKBUILD}$(if ${BLDCONFIG},/${BLDCONFIG})$(DEST_DIR_SUFFIX)
endif
ifdef LOCALDIR
BLDDIR = ${BLDROOT}/${LOCALDIR}
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE}/${LOCALDIR}
endif
else # ifdef LOCALDIR
BLDDIR = ${BLDROOT}
ifeq "$(HOSTTYPE)" "Windows2000PC"
BLDDIRWITHDRIVE = ${BLDROOTWITHDRIVE}
endif
endif # ifdef LOCALDIR
LIBDIR = ${BLDROOT}
#
# Export directory, where build objects used by the outside world are
# placed (exported header files, libs, bins)
#
EXPDIR = ${SDK}/export/${target}${all_suffix}
#
# Standard include paths
#
INCDIR = ${SDK}/include
#
# Compilation Flags
#
# Flags may be added to (see below)
#
INCFLAGS = -I${INCDIR} -I${SDK}/systems
CFLAGS += ${INCFLAGS}
CXXFLAGS += ${INCFLAGS}
CPPFLAGS += ${INCFLAGS}
CFLAGS += -DSAI_FIXUP -UKCOM_FILTER_MAX -DKCOM_FILTER_MAX=1024
#
# Debug #ifdef control
#
# Compiling out #ifdef DEBUG code saves about 1.3% on executable size.
# It is recommended to leave debug enabled when developing applications.
#
ifndef DEBUG_IFDEFS
DEBUG_IFDEFS=TRUE
endif
ifeq ($(DEBUG_IFDEFS),TRUE)
CFLAGS += -DBROADCOM_DEBUG
CXXFLAGS += -DBROADCOM_DEBUG
CPPFLAGS += -DBROADCOM_DEBUG
endif
#
# Debug symbol information control
#
ifndef DEBUG_SYMBOLS
DEBUG_SYMBOLS=TRUE
endif
ifeq ($(DEBUG_SYMBOLS),TRUE)
CFLAGS += -g
CXXFLAGS += -g
CPPFLAGS += -g
endif
#
# If DEBUG_CFLAGS is set, add its contents to CFLAGS.
# May be useful for setting on the command line or adding to Make.local.
# Example: gmake DEBUG_CFLAGS=-save-temps system.c
#
ifneq ($(DEBUG_CFLAGS),)
CFLAGS += $(DEBUG_CFLAGS)
CXXFLAGS += $(DEBUG_CFLAGS)
CPPFLAGS += $(DEBUG_CFLAGS)
endif
#
# Optimization level
#
# Set DEBUG_OPTIMIZE to TRUE (default) to use a normal optimization
# determined by OPTFLAGS_DEFAULT in the platform Makefile.
# Set DEBUG_OPTIMIZE to FALSE to use no optimization,
# strongly recommended when using any debugger.
# Set DEBUG_OPTIMIZE to any other option string to request specific
# optimization flags (for example -O2).
#
ifndef DEBUG_OPTIMIZE
DEBUG_OPTIMIZE=TRUE
endif
ifeq ($(DEBUG_OPTIMIZE),TRUE)
OPTFLAGS += $(OPTFLAGS_DEFAULT)
else
ifneq ($(DEBUG_OPTIMIZE),FALSE)
OPTFLAGS += $(DEBUG_OPTIMIZE)
endif
endif
#
# Debug assertion control.
#
# Compiling out assert() saves about 1.1% on executable size,
# however doing so is VERY MUCH discouraged.
#
ifndef DEBUG_ASSERTS
DEBUG_ASSERTS=TRUE
endif
ifeq ($(DEBUG_ASSERTS),FALSE)
CFLAGS += -DNDEBUG
CXXFLAGS += -DNDEBUG
CPPFLAGS += -DNDEBUG
endif
#
# GCC pedantic mode.
#
ifeq ($(DEBUG_PEDANTIC),TRUE)
CFGFLAGS += -D__PEDANTIC__
CFLAGS += --pedantic
CXXFLAGS += --pedantic
endif
#
# In each directory, build a list of local sources, objects, and headers
#
LSRCS = $(wildcard *.c *.cpp *.s *.cc *.C)
LOBJS = $(addsuffix .o, $(basename ${LSRCS}))
BOBJS = $(addprefix ${BLDDIR}/,${LOBJS})
LHDRS = $(wildcard *.h *.H)
LDOTIS = $(wildcard *.i)
#
# Rule to create object file (build) directory
#
.PHONY: all install clean distclean
.PRECIOUS: ${BLDDIR}/.tree
%/.tree:
@$(ECHO) 'Creating build directory $(dir $@)'
@$(MKDIR) $(dir $@)
@$(ECHO) "Build Directory for ${LOCALDIR} Created" > $@
# Rule allowing build through CPP only, creates .E file from .c file.
%.E: %.c
$Q${CC} -E ${CFLAGS} $< | sed -e '/^ *$$/d' -e p -e d > $@
# Rule allowing build through source only, creates .s file from .c file.
%.s: %.c
$Q${CC} -S ${CFLAGS} $<
#
# Default Build rules for .c --> .o, leaving the binary in BLDDIR/X.o,
# even if file not built from directory of source.
#
ifeq ($(FAST),1)
${BLDDIR}/%.o: %.c
else
ifdef GENERATE_C_FILES
${BLDDIR}/%.o: %.c
else
${BLDDIR}/%.o: %.c
endif
endif
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
ifdef LOCAL_D_FILE
$Q$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< --write-user-dependencies
-@/bin/cp $*.d $(BLDDIR)/$*.d
-@/bin/rm -f $*.d
else
$Q$(CC) -MD -MF $(BLDDIR)/$*.d $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
endif
@/bin/cp $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp;\
/bin/sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' \
< $(BLDDIR)/$*.d >> $(BLDDIR)/$*.tmp; \
/bin/sed \
-e 's| \([0-9a-zA-Z]\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \
-e 's|^\([0-9a-zA-Z]\)|'$(SDK)/$(LOCALDIR)'/\1|g' \
-e 's| \(\.\.\/\)| '$(SDK)/$(LOCALDIR)'\/\1|g' \
-e 's|'$(SDK)'|'$$\{SDK\}'|g' \
-e 's/\w*\/\.\.\/*//g' \
-e 's/\w*\/\.\.\/*//g' \
-e 's/\w*\/\.\.\/*//g' \
< $(BLDDIR)/$*.tmp > $(BLDDIR)/$*.P; \
/bin/rm -f $(BLDDIR)/$*.d $(BLDDIR)/$*.tmp
${BLDDIR}/%.o: %.s
ifdef QUIET
@${ECHO} Assembling ${LOCALDIR}/$<
endif
$Q${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c $< -o $@
${BLDDIR}/%.o: %.cpp
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
$Q${CXX} -c ${CXXFLAGS} -c $< -o $@
${BLDDIR}/%.o: %.cc ${BLDDIR}/.tree
ifdef QUIET
@${ECHO} Compiling ${LOCALDIR}/$<
endif
$Q${CXX} -c ${CXXFLAGS} -c $< -o $@
#
# Cause "make foo.o" in any subdirectory to put the object in the build
# directory instead of the local directory.
#
%.o: ${BLDDIR}/%.o
@
#
# List of directories where built objects live.
# (we are not making the export directories for now)
#
#DIRS = ${BLDDIR} ${EXPDIR}/lib ${EXPDIR}/bin ${EXPDIR}/include
DIRS = ${BLDDIR}
ifeq (C_COMPILER,$(MAKECMDGOALS))
C_COMPILER:
@echo $(CC)
endif