2019-11-06 20:54:05 -06:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
export INSTALL_MOD_DIR:=extra
|
|
|
|
|
2020-09-16 12:34:49 -05:00
|
|
|
PACKAGE_PRE_NAME := sonic-platform-modules-bfn-newport
|
2019-11-06 20:54:05 -06:00
|
|
|
KVERSION ?= $(shell uname -r)
|
|
|
|
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
|
|
MODULE_SRC := $(shell pwd)/modules
|
|
|
|
SCRIPT_SRC := $(shell pwd)/scripts
|
|
|
|
CONFIGS_SRC := $(shell pwd)/configs
|
2020-10-03 15:46:21 -05:00
|
|
|
BUILD_DIR := $(shell pwd)/build
|
|
|
|
WHEEL_BUILD_DIR := $(BUILD_DIR)/wheel
|
2020-09-16 12:34:49 -05:00
|
|
|
MODULE_NAMES := as9516 as9516bf
|
2019-11-06 20:54:05 -06:00
|
|
|
|
|
|
|
%:
|
2022-01-16 13:25:44 -06:00
|
|
|
dh $@ --with python3
|
2019-11-06 20:54:05 -06:00
|
|
|
|
|
|
|
override_dh_auto_build:
|
|
|
|
make -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
|
2020-10-03 15:46:21 -05:00
|
|
|
set -e
|
|
|
|
python3 setup.py bdist_wheel -d $(WHEEL_BUILD_DIR)
|
2022-01-16 13:25:44 -06:00
|
|
|
set +e
|
2019-11-06 20:54:05 -06:00
|
|
|
|
|
|
|
override_dh_auto_install:
|
2020-09-16 12:34:49 -05:00
|
|
|
(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/; \
|
2020-10-03 15:46:21 -05:00
|
|
|
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/; \
|
2020-09-16 12:34:49 -05:00
|
|
|
done)
|
2019-11-06 20:54:05 -06:00
|
|
|
|
|
|
|
override_dh_usrlocal:
|
|
|
|
|
|
|
|
override_dh_pysupport:
|
|
|
|
|
|
|
|
override_dh_clean:
|
|
|
|
dh_clean
|
2022-01-16 13:25:44 -06:00
|
|
|
rm -fr $(WHEEL_BUILD_DIR)
|
|
|
|
rm -fr *.egg-info
|
2020-10-03 15:46:21 -05:00
|
|
|
rm -fr $(BUILD)
|
2019-11-06 20:54:05 -06:00
|
|
|
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
|
|
|
|
|