nct6687d/Makefile

73 lines
2.4 KiB
Makefile
Raw Normal View History

2020-11-08 00:19:03 +01:00
obj-m += nct6687.o
2023-01-04 18:52:38 +01:00
curpwd := $(shell pwd)
kver := $(shell uname -r)
commitcount := $(shell git rev-list --all --count)
commithash := $(shell git rev-parse --short HEAD)
2020-11-08 00:19:03 +01:00
2022-02-12 20:12:07 +01:00
build:
rm -rf ${curpwd}/${kver}
mkdir -p ${curpwd}/${kver}
2022-02-12 20:12:07 +01:00
cp ${curpwd}/Makefile ${curpwd}/nct6687.c ${curpwd}/${kver}
cd ${curpwd}/${kver}
make -C /lib/modules/${kver}/build M=${curpwd}/${kver} modules
install: build
sudo cp ${curpwd}/${kver}/nct6687.ko /lib/modules/${kver}/kernel/drivers/hwmon/
2020-11-08 00:19:03 +01:00
sudo depmod
sudo modprobe nct6687
clean:
[ -d "${curpwd}/${kver}" ] && make -C /lib/modules/${kver}/build M=${curpwd}/${kver} clean
2022-02-22 11:11:27 +01:00
2023-01-04 18:52:38 +01:00
akmod/build:
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y rpmdevtools kmodtool
mkdir -p ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d
cp LICENSE Makefile nct6687.c ${curpwd}/.tmp/nct6687d-1.0.${commitcount}/nct6687d
cd .tmp && tar -czvf nct6687d-1.0.${commitcount}.tar.gz nct6687d-1.0.${commitcount} && cd -
mkdir -p ${curpwd}/.tmp/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp ${curpwd}/.tmp/nct6687d-1.0.${commitcount}.tar.gz ${curpwd}/.tmp/rpmbuild/SOURCES/
echo 'nct6687' | tee ${curpwd}/.tmp/rpmbuild/SOURCES/nct6687.conf
cp fedora/*.spec ${curpwd}/.tmp/rpmbuild/SPECS/
sed -i "s/MAKEFILE_PKGVER/${commitcount}/g" ${curpwd}/.tmp/rpmbuild/SPECS/*
sed -i "s/MAKEFILE_COMMITHASH/${commithash}/g" ${curpwd}/.tmp/rpmbuild/SPECS/*
rpmbuild -ba --define "_topdir ${curpwd}/.tmp/rpmbuild" ${curpwd}/.tmp/rpmbuild/SPECS/nct6687d.spec
rpmbuild -ba --define "_topdir ${curpwd}/.tmp/rpmbuild" ${curpwd}/.tmp/rpmbuild/SPECS/nct6687d-kmod.spec
akmod/install: akmod/build
sudo dnf install ${curpwd}/.tmp/rpmbuild/RPMS/*/*.rpm
akmod/clean:
sudo dnf remove nct6687d
rm -rf .tmp
akmod: akmod/install
2022-04-22 17:55:20 +02:00
dkms/build:
make -C /lib/modules/${kver}/build M=${curpwd} modules
dkms/install:
rm -rf ${curpwd}/dkms
mkdir -p ${curpwd}/dkms
cp ${curpwd}/dkms.conf ${curpwd}/Makefile ${curpwd}/nct6687.c ${curpwd}/dkms
2022-04-22 18:20:53 +02:00
sudo rm -rf /usr/src/nct6687d-1
2022-04-22 17:55:20 +02:00
sudo cp -rT dkms /usr/src/nct6687d-1
sudo dkms install nct6687d/1
sudo modprobe nct6687
dkms/clean:
2022-07-17 11:18:45 +02:00
sudo dkms remove nct6687d/1 --all
2022-04-22 17:55:20 +02:00
make -C /lib/modules/${kver}/build M=${curpwd} clean
2022-02-22 11:11:27 +01:00
debian/changelog: FORCE
git --no-pager log \
--format='nct6687d-dkms (%ad) unstable; urgency=low%n%n * %s%n%n -- %aN <%aE> %aD%n' \
--date='format:%Y%m%d-%H%M%S' \
> $@
deb: debian/changelog
2023-01-04 18:52:38 +01:00
sudo apt install -y debhelper dkms
2022-02-22 11:11:27 +01:00
dpkg-buildpackage -b -rfakeroot -us -uc
.PHONY: FORCE
2022-04-22 17:55:20 +02:00
FORCE: