2018-08-08 02:43:00 -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
|
|
|
|
|
2021-05-28 12:50:49 -05:00
|
|
|
PYTHON3 ?= python3
|
2018-08-08 02:43:00 -05:00
|
|
|
|
|
|
|
PACKAGE_PRE_NAME := sonic-platform-accton
|
|
|
|
KVERSION ?= $(shell uname -r)
|
|
|
|
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
|
|
MOD_SRC_DIR:= $(shell pwd)
|
2019-07-18 09:30:22 -05:00
|
|
|
MODULE_DIRS := as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x
|
2021-02-25 12:47:38 -06:00
|
|
|
MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe as4630-54te minipack as5812-54x
|
2021-05-11 21:06:36 -05:00
|
|
|
MODULE_DIRS += as5835-54x as9716-32d as9726-32d as5835-54t as7312-54xs as7315-27xb as5812-54t
|
2018-08-08 02:43:00 -05:00
|
|
|
MODULE_DIR := modules
|
|
|
|
UTILS_DIR := utils
|
|
|
|
SERVICE_DIR := service
|
|
|
|
CONF_DIR := conf
|
|
|
|
|
|
|
|
%:
|
2021-09-28 13:26:50 -05:00
|
|
|
dh $@ --with systemd,python3 --buildsystem=pybuild
|
2018-08-08 02:43:00 -05:00
|
|
|
|
|
|
|
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-09-28 13:26:50 -05:00
|
|
|
$(PYTHON3) $${mod}/setup.py build; \
|
2021-02-09 12:02:09 -06:00
|
|
|
cd $(MOD_SRC_DIR)/$${mod}; \
|
|
|
|
if [ -f sonic_platform_setup.py ]; then \
|
|
|
|
$(PYTHON3) sonic_platform_setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}; \
|
|
|
|
echo "Finished makig whl package for $$mod"; \
|
|
|
|
fi; \
|
|
|
|
cd $(MOD_SRC_DIR); \
|
2018-08-08 02:43:00 -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 \
|
2019-04-24 14:25:19 -05:00
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
|
2018-08-08 02:43:00 -05:00
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
|
|
|
|
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
|
2021-09-28 13:26:50 -05:00
|
|
|
$(PYTHON3) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
|
2018-08-08 02:43:00 -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
|