blob: 5e0dfd68b2243cc5d3acf87f1d7f967f0335664f [file] [log] [blame]
# Switch SDK for KT2
#
ifneq ("$(TEST_SW_UTIL_LOOPBACK)", "y")
MOD_NAME = switch_sdk
MOD_TYPE = lib
MOD_INC_DIRS = $(ING_SDK_DIR)/include
MOD_INC_DIRS += $(ING_SDK_DIR)/libs/phymod/include
MOD_LIBS_NOREC_BEFORE = $(shell cat ${ING_SDK_DIR}/.bcm_objs)
MOD_LIBS = $(shell cat ${ING_SDK_DIR}/.bcm_libs)
MOD_LIBS_NOREC_AFTER = $(shell cat ${ING_SDK_DIR}/.bcm_ldflags | sed -e 's/-static //') -lutil
# Building with libnetconf requires special care because libxml in bcm_sdk conflicts
# with newer libxml2
ifeq ("$(NC_AGENT)", "libnetconf")
MOD_LIBS := $(subst -lxml,,$(MOD_LIBS))
# This is tricky again. SDK build can include multiple versions of xml_api.o
# built for different architectures. We need to pick the right one.
_all_xml_api := $(shell find $(ING_SDK_DIR) -name xml_api.o)
_arch := $(shell file $(firstword $(MOD_LIBS_NOREC_BEFORE)) | awk '{print $$7}')
_xml_api := $(shell for aa in $(_all_xml_api); do _test_arch=`file $$aa | awk '{print $$7}'`; if [[ \"$(_arch)\" = \"$$_test_arch\" ]]; then echo $$aa; fi; done)
MOD_LIBS_NOREC_AFTER += $(_xml_api)
endif
# end of ifneq ("$(TEST_SW_UTIL_LOOPBACK)", "y")
endif