sonic-buildimage/platform/barefoot/sonic-platform-modules-bfn-newport/debian/rules
Volodymyr Boiko dbea3bbfd7
BFN platform API 2.0 support (#4766)
Added barefoot platform api 2.0 support

Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
2020-10-03 13:46:21 -07:00

53 lines
2.0 KiB
Makefile
Executable File

#!/usr/bin/make -f
export INSTALL_MOD_DIR:=extra
PACKAGE_PRE_NAME := sonic-platform-modules-bfn-newport
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MODULE_SRC := $(shell pwd)/modules
SCRIPT_SRC := $(shell pwd)/scripts
CONFIGS_SRC := $(shell pwd)/configs
BUILD_DIR := $(shell pwd)/build
WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel
PLUGINS_DIR := $(shell pwd)/plugins
MODULE_NAMES := as9516 as9516bf
%:
dh $@
override_dh_auto_build:
make -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
set -e
python2.7 setup.py bdist_wheel -d $(WHEEL_BUILD_DIR)
python3 setup.py bdist_wheel -d $(WHEEL_BUILD_DIR)
set +e
override_dh_auto_install:
(for mod in $(MODULE_NAMES); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MODULE_SRC)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \
cp -r $(SCRIPT_SRC)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/network/interfaces.d/; \
cp -r $(CONFIGS_SRC)/network/interfaces.d/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/network/interfaces.d/; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/; \
cp -r $(WHEEL_BUILD_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/plugins; \
cp -r $(PLUGINS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-accton_$${mod}_32d-r0/plugins/; \
done)
override_dh_usrlocal:
override_dh_pysupport:
override_dh_clean:
dh_clean
rm -fr $(WHEEL_BUILD_DIR)
rm -fr *.egg-info
rm -fr $(BUILD)
rm -f $(MODULE_SRC)/*.o $(MODULE_SRC)/*.ko $(MODULE_SRC)/*.mod.c $(MODULE_SRC)/.*.cmd
rm -f $(MODULE_SRC)/Module.markers $(MODULE_SRC)/Module.symvers $(MODULE_SRC)/modules.order
rm -rf $(MODULE_SRC)/.tmp_versions