|
1 | 1 | obj-m += ipt_DF.o |
2 | | -#IPT_CFLAGS = -fPIC -Wall -Wextra -pedantic |
3 | | -IPT_CFLAGS = -fPIC |
4 | | -IPTABLES_VERSION = 1.6.2 |
| 2 | +IPT_CFLAGS = -Wall -Wextra -pedantic -O2 |
5 | 3 |
|
6 | 4 | all: kernel-module iptables-module |
7 | 5 |
|
8 | | -iptables: iptables-$(IPTABLES_VERSION) ipt_DF.h |
9 | | - cp ipt_DF.h iptables-$(IPTABLES_VERSION)/include/linux/netfilter_ipv4/ipt_DF.h |
10 | | - |
11 | | -iptables-$(IPTABLES_VERSION): iptables-$(IPTABLES_VERSION).tar.bz2 |
12 | | - tar -xf iptables-$(IPTABLES_VERSION).tar.bz2 |
13 | | - |
14 | | -iptables-$(IPTABLES_VERSION).tar.bz2: |
15 | | - wget http://www.netfilter.org/projects/iptables/files/iptables-$(IPTABLES_VERSION).tar.bz2 |
16 | | - md5sum -c iptables-$(IPTABLES_VERSION).tar.bz2.md5 || (rm -f iptables-$(IPTABLES_VERSION).tar.bz2 && exit 1) |
17 | | - |
18 | 6 | kernel-module: |
19 | | - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules |
| 7 | + make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) modules |
20 | 8 |
|
21 | | -iptables-module: iptables libipt_DF.c |
22 | | - $(CC) $(CFLAGS) $(IPT_CFLAGS) -I iptables-$(IPTABLES_VERSION)/include libipt_DF.c -c |
23 | | - $(CC) $(CFLAGS) $(IPT_CFLAGS) -shared -o libipt_DF.so libipt_DF.o |
| 9 | +iptables-module: libipt_DF.so |
24 | 10 |
|
25 | | -clean-all: clean clean-iptables-archive |
| 11 | +libipt_DF.so: libipt_DF.o |
| 12 | + gcc -shared -fPIC ${IPT_CFLAGS} -o $@ $^; |
26 | 13 |
|
27 | | -clean: clean-kernel-module clean-iptables-module clean-iptables |
| 14 | +libipt_DF.o: libipt_DF.c |
| 15 | + gcc ${IPT_CFLAGS} -D_INIT=lib$*_init -fPIC -c -o $@ $<; |
| 16 | + |
| 17 | +clean: clean-kernel-module clean-iptables-module |
28 | 18 |
|
29 | 19 | clean-kernel-module: |
30 | | - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean |
| 20 | + make -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean |
31 | 21 |
|
32 | 22 | clean-iptables-module: |
33 | 23 | rm -f libipt_DF.o libipt_DF.so |
34 | | - |
35 | | -clean-iptables: |
36 | | - rm -rf iptables-$(IPTABLES_VERSION) |
37 | | - |
38 | | -clean-iptables-archive: |
39 | | - rm -f iptables-$(IPTABLES_VERSION).tar.bz2 |
0 commit comments