2020-03-18 11:01:03 +01:00
|
|
|
#
|
|
|
|
# Copyright (c) 2018-2020 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
|
|
|
|
#
|
|
|
|
# This file is part of tuxedo-keyboard.
|
|
|
|
#
|
|
|
|
# tuxedo-keyboard is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This software is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this software. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#
|
2022-11-09 17:14:55 +01:00
|
|
|
obj-m := ./src/tuxedo_keyboard.o \
|
|
|
|
./src/clevo_wmi.o \
|
|
|
|
./src/clevo_acpi.o \
|
|
|
|
./src/tuxedo_io/tuxedo_io.o \
|
|
|
|
./src/uniwill_wmi.o
|
2022-08-24 10:57:20 +02:00
|
|
|
|
2018-06-08 11:56:32 +02:00
|
|
|
PWD := $(shell pwd)
|
2019-07-08 14:36:36 +02:00
|
|
|
KDIR := /lib/modules/$(shell uname -r)/build
|
2018-06-08 11:56:32 +02:00
|
|
|
|
|
|
|
all:
|
|
|
|
make -C $(KDIR) M=$(PWD) modules
|
|
|
|
|
|
|
|
clean:
|
|
|
|
make -C $(KDIR) M=$(PWD) clean
|
|
|
|
|
|
|
|
install:
|
|
|
|
make -C $(KDIR) M=$(PWD) modules_install
|
|
|
|
|
2020-04-17 12:17:13 +02:00
|
|
|
# Package version and name from dkms.conf
|
2020-05-19 16:06:57 +02:00
|
|
|
VER := $(shell sed -n 's/^PACKAGE_VERSION=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null)
|
|
|
|
MODULE_NAME := $(shell sed -n 's/^PACKAGE_NAME=\([^\n]*\)/\1/p' dkms.conf 2>&1 /dev/null)
|
2020-04-17 12:17:13 +02:00
|
|
|
|
|
|
|
dkmsinstall:
|
|
|
|
cp -R . /usr/src/$(MODULE_NAME)-$(VER)
|
|
|
|
dkms install -m $(MODULE_NAME) -v $(VER)
|
2018-06-08 11:56:32 +02:00
|
|
|
|
|
|
|
dkmsremove:
|
2020-04-17 12:17:13 +02:00
|
|
|
dkms remove -m $(MODULE_NAME) -v $(VER) --all
|
|
|
|
rm -rf /usr/src/$(MODULE_NAME)-$(VER)
|
2020-03-17 16:47:45 +01:00
|
|
|
|
|
|
|
# --------------
|
|
|
|
# Packaging only
|
|
|
|
# ---------------
|
|
|
|
|
|
|
|
DEB_PACKAGE_NAME := $(MODULE_NAME)-$(VER)
|
|
|
|
|
|
|
|
# Deb package folder variables
|
|
|
|
DEB_PACKAGE_BASE := deb/$(DEB_PACKAGE_NAME)
|
|
|
|
DEB_PACKAGE_SRC := $(DEB_PACKAGE_BASE)/usr/src/$(DEB_PACKAGE_NAME)
|
|
|
|
DEB_PACKAGE_CTRL := $(DEB_PACKAGE_BASE)/DEBIAN
|
|
|
|
|
|
|
|
package: package-deb package-rpm
|
|
|
|
package-clean: package-deb-clean package-rpm-clean
|
|
|
|
|
|
|
|
package-deb:
|
|
|
|
# Create/complete folder structure according to current version
|
|
|
|
rm -rf $(DEB_PACKAGE_BASE) || true
|
|
|
|
cp -rf deb/module-name $(DEB_PACKAGE_BASE)
|
|
|
|
mv $(DEB_PACKAGE_BASE)/usr/share/doc/module-name $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)
|
|
|
|
mkdir -p $(DEB_PACKAGE_BASE)/usr/src || true
|
|
|
|
mkdir -p $(DEB_PACKAGE_SRC) || true
|
|
|
|
mkdir -p $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME) || true
|
|
|
|
|
|
|
|
# Replace name/version numbers in control/script files
|
|
|
|
sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(DEB_PACKAGE_CTRL)/control
|
|
|
|
sed -i 's/^Package:[^\n]*/Package: $(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/control
|
|
|
|
sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/postinst
|
|
|
|
sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/postinst
|
|
|
|
sed -i 's/^version=[^\n]*/version=$(VER)/g' $(DEB_PACKAGE_CTRL)/prerm
|
|
|
|
sed -i 's/^module=[^\n]*/module=$(MODULE_NAME)/g' $(DEB_PACKAGE_CTRL)/prerm
|
|
|
|
# Copy source
|
|
|
|
cp -rf dkms.conf $(DEB_PACKAGE_SRC)
|
|
|
|
cp -rf Makefile $(DEB_PACKAGE_SRC)
|
|
|
|
cp -rf src $(DEB_PACKAGE_SRC)
|
|
|
|
cp -rf src_pkg/dkms_postinst $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst
|
2020-04-14 13:25:02 +02:00
|
|
|
cp -rf tuxedo_keyboard.conf $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf
|
2020-03-17 16:47:45 +01:00
|
|
|
# Make sure files and folders have acceptable permissions
|
|
|
|
chmod -R 755 $(DEB_PACKAGE_CTRL)
|
|
|
|
chmod 644 $(DEB_PACKAGE_CTRL)/control
|
|
|
|
find deb/$(DEB_PACKAGE_NAME)/usr -type d -exec chmod 755 {} \;
|
|
|
|
find deb/$(DEB_PACKAGE_NAME)/usr -type f -exec chmod 644 {} \;
|
|
|
|
chmod 755 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/postinst
|
2020-04-14 13:25:02 +02:00
|
|
|
chmod 644 $(DEB_PACKAGE_BASE)/usr/share/$(MODULE_NAME)/tuxedo_keyboard.conf
|
2020-03-17 16:47:45 +01:00
|
|
|
|
|
|
|
gunzip $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog.gz
|
|
|
|
gzip -n9 $(DEB_PACKAGE_BASE)/usr/share/doc/$(MODULE_NAME)/changelog
|
|
|
|
|
|
|
|
# Make deb package
|
|
|
|
dpkg-deb --root-owner-group -b $(DEB_PACKAGE_BASE) $(DEB_PACKAGE_NAME).deb
|
|
|
|
|
|
|
|
package-deb-clean:
|
|
|
|
rm -rf deb/$(MODULE_NAME)-* > /dev/null 2>&1 || true
|
|
|
|
rm *.deb > /dev/null 2>&1 || true
|
|
|
|
|
|
|
|
RPM_PACKAGE_NAME := $(MODULE_NAME)-$(VER)
|
|
|
|
RPM_PACKAGE_SRC := rpm/SOURCES/$(RPM_PACKAGE_NAME)
|
|
|
|
RPM_SPEC := rpm/SPECS/$(MODULE_NAME).spec
|
2020-05-19 16:06:57 +02:00
|
|
|
RELEASE := 1
|
2020-03-17 16:47:45 +01:00
|
|
|
|
|
|
|
package-rpm:
|
|
|
|
# Create folder source structure according to current version
|
|
|
|
rm -rf rpm || true
|
|
|
|
mkdir -p $(RPM_PACKAGE_SRC)
|
|
|
|
mkdir -p rpm/SPECS
|
|
|
|
# Copy spec template
|
|
|
|
cp -rf src_pkg/rpm_pkg.spec $(RPM_SPEC)
|
|
|
|
# Modify spec file with version etc.
|
|
|
|
sed -i 's/^%define module[^\n]*/%define module $(MODULE_NAME)/g' $(RPM_SPEC)
|
|
|
|
sed -i 's/^Version:[^\n]*/Version: $(VER)/g' $(RPM_SPEC)
|
|
|
|
sed -i 's/^Release:[^\n]*/Release: $(RELEASE)/g' $(RPM_SPEC)
|
|
|
|
# Copy source
|
|
|
|
cp -rf dkms.conf $(RPM_PACKAGE_SRC)
|
|
|
|
cp -rf Makefile $(RPM_PACKAGE_SRC)
|
|
|
|
cp -rf src $(RPM_PACKAGE_SRC)
|
|
|
|
cp -rf LICENSE $(RPM_PACKAGE_SRC)
|
|
|
|
cp -rf src_pkg/dkms_postinst $(RPM_PACKAGE_SRC)/postinst
|
2020-04-14 13:25:02 +02:00
|
|
|
cp -rf tuxedo_keyboard.conf $(RPM_PACKAGE_SRC)
|
2020-03-17 16:47:45 +01:00
|
|
|
# Compress/package source
|
|
|
|
cd rpm/SOURCES && tar cjvf $(RPM_PACKAGE_NAME).tar.bz2 $(RPM_PACKAGE_NAME)
|
|
|
|
# Make rpm package
|
|
|
|
rpmbuild --debug -bb --define "_topdir `pwd`/rpm" $(RPM_SPEC)
|
|
|
|
# Copy built package
|
|
|
|
cp rpm/RPMS/noarch/*.rpm .
|
|
|
|
|
|
|
|
package-rpm-clean:
|
|
|
|
rm -rf rpm > /dev/null 2>&1 || true
|
|
|
|
rm *.rpm > /dev/null 2>&1 || true
|