youtubeUnblock/kmake.mk

51 lines
1.1 KiB
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
2024-09-01 13:52:41 +00:00
xmod: libipt_YTUNBLOCK.so libip6t_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-09-01 13:52:41 +00:00
libip6t_YTUNBLOCK.so: libip6t_YTUNBLOCK.o
$(CCLD) -shared -fPIC ${IPT_CFLAGS} -o $@ $^;
libip6t_YTUNBLOCK.o: libip6t_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-09-01 13:52:41 +00:00
cp ./libip6t_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-09-01 13:52:41 +00:00
-/bin/rm /usr/lib/xtables/libip6t_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