-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.in
103 lines (85 loc) · 2.68 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
# Edit Makefile.in and run ./configure
KVERSION = @KVERSION@
KDIR = @KDIR@
KINSTDIR = $(shell dirname @KDIR@)
KOPTS = @KOPTS@
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 = pkt_netflow.o
ccflags-y = @KOPTS@
all: pkt_netflow.ko @SNMPTARGET@
pkt_netflow.ko: version.h pkt_netflow.c pkt_netflow.h compat_def.h compat.h Makefile
@echo Compiling for kernel $(KVERSION)
make -C $(KDIR) M=$(CURDIR) modules CONFIG_DEBUG_INFO=y
@touch $@
compat_def.h: gen_compat_def
./gen_compat_def > $@
sparse: | version.h pkt_netflow.c pkt_netflow.h compat.h Makefile
@rm -f pkt_netflow.ko pkt_netflow.o
@echo Compiling for kernel $(KVERSION)
make -C $(KDIR) M=$(CURDIR) modules C=1
@touch pkt_netflow.ko
coverity:
coverity-submit -v
minstall: | pkt_netflow.ko
@echo " *"
make -C $(KDIR) M=$(CURDIR) modules_install INSTALL_MOD_PATH=$(DESTDIR)
$(DEPMOD)
mclean:
make -C $(KDIR) M=$(CURDIR) clean
clean: mclean
-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
%.so: %_sh.o
$(CC) -shared -o $@ $<
version.h: pkt_netflow.c pkt_netflow.h compat.h Makefile
@./version.sh --define > version.h
dinstall:
@echo " *"
@./install-dkms.sh --install
install: minstall @DKMSINSTALL@ @SNMPINSTALL@
uninstall:
-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/pkt_netflow.ko
Makefile: Makefile.in configure
./configure --make ${CARGS}
load: all
-insmod pkt_netflow.ko active_timeout=5 protocol=9
unload:
-rmmod pkt_netflow.ko
reload: unload load
ChangeLog:
gitlog-to-changelog > ChangeLog
.PHONY: ChangeLog