-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More idiomatic build process, plus Arch PKGBUILD
- Loading branch information
Showing
6 changed files
with
94 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
obj-m := src/hid-nintendo.o | ||
obj-m += hid-nintendo.o | ||
|
||
KERNELDIR ?= /lib/modules/$(shell uname -r)/build | ||
KERNEL_RELEASE := $(shell uname -r) | ||
KDIR := /lib/modules/$(KERNEL_RELEASE)/build | ||
|
||
OBJ_FILE := $(obj-m) | ||
SRC_FILE := $(OBJ_FILE:.o=.c) | ||
CMD_FILE := .$(OBJ_FILE).cmd | ||
MODNAME := $(OBJ_FILE:.o=) | ||
|
||
all default: modules | ||
install: modules_install | ||
|
||
modules modules_install help clean: | ||
$(MAKE) -C $(KERNELDIR) M=$(shell pwd) $@ | ||
$(OBJ_FILE) $(MODNAME).ko: $(SRC_FILE) | ||
|
||
modules modules_install clean $(OBJ_FILE) $(MODNAME).ko: | ||
$(MAKE) -C $(KDIR) M=$(CURDIR) $@ | ||
|
||
.PHONY: all modules clean install modules_install | ||
|
||
load: modules | ||
/usr/bin/modprobe ff_memless | ||
/sbin/insmod $(MODNAME).ko | ||
|
||
unload: | ||
/usr/bin/modprobe --remove $(MODNAME) | ||
/usr/bin/modprobe --remove ff_memless | ||
|
||
reload: modules | ||
/usr/bin/modprobe --remove $(MODNAME) | ||
/usr/bin/modprobe --remove ff_memless | ||
/usr/bin/modprobe ff_memless | ||
/sbin/insmod $(MODNAME).ko | ||
|
||
.PHONY: load unload reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Maintainer: Emily Strickland <linux(at)emily(dot)st> | ||
|
||
_pkgbase=hid-nintendo-dkms | ||
pkgname=hid-nintendo-dkms | ||
pkgver=v1.3 | ||
pkgrel=1 | ||
pkgdesc='Nintendo Switch HID driver with NSO controller support' | ||
url=https://github.com/emilyst/hid-nintendo | ||
arch=(any) | ||
license=(GPL) | ||
depends=(dkms) | ||
provides=(hid-nintendo-dkms) | ||
conflicts=(hid-nintendo-nso-dkms) | ||
source=( | ||
Makefile | ||
hid-nintendo.c | ||
hid-ids.h | ||
dkms.conf | ||
) | ||
b2sums=('e638a74c624cb218a21509e8194f02c34254ec2fcd9a740574f2a2f28fe3ef14691e654514cb05b52f94e49aedcdb0583ee1525bb896650f514fb85aafbb34e1' | ||
'0424ac9a5e8ca64ede2b446e238b5935c8afb50f82388d23b96376b9c167dc356a76cb20c71c2ad073abb44080cbcc5cfe4e29ed2443670ae19aa8e1c93a9ef2' | ||
'97e86380aa58ab564a8b03c00610fff66067634f5e31055f90e96ed840ca7bb0ea678cf7ddbf650f4f7b29993ba05c8958680f75db498fec673e89d8b06e7871' | ||
'4ef5422163176e926ffdc3824639eb7cd60297bc5bcafebc035fc71806462dace993ea092cabe6986d62768cfdb7fd29d252a78274084c5afbe22f2ca6ef2dc0') | ||
|
||
pkgver() { | ||
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | ||
} | ||
|
||
package() { | ||
install -Dm644 ${source[@]} -t "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/ | ||
|
||
sed -e "s/^PACKAGE_NAME=.*$/PACKAGE_NAME=${_pkgbase}/" \ | ||
-e "s/^PACKAGE_VERSION=.*$/PACKAGE_VERSION=${pkgver}/" \ | ||
-i "${pkgdir}"/usr/src/${_pkgbase}-${pkgver}/dkms.conf | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
PACKAGE_NAME="hid-nintendo" | ||
PACKAGE_VERSION=1.2 | ||
MAKE="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src modules" | ||
CLEAN="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src clean" | ||
BUILT_MODULE_NAME[0]="hid-nintendo" | ||
BUILT_MODULE_LOCATION[0]="src" | ||
DEST_MODULE_LOCATION[0]="/kernel/drivers/hid/" | ||
PACKAGE_NAME="$BUILT_MODULE_NAME-dkms" | ||
PACKAGE_VERSION=v1.3 | ||
|
||
BUILT_MODULE_NAME="hid-nintendo" | ||
DEST_MODULE_LOCATION="/extra" | ||
|
||
CLEAN="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build clean" | ||
MAKE="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build modules" | ||
|
||
AUTOINSTALL=yes |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters