1 # $Id: Makefile,v 1.8 2016/02/09 09:36:30 nanard Exp $
2 CFLAGS?
=-Wall
-g
-D_GNU_SOURCE
-DDEBUG
-Wstrict-prototypes
-Wdeclaration-after-statement
8 ARCH
:= $(shell uname
-m | grep
-q
"x86_64" && echo
64)
10 CFLAGS
:= $(CFLAGS
) -I
$(IPTABLESPATH
)/include/
11 LDFLAGS
:= $(LDFLAFGS
) -L
$(IPTABLESPATH
)/libiptc
/
12 # get iptables version and set IPTABLES_143 macro if needed
13 IPTABLESVERSION
:= $(shell grep
"\#define VERSION" $(IPTABLESPATH
)/config.h | tr
-d
\" |cut
-d
" " -f3
)
14 IPTABLESVERSION1
:= $(shell echo
$(IPTABLESVERSION
) | cut
-d.
-f1
)
15 IPTABLESVERSION2
:= $(shell echo
$(IPTABLESVERSION
) | cut
-d.
-f2
)
16 IPTABLESVERSION3
:= $(shell echo
$(IPTABLESVERSION
) | cut
-d.
-f3
)
17 # test if iptables version >= 1.4.3
18 TEST
:= $(shell [ \
( \
( $(IPTABLESVERSION1
) -ge
1 \
) -a \
( $(IPTABLESVERSION2
) -ge
4 \
) \
) -a \
( $(IPTABLESVERSION3
) -ge
3 \
) ] && echo
1 )
20 CFLAGS
:= $(CFLAGS
) -DIPTABLES_143
21 # the following sucks, but works
22 LIBS
= $(IPTABLESPATH
)/libiptc
/.libs
/libip4tc.o
23 #LIBS = $(IPTABLESPATH)/libiptc/.libs/libiptc.a
25 LIBS
= $(IPTABLESPATH
)/libiptc
/libiptc.a
28 # check for system-wide iptables files. Test if iptables version >= 1.4.3
29 #TEST := $(shell test -f /usr/include/iptables/internal.h && grep -q "\#define IPTABLES_VERSION" /usr/include/iptables/internal.h && echo 1)
30 TEST
:= $(shell test -f
/usr
/include/xtables.h
&& grep
-q
"XTABLES_VERSION_CODE" /usr
/include/xtables.h
&& echo
1)
32 CFLAGS
:= $(CFLAGS
) -DIPTABLES_143
34 TEST_LIB
:= $(shell test -f
/usr
/lib
$(ARCH
)/libiptc.a
&& echo
1)
36 LIBS
= -liptc
/usr
/lib
$(ARCH
)/libiptc.a
41 LIBS
+= /lib
/libip4tc.so
/lib
/libip6tc.so
43 all: iptcrdr.o testiptcrdr iptpinhole.o \
44 testiptcrdr_peer testiptcrdr_dscp test_nfct_get
48 $(RM
) *.o testiptcrdr testiptpinhole testiptcrdr_peer test_nfct_get \
51 testiptcrdr
: testiptcrdr.o upnpglobalvars.o
$(LIBS
)
53 testiptcrdr_peer
: testiptcrdr_peer.o upnpglobalvars.o
$(LIBS
)
55 testiptcrdr_dscp
: testiptcrdr_dscp.o upnpglobalvars.o
$(LIBS
)
57 testiptpinhole
: testiptpinhole.o iptpinhole.o upnpglobalvars.o
$(LIBS
)
59 test_nfct_get
: test_nfct_get.o test_nfct_get.o
-lmnl
-lnetfilter_conntrack
61 test_nfct_get.o
: test_nfct_get.c
63 testiptcrdr_peer.o
: testiptcrdr_peer.c
65 testiptcrdr_dscp.o
: testiptcrdr_dscp.c
67 iptcrdr.o
: iptcrdr.c iptcrdr.h
69 iptpinhole.o
: iptpinhole.c iptpinhole.h
71 upnpglobalvars.o
: ..
/upnpglobalvars.c ..
/upnpglobalvars.h
76 testiptcrdr.o
: testiptcrdr.c iptcrdr.c
77 testiptcrdr_dscp.o
: testiptcrdr_dscp.c iptcrdr.c
78 testiptcrdr_peer.o
: testiptcrdr_peer.c iptcrdr.c
79 test_nfct_get.o
: test_nfct_get.c nfct_get.c