2020-11-12 12:22:38 -06: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-08-27 01:13:37 -05:00
|
|
|
PYTHON ?= python3
|
2020-11-12 12:22:38 -06:00
|
|
|
|
|
|
|
PACKAGE_PRE_NAME := sonic-platform-pddf
|
|
|
|
KVERSION ?= $(shell uname -r)
|
|
|
|
KERNEL_SRC := /lib/modules/$(KVERSION)
|
|
|
|
MOD_SRC_DIR:= $(shell pwd)
|
2023-02-02 13:20:59 -06:00
|
|
|
MODULE_DIRS:= client cpld cpld/driver cpldmux cpldmux/driver fpgai2c fpgai2c/driver fan fan/driver mux gpio led psu psu/driver sysstatus xcvr xcvr/driver
|
2020-11-12 12:22:38 -06:00
|
|
|
MODULE_DIR:= modules
|
|
|
|
UTILS_DIR := utils
|
|
|
|
SERVICE_DIR := service
|
|
|
|
|
|
|
|
%:
|
|
|
|
echo =================RUNNING $@=============
|
|
|
|
dh $@ --with systemd,python2,python3 --buildsystem=pybuild
|
|
|
|
|
|
|
|
clean:
|
|
|
|
echo ============CLEANING=================
|
|
|
|
dh_testdir
|
|
|
|
dh_testroot
|
|
|
|
dh_clean
|
|
|
|
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR) clean
|
|
|
|
|
|
|
|
build:
|
2022-01-03 00:24:19 -06:00
|
|
|
set -e; \
|
2020-11-12 12:22:38 -06:00
|
|
|
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR); \
|
|
|
|
$(PYTHON) $(MOD_SRC_DIR)/setup.py build; \
|
2022-01-03 00:24:19 -06:00
|
|
|
set +e
|
2020-11-12 12:22:38 -06:00
|
|
|
|
|
|
|
binary: binary-arch binary-indep
|
|
|
|
# Nothing to do
|
|
|
|
|
|
|
|
binary-arch:
|
|
|
|
# Nothing to do
|
|
|
|
|
|
|
|
binary-indep:
|
|
|
|
dh_testdir
|
|
|
|
dh_installdirs
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME) $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
|
|
|
dh_installdirs -p$(PACKAGE_PRE_NAME) usr/local/bin; \
|
|
|
|
# Custom package commands
|
2022-01-03 00:24:19 -06:00
|
|
|
set -e; \
|
2020-11-12 12:22:38 -06:00
|
|
|
(for mod in $(MODULE_DIRS); do \
|
|
|
|
cp $(MOD_SRC_DIR)/$(MODULE_DIR)/$${mod}/*.ko debian/$(PACKAGE_PRE_NAME)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
|
|
|
|
done) ; \
|
2022-01-03 00:24:19 -06:00
|
|
|
# Need to take a backup of symvers file for compilation of custom modules in various platforms
|
|
|
|
cp $(MOD_SRC_DIR)/Module.symvers $(MOD_SRC_DIR)/Module.symvers.PDDF; \
|
2020-11-12 12:22:38 -06:00
|
|
|
cp -r $(MOD_SRC_DIR)/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)/usr/local/bin/; \
|
2022-01-03 00:24:19 -06:00
|
|
|
$(PYTHON) $(MOD_SRC_DIR)/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME) --install-layout=deb; \
|
|
|
|
set +e
|
2020-11-12 12:22:38 -06:00
|
|
|
|
|
|
|
# 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
|