forked from aabc/ipt-netflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
128 lines (108 loc) · 3.58 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# SPDX-License-Identifier: GPL-2.0-only
#
# 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 = /sbin/depmod -a
CARGS = @CARGS@
SNMPTGSO = /usr/lib/snmp/dlmod/snmp_NETFLOW.so
SNMPCONF = /etc/snmp/snmpd.conf
SNMPLINE = dlmod netflow $(SNMPTGSO)
CC = gcc
# 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 @SNMPTARGET@
ipt_NETFLOW.ko: version.h ipt_NETFLOW.c ipt_NETFLOW.h compat_def.h compat.h Makefile
@echo Compiling $(shell ./version.sh) for kernel $(KVERSION)
make -C $(KDIR) M=$(CURDIR) modules
@touch $@
compat_def.h: gen_compat_def
./gen_compat_def > $@-
mv $@- $@
sparse: | version.h ipt_NETFLOW.c ipt_NETFLOW.h compat.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
coverity:
coverity-submit -v
minstall: | ipt_NETFLOW.ko
@echo " *"
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 compat_def.h
snmp_NETFLOW.so: snmp_NETFLOW.c
$(CC) -fPIC -shared -o $@ $< -lnetsnmp
sinstall: | snmp_NETFLOW.so IPT-NETFLOW-MIB.my
@echo " *"
install -D IPT-NETFLOW-MIB.my $(DESTDIR)/usr/share/snmp/mibs/IPT-NETFLOW-MIB.my
install -D snmp_NETFLOW.so $(DESTDIR)$(SNMPTGSO)
@if ! egrep -qs "^ *$(SNMPLINE)" $(SNMPCONF); then \
echo " *"; \
echo " * Add this line to $(SNMPCONF) to enable IPT-NETFLOW-MIB:"; \
echo " *"; \
echo " * $(SNMPLINE)"; \
echo " *"; \
fi
@if killall -0 snmpd >/dev/null 2>&1; then \
echo " * (snmpd needs restart for changes to take effect.)"; \
else \
echo " * (snmpd is not started.)"; \
fi
%_sh.o: libipt_NETFLOW.c
$(CC) $(CFLAGS) -O2 -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c
%.so: %_sh.o
$(CC) -shared -o $@ $<
version.h: ipt_NETFLOW.c ipt_NETFLOW.h compat.h Makefile
@./version.sh --define > version.h
linstall: | libipt_NETFLOW.so libip6t_NETFLOW.so
@echo " *"
install -D libipt_NETFLOW.so $(DESTDIR)$(IPTABLES_MODULES)/libipt_NETFLOW.so
install -D libip6t_NETFLOW.so $(DESTDIR)$(IPTABLES_MODULES)/libip6t_NETFLOW.so
dinstall:
@echo " *"
@./install-dkms.sh --install
install: minstall linstall @DKMSINSTALL@ @SNMPINSTALL@
uninstall:
-rm -f $(DESTDIR)$(IPTABLES_MODULES)/libipt_NETFLOW.so
-rm -f $(DESTDIR)$(IPTABLES_MODULES)/libip6t_NETFLOW.so
-rm -f $(DESTDIR)/usr/share/snmp/mibs/IPT-NETFLOW-MIB.my
-rm -f $(DESTDIR)$(SNMPTGSO)
@if egrep -qs "^ *$(SNMPLINE)" $(SNMPCONF); then \
echo " *"; \
echo " * Remove this line from $(SNMPCONF):"; \
echo " *"; \
echo " * "`egrep "^ *$(SNMPLINE)" $(SNMPCONF)`; \
echo " *"; \
fi
@if [ "@DKMSINSTALL@" = dinstall ]; then ./install-dkms.sh --uninstall; fi
-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
ChangeLog:
gitlog-to-changelog > ChangeLog
.PHONY: ChangeLog