2018-10-10 20:33:51 -05:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
|
|
|
# Sample debian/rules that uses debhelper.
|
|
|
|
# This file was originally written by Joey Hess and Craig Small.
|
|
|
|
# As a special exception, when this file is copied by dh-make into a
|
|
|
|
# dh-make output file, you may use that output file without restriction.
|
|
|
|
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
|
|
|
|
|
|
|
include /usr/share/dpkg/pkg-info.mk
|
|
|
|
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
|
|
#export DH_VERBOSE=1
|
|
|
|
|
|
|
|
export INSTALL_MOD_DIR:=extra
|
|
|
|
|
|
|
|
PYTHON ?= python2
|
|
|
|
|
|
|
|
PACKAGE_PRE_NAME := sonic-platform-alphanetworks
|
|
|
|
KVERSION ?= $(shell uname -r)
|
|
|
|
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
|
|
MOD_SRC_DIR:= $(shell pwd)
|
2021-10-22 14:37:39 -05:00
|
|
|
MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f snj60d0-320f
|
2018-10-10 20:33:51 -05:00
|
|
|
MODULE_DIR := modules
|
|
|
|
UTILS_DIR := utils
|
|
|
|
SERVICE_DIR := service
|
|
|
|
CLASSES_DIR := classes
|
|
|
|
CONF_DIR := conf
|
|
|
|
|
|
|
|
%:
|
|
|
|
dh $@ --with systemd,python2,python3 --buildsystem=pybuild
|
|
|
|
|
|
|
|
clean:
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
|
|
|
dh_clean
|
|
|
|
|
|
|
|
build:
|
|
|
|
#make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
|
|
|
|
(for mod in $(MODULE_DIRS); do \
|
|
|
|
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
|
2021-10-22 14:37:39 -05:00
|
|
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
|
|
|
$(PYTHON) setup.py build; \
|
|
|
|
$(PYTHON) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
|
|
|
|
if [ $$mod = "snj60d0-320f" ]; then \
|
|
|
|
python3 setup.py build; \
|
|
|
|
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
|
|
|
|
fi; \
|
|
|
|
cd $(MOD_SRC_DIR); \
|
2018-10-10 20:33:51 -05:00
|
|
|
done)
|
|
|
|
|
|
|
|
binary: binary-arch binary-indep
|
|
|
|
# Nothing to do
|
|
|
|
|
|
|
|
binary-arch:
|
|
|
|
# Nothing to do
|
|
|
|
|
|
|
|
#install: build
|
|
|
|
#dh_testdir
|
|
|
|
#dh_testroot
|
|
|
|
#dh_clean -k
|
|
|
|
#dh_installdirs
|
|
|
|
|
|
|
|
binary-indep:
|
|
|
|
dh_testdir
|
|
|
|
dh_installdirs
|
|
|
|
|
|
|
|
# Custom package commands
|
|
|
|
(for mod in $(MODULE_DIRS); do \
|
2021-10-22 14:37:39 -05:00
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \
|
|
|
|
platform_name=`echo $${mod} | sed "s/-/_/g"`; \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
|
2018-10-10 20:33:51 -05:00
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
2021-10-22 14:37:39 -05:00
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.py debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
|
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.whl debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
|
2018-10-10 20:33:51 -05:00
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
|
2021-10-22 14:37:39 -05:00
|
|
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
|
|
|
$(PYTHON) setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
|
|
|
|
if [ $$mod = "snj60d0-320f" ]; then \
|
|
|
|
python3 setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
|
|
|
|
fi; \
|
|
|
|
cd $(MOD_SRC_DIR); \
|
2018-10-10 20:33:51 -05:00
|
|
|
done)
|
|
|
|
# Resuming debhelper scripts
|
|
|
|
dh_testroot
|
|
|
|
dh_install
|
|
|
|
dh_installchangelogs
|
|
|
|
dh_installdocs
|
|
|
|
dh_systemd_enable
|
|
|
|
dh_installinit
|
|
|
|
dh_systemd_start
|
|
|
|
dh_link
|
|
|
|
dh_fixperms
|
|
|
|
dh_compress
|
|
|
|
dh_strip
|
|
|
|
dh_installdeb
|
|
|
|
dh_gencontrol
|
|
|
|
dh_md5sums
|
|
|
|
dh_builddeb
|
|
|
|
.PHONY: build binary binary-arch binary-indep clean
|