blob: 3aa9f2638eb6374bbd1ac697b32b9e51b54768a5 (
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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o \
tc_monitor.o m_police.o m_estimator.o m_action.o \
m_ematch.o emp_ematch.yacc.o emp_ematch.lex.o
include ../Config
SHARED_LIBS ?= y
TCMODULES :=
TCMODULES += q_fifo.o
TCMODULES += q_sfq.o
TCMODULES += q_red.o
TCMODULES += q_prio.o
TCMODULES += q_tbf.o
TCMODULES += q_cbq.o
TCMODULES += q_rr.o
TCMODULES += q_multiq.o
TCMODULES += q_netem.o
TCMODULES += f_rsvp.o
TCMODULES += f_u32.o
TCMODULES += f_route.o
TCMODULES += f_fw.o
TCMODULES += f_basic.o
TCMODULES += f_flow.o
TCMODULES += f_cgroup.o
TCMODULES += q_dsmark.o
TCMODULES += q_gred.o
TCMODULES += f_tcindex.o
TCMODULES += q_ingress.o
TCMODULES += q_hfsc.o
TCMODULES += q_htb.o
TCMODULES += q_drr.o
TCMODULES += m_gact.o
TCMODULES += m_mirred.o
TCMODULES += m_nat.o
TCMODULES += m_pedit.o
TCMODULES += m_skbedit.o
TCMODULES += p_ip.o
TCMODULES += p_icmp.o
TCMODULES += p_tcp.o
TCMODULES += p_udp.o
TCMODULES += em_nbyte.o
TCMODULES += em_cmp.o
TCMODULES += em_u32.o
TCMODULES += em_meta.o
TCSO :=
ifeq ($(TC_CONFIG_ATM),y)
TCSO += q_atm.so
endif
ifeq ($(TC_CONFIG_XT),y)
TCSO += m_xt.so
else
ifeq ($(TC_CONFIG_XT_OLD),y)
TCSO += m_xt_old.so
else
ifeq ($(TC_CONFIG_XT_OLD_H),y)
CFLAGS += -DTC_CONFIG_XT_H
TCSO += m_xt_old.so
else
TCMODULES += m_ipt.o
endif
endif
endif
TCOBJ += $(TCMODULES)
LDLIBS += -L. -ltc -lm
ifeq ($(SHARED_LIBS),y)
LDLIBS += -ldl
LDFLAGS += -Wl,-export-dynamic
endif
TCLIB := tc_core.o
TCLIB += tc_red.o
TCLIB += tc_cbq.o
TCLIB += tc_estimator.o
TCLIB += tc_stab.o
CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
ifneq ($(IPT_LIB_DIR),)
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
endif
YACC := bison
LEX := flex
MODDESTDIR := $(DESTDIR)$(patsubst /usr%,%,$(LIBDIR))/tc
%.so: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
all: libtc.a tc $(TCSO)
tc: $(TCOBJ) $(LIBNETLINK) $(LIBUTIL) $(TCLIB)
libtc.a: $(TCLIB)
$(AR) rcs $@ $(TCLIB)
install: all
mkdir -p $(MODDESTDIR)
install -m 0755 tc $(DESTDIR)$(SBINDIR)
for i in $(TCSO); \
do install -m 755 $$i $(MODDESTDIR); \
done
if [ ! -f $(MODDESTDIR)/m_ipt.so ]; then \
if [ -f $(MODDESTDIR)/m_xt.so ]; \
then ln -s m_xt.so $(MODDESTDIR)/m_ipt.so ; \
elif [ -f $(MODDESTDIR)/m_xt_old.so ]; \
then ln -s m_xt_old.so $(MODDESTDIR)/m_ipt.so ; \
fi; \
fi
clean:
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
rm -f emp_ematch.yacc.output
q_atm.so: q_atm.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
m_xt.so: m_xt.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c -lxtables
m_xt_old.so: m_xt_old.c
$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c -lxtables
%.yacc.c: %.y
$(YACC) $(YACCFLAGS) -o $@ $<
%.lex.c: %.l
$(LEX) $(LEXFLAGS) -o$@ $<
ifneq ($(SHARED_LIBS),y)
tc: static-syms.o
static-syms.o: static-syms.h
static-syms.h: $(wildcard *.c)
files="$^" ; \
for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
done > $@
endif
|