summaryrefslogtreecommitdiff
blob: 675e8b16f725fe71cd1ec891c7d0a8f45a89cfe0 (plain)
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
--- a/Makefile.in
+++ b/Makefile.in
@@ -11,7 +11,7 @@ CARGS = @CARGS@
 SNMPTGSO = /usr/lib/snmp/dlmod/snmp_NETFLOW.so
 SNMPCONF = /etc/snmp/snmpd.conf
 SNMPLINE = dlmod netflow $(SNMPTGSO)
-CC = gcc
+$(CC) ?= gcc
 
 # https://www.kernel.org/doc/Documentation/kbuild/modules.txt
 # https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt
@@ -22,31 +22,31 @@ 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 for kernel $(KVERSION)
-	make -C $(KDIR) M=$(CURDIR) modules CONFIG_DEBUG_INFO=y
+	$(MAKE) -C $(KDIR) M=$(CURDIR) modules CONFIG_DEBUG_INFO=y
 	@touch $@
 compat_def.h: gen_compat_def
 	./gen_compat_def > $@
 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
+	$(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)
+	$(MAKE) -C $(KDIR) M=$(CURDIR) modules_install INSTALL_MOD_PATH=$(DESTDIR)
 	$(DEPMOD)
 mclean:
-	make -C $(KDIR) M=$(CURDIR) clean
+	$(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
+	$(CC) $(CFLAGS) $(LDFLAGS) -fPIC -shared -o $@ $< -lnetsnmp
 
 sinstall: | snmp_NETFLOW.so IPT-NETFLOW-MIB.my
 	@echo " *"
@@ -66,7 +66,7 @@ sinstall: | snmp_NETFLOW.so IPT-NETFLOW-MIB.my
 	fi
 
 %_sh.o: libipt_NETFLOW.c
-	$(CC) $(CFLAGS) -O2 -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -Wall -Wunused $(IPTABLES_CFLAGS) -fPIC -o $@ -c libipt_NETFLOW.c
 
 %.so: %_sh.o
 	$(CC) -shared -o $@ $<