1TCOBJ= 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 5include ../config.mk 6 7SHARED_LIBS ?= y 8 9TCMODULES := 10TCMODULES += q_fifo.o 11TCMODULES += q_sfq.o 12TCMODULES += q_red.o 13TCMODULES += q_prio.o 14TCMODULES += q_tbf.o 15TCMODULES += q_cbq.o 16TCMODULES += q_rr.o 17TCMODULES += q_multiq.o 18TCMODULES += q_netem.o 19TCMODULES += q_choke.o 20TCMODULES += q_sfb.o 21TCMODULES += f_rsvp.o 22TCMODULES += f_u32.o 23TCMODULES += f_route.o 24TCMODULES += f_fw.o 25TCMODULES += f_basic.o 26TCMODULES += f_bpf.o 27TCMODULES += f_flow.o 28TCMODULES += f_cgroup.o 29TCMODULES += f_flower.o 30TCMODULES += q_dsmark.o 31TCMODULES += q_gred.o 32TCMODULES += f_tcindex.o 33TCMODULES += q_ingress.o 34TCMODULES += q_hfsc.o 35TCMODULES += q_htb.o 36TCMODULES += q_drr.o 37TCMODULES += q_qfq.o 38TCMODULES += m_gact.o 39TCMODULES += m_mirred.o 40TCMODULES += m_nat.o 41TCMODULES += m_pedit.o 42TCMODULES += m_ife.o 43TCMODULES += m_skbedit.o 44TCMODULES += m_skbmod.o 45TCMODULES += m_csum.o 46TCMODULES += m_simple.o 47TCMODULES += m_vlan.o 48TCMODULES += m_connmark.o 49TCMODULES += m_bpf.o 50TCMODULES += m_tunnel_key.o 51TCMODULES += m_sample.o 52TCMODULES += p_ip.o 53TCMODULES += p_ip6.o 54TCMODULES += p_icmp.o 55TCMODULES += p_eth.o 56TCMODULES += p_tcp.o 57TCMODULES += p_udp.o 58TCMODULES += em_nbyte.o 59TCMODULES += em_cmp.o 60TCMODULES += em_u32.o 61TCMODULES += em_canid.o 62TCMODULES += em_meta.o 63TCMODULES += q_mqprio.o 64TCMODULES += q_codel.o 65TCMODULES += q_fq_codel.o 66TCMODULES += q_fq.o 67TCMODULES += q_pie.o 68TCMODULES += q_hhf.o 69TCMODULES += q_clsact.o 70TCMODULES += e_bpf.o 71TCMODULES += f_matchall.o 72 73TCSO := 74ifeq ($(TC_CONFIG_ATM),y) 75 TCSO += q_atm.so 76endif 77 78ifneq ($(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 96endif 97 98TCOBJ += $(TCMODULES) 99LDLIBS += -L. -lm 100 101ifeq ($(SHARED_LIBS),y) 102LDLIBS += -ldl 103LDFLAGS += -Wl,-export-dynamic 104endif 105 106TCLIB := tc_core.o 107TCLIB += tc_red.o 108TCLIB += tc_cbq.o 109TCLIB += tc_estimator.o 110TCLIB += tc_stab.o 111 112CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB 113ifneq ($(IPT_LIB_DIR),) 114 CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" 115endif 116 117YACC := bison 118LEX := flex 119CFLAGS += -DYY_NO_INPUT 120 121MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc 122 123%.so: %.c 124 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ 125 126 127all: tc $(TCSO) 128 129tc: $(TCOBJ) $(LIBNETLINK) libtc.a 130 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ 131 132libtc.a: $(TCLIB) 133 $(QUIET_AR)$(AR) rcs $@ $^ 134 135install: 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 149clean: 150 rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ 151 rm -f emp_ematch.yacc.* 152 153q_atm.so: q_atm.c 154 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm 155 156m_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 159m_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 162em_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. 173emp_ematch.lex.o: emp_ematch.yacc.c 174 175ifneq ($(SHARED_LIBS),y) 176 177tc: static-syms.o 178static-syms.o: static-syms.h 179static-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 185endif 186