aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 127391bf79be80769d150d75fa801619e0858b40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
CC=arm-linux-gnueabi-gcc

all: bin bin/kblightd bin/kblightd_magisk.zip

clean:
	rm -rf bin

bin:
	mkdir bin

bin/kblightd: src/main.c src/keypress_thread.c src/light_thread.c src/backlight.c
	${CC} -static $^ -o $@

adb_prep:
	adb root

run: all adb_prep
	make kill

	adb push bin/kblightd /sbin/
	adb shell "nohup /sbin/kblightd > /dev/null &" &

debug: all adb_prep
	make kill

	adb push bin/kblightd /sbin/
	adb shell "/sbin/kblightd"

kill: all
	adb shell -x pkill kblightd

bin/kblightd_magisk.zip: bin bin/kblightd src/service.sh res/module.prop
	mkdir -p bin/magisk/system/bin

	cp -p bin/kblightd bin/magisk/system/bin
	cp -p src/service.sh bin/magisk
	cp -p res/module.prop bin/magisk

	cd bin/magisk; zip -r ../../$@ .

module: bin/kblightd_magisk.zip

install: module adb_prep
	adb push bin/kblightd_magisk.zip /sdcard/
	adb shell magisk --install-module /sdcard/kblightd_magisk.zip
	adb shell rm /sdcard/kblightd_magisk.zip

	echo 'done!'