forked from aabc/ipt-netflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
76 lines (63 loc) · 2.16 KB
/
Makefile.in
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Edit Makefile.in and run ./configure
KVERSION = @KVERSION@
KDIR = @KDIR@
KINSTDIR = $(shell dirname @KDIR@)
KOPTS = @KOPTS@
IPTABLES_CFLAGS = @IPTABLES_CFLAGS@
IPTABLES_MODULES = @IPTABLES_MODULES@
DEPMOD = depmod -a
CARGS = @CARGS@
# https://www.kernel.org/doc/Documentation/kbuild/modules.txt
# https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt
obj-m = ipt_NETFLOW.o
ccflags-y = @KOPTS@
all: ipt_NETFLOW.ko libipt_NETFLOW.so libip6t_NETFLOW.so
ipt_NETFLOW.ko: version.h ipt_NETFLOW.c ipt_NETFLOW.h Makefile
@echo Compiling for kernel $(KVERSION)
make -C $(KDIR) M=$(CURDIR) modules
@touch $@
sparse: | version.h ipt_NETFLOW.c ipt_NETFLOW.h Makefile
@rm -f ipt_NETFLOW.ko ipt_NETFLOW.o
@echo Compiling for kernel $(KVERSION)
make -C $(KDIR) M=$(CURDIR) modules C=1
@touch ipt_NETFLOW.ko
minstall: | ipt_NETFLOW.ko
make -C $(KDIR) M=$(CURDIR) modules_install INSTALL_MOD_PATH=$(DESTDIR)
$(DEPMOD)
mclean:
make -C $(KDIR) M=$(CURDIR) clean
lclean:
-rm -f *.so *_sh.o
clean: mclean lclean
-rm -f *.so *.o modules.order version.h
%_sh.o: libipt_NETFLOW.c
gcc -O2 -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c
%.so: %_sh.o
gcc -shared -o $@ $<
version.h: ipt_NETFLOW.c ipt_NETFLOW.h Makefile
@if [ -d .git ] && type git >/dev/null 2>&1; then \
echo "#define GITVERSION \"`git describe --dirty`\""; \
fi > version.h
linstall: | libipt_NETFLOW.so libip6t_NETFLOW.so
install -D libipt_NETFLOW.so $(DESTDIR)$(IPTABLES_MODULES)/libipt_NETFLOW.so
install -D libip6t_NETFLOW.so $(DESTDIR)$(IPTABLES_MODULES)/libip6t_NETFLOW.so
install: minstall linstall
uninstall:
-rm -f $(DESTDIR)$(IPTABLES_MODULES)/libipt_NETFLOW.so
-rm -f $(DESTDIR)$(IPTABLES_MODULES)/libip6t_NETFLOW.so
-rm -f $(DESTDIR)$(KINSTDIR)/extra/ipt_NETFLOW.ko
Makefile: Makefile.in configure
./configure --make ${CARGS}
load: all
-insmod ipt_NETFLOW.ko active_timeout=5 protocol=9
-iptables -I OUTPUT -j NETFLOW
-iptables -I INPUT -j NETFLOW
-ip6tables -I OUTPUT -j NETFLOW
-ip6tables -I INPUT -j NETFLOW
unload:
-iptables -D OUTPUT -j NETFLOW
-iptables -D INPUT -j NETFLOW
-ip6tables -D OUTPUT -j NETFLOW
-ip6tables -D INPUT -j NETFLOW
-rmmod ipt_NETFLOW.ko
reload: unload load