youtubeUnblock/kmake.mk

43 lines
840 B
Makefile
Raw Normal View History

2024-07-30 23:12:59 +00:00
#Kernel module makes here
PWD := $(CURDIR)
CC := gcc
CCLD := $(CC)
LD := ld
CFLAGS :=
LDFLAGS :=
2024-07-30 23:12:59 +00:00
IPT_CFLAGS := -Wall -Wpedantic -O2
2024-07-30 23:12:59 +00:00
.PHONY: kmake kload kunload kreload kclean kmclean xclean
kmake: kmod xmod
kmod:
2024-07-30 23:12:59 +00:00
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
xmod: libipt_YTUNBLOCK.so
libipt_YTUNBLOCK.so: libipt_YTUNBLOCK.o
$(CCLD) -shared -fPIC ${IPT_CFLAGS} -o $@ $^;
libipt_YTUNBLOCK.o: libipt_YTUNBLOCK.c
$(CC) ${IPT_CFLAGS} -D_INIT=lib$*_init -fPIC -c -o $@ $<;
2024-07-30 23:12:59 +00:00
kload:
insmod ipt_YTUNBLOCK.ko
cp ./libipt_YTUNBLOCK.so /usr/lib/xtables/
2024-07-30 23:12:59 +00:00
kunload:
-rmmod ipt_YTUNBLOCK
-/bin/rm /usr/lib/xtables/libipt_YTUNBLOCK.so
2024-07-30 23:12:59 +00:00
kreload: kunload kload
kclean: xtclean kmclean
2024-07-30 23:12:59 +00:00
kmclean:
-$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
2024-07-30 23:12:59 +00:00
xtclean:
-/bin/rm -f libipt_YTUNBLOCK.so libipt_YTUNBLOCK.o