1 TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \ 2 tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \ 3 emp_ematch.yacc.o emp_ematch.lex.o 4 5 include ../config.mk 6 7 SHARED_LIBS ?= y 8 9 TCMODULES := 10 TCMODULES += q_fifo.o 11 TCMODULES += q_sfq.o 12 TCMODULES += q_red.o 13 TCMODULES += q_prio.o 14 TCMODULES += q_tbf.o 15 TCMODULES += q_cbq.o 16 TCMODULES += q_rr.o 17 TCMODULES += q_multiq.o 18 TCMODULES += q_netem.o 19 TCMODULES += q_choke.o 20 TCMODULES += q_sfb.o 21 TCMODULES += f_rsvp.o 22 TCMODULES += f_u32.o 23 TCMODULES += f_route.o 24 TCMODULES += f_fw.o 25 TCMODULES += f_basic.o 26 TCMODULES += f_bpf.o 27 TCMODULES += f_flow.o 28 TCMODULES += f_cgroup.o 29 TCMODULES += f_flower.o 30 TCMODULES += q_dsmark.o 31 TCMODULES += q_gred.o 32 TCMODULES += f_tcindex.o 33 TCMODULES += q_ingress.o 34 TCMODULES += q_hfsc.o 35 TCMODULES += q_htb.o 36 TCMODULES += q_drr.o 37 TCMODULES += q_qfq.o 38 TCMODULES += m_gact.o 39 TCMODULES += m_mirred.o 40 TCMODULES += m_nat.o 41 TCMODULES += m_pedit.o 42 TCMODULES += m_ife.o 43 TCMODULES += m_skbedit.o 44 TCMODULES += m_skbmod.o 45 TCMODULES += m_csum.o 46 TCMODULES += m_simple.o 47 TCMODULES += m_vlan.o 48 TCMODULES += m_connmark.o 49 TCMODULES += m_bpf.o 50 TCMODULES += m_tunnel_key.o 51 TCMODULES += m_sample.o 52 TCMODULES += p_ip.o 53 TCMODULES += p_ip6.o 54 TCMODULES += p_icmp.o 55 TCMODULES += p_eth.o 56 TCMODULES += p_tcp.o 57 TCMODULES += p_udp.o 58 TCMODULES += em_nbyte.o 59 TCMODULES += em_cmp.o 60 TCMODULES += em_u32.o 61 TCMODULES += em_canid.o 62 TCMODULES += em_meta.o 63 TCMODULES += q_mqprio.o 64 TCMODULES += q_codel.o 65 TCMODULES += q_fq_codel.o 66 TCMODULES += q_fq.o 67 TCMODULES += q_pie.o 68 TCMODULES += q_hhf.o 69 TCMODULES += q_clsact.o 70 TCMODULES += e_bpf.o 71 TCMODULES += f_matchall.o 72 73 TCSO := 74 ifeq ($(TC_CONFIG_ATM),y) 75 TCSO += q_atm.so 76 endif 77 78 ifneq ($(TC_CONFIG_NO_XT),y) 79 ifeq ($(TC_CONFIG_XT),y) 80 TCSO += m_xt.so 81 ifeq ($(TC_CONFIG_IPSET),y) 82 TCMODULES += em_ipset.o 83 endif 84 else 85 ifeq ($(TC_CONFIG_XT_OLD),y) 86 TCSO += m_xt_old.so 87 else 88 ifeq ($(TC_CONFIG_XT_OLD_H),y) 89 CFLAGS += -DTC_CONFIG_XT_H 90 TCSO += m_xt_old.so 91 else 92 TCMODULES += m_ipt.o 93 endif 94 endif 95 endif 96 endif 97 98 TCOBJ += $(TCMODULES) 99 LDLIBS += -L. -lm 100 101 ifeq ($(SHARED_LIBS),y) 102 LDLIBS += -ldl 103 LDFLAGS += -Wl,-export-dynamic 104 endif 105 106 TCLIB := tc_core.o 107 TCLIB += tc_red.o 108 TCLIB += tc_cbq.o 109 TCLIB += tc_estimator.o 110 TCLIB += tc_stab.o 111 112 CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB 113 ifneq ($(IPT_LIB_DIR),) 114 CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" 115 endif 116 117 YACC := bison 118 LEX := flex 119 CFLAGS += -DYY_NO_INPUT 120 121 MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc 122 123 %.so: %.c 124 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ 125 126 127 all: tc $(TCSO) 128 129 tc: $(TCOBJ) $(LIBNETLINK) libtc.a 130 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ 131 132 libtc.a: $(TCLIB) 133 $(QUIET_AR)$(AR) rcs $@ $^ 134 135 install: all 136 mkdir -p $(MODDESTDIR) 137 install -m 0755 tc $(DESTDIR)$(SBINDIR) 138 for i in $(TCSO); \ 139 do install -m 755 $$i $(MODDESTDIR); \ 140 done 141 if [ ! -f $(MODDESTDIR)/m_ipt.so ]; then \ 142 if [ -f $(MODDESTDIR)/m_xt.so ]; \ 143 then ln -s m_xt.so $(MODDESTDIR)/m_ipt.so ; \ 144 elif [ -f $(MODDESTDIR)/m_xt_old.so ]; \ 145 then ln -s m_xt_old.so $(MODDESTDIR)/m_ipt.so ; \ 146 fi; \ 147 fi 148 149 clean: 150 rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ 151 rm -f emp_ematch.yacc.* 152 153 q_atm.so: q_atm.c 154 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm 155 156 m_xt.so: m_xt.c 157 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs) 158 159 m_xt_old.so: m_xt_old.c 160 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$($(PKG_CONFIG) xtables --cflags --libs) 161 162 em_ipset.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags) 163 164 %.yacc.c: %.y 165 $(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $< 166 167 %.lex.c: %.l 168 $(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $< 169 170 # our lexer includes the header from yacc, so make sure 171 # we don't attempt to compile it before the header has 172 # been generated as part of the yacc step. 173 emp_ematch.lex.o: emp_ematch.yacc.c 174 175 ifneq ($(SHARED_LIBS),y) 176 177 tc: static-syms.o 178 static-syms.o: static-syms.h 179 static-syms.h: $(wildcard *.c) 180 files="$^" ; \ 181 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 182 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 183 done > $@ 184 185 endif 186