1 TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o \ 2 tc_monitor.o m_police.o m_estimator.o m_action.o \ 3 m_ematch.o emp_ematch.yacc.o emp_ematch.lex.o 4 5 include ../Config 6 SHARED_LIBS ?= y 7 8 TCMODULES := 9 TCMODULES += q_fifo.o 10 TCMODULES += q_sfq.o 11 TCMODULES += q_red.o 12 TCMODULES += q_prio.o 13 TCMODULES += q_tbf.o 14 TCMODULES += q_cbq.o 15 TCMODULES += q_rr.o 16 TCMODULES += q_multiq.o 17 TCMODULES += q_netem.o 18 TCMODULES += f_rsvp.o 19 TCMODULES += f_u32.o 20 TCMODULES += f_route.o 21 TCMODULES += f_fw.o 22 TCMODULES += f_basic.o 23 TCMODULES += f_flow.o 24 TCMODULES += f_cgroup.o 25 TCMODULES += q_dsmark.o 26 TCMODULES += q_gred.o 27 TCMODULES += f_tcindex.o 28 TCMODULES += q_ingress.o 29 TCMODULES += q_hfsc.o 30 TCMODULES += q_htb.o 31 TCMODULES += q_drr.o 32 TCMODULES += m_gact.o 33 TCMODULES += m_mirred.o 34 TCMODULES += m_nat.o 35 TCMODULES += m_pedit.o 36 TCMODULES += m_skbedit.o 37 TCMODULES += p_ip.o 38 TCMODULES += p_icmp.o 39 TCMODULES += p_tcp.o 40 TCMODULES += p_udp.o 41 TCMODULES += em_nbyte.o 42 TCMODULES += em_cmp.o 43 TCMODULES += em_u32.o 44 TCMODULES += em_meta.o 45 46 47 ifeq ($(TC_CONFIG_XT),y) 48 TCMODULES += m_xt.o 49 LDLIBS += -lxtables 50 else 51 ifeq ($(TC_CONFIG_XT_OLD),y) 52 TCMODULES += m_xt_old.o 53 LDLIBS += -lxtables 54 else 55 ifeq ($(TC_CONFIG_XT_OLD_H),y) 56 CFLAGS += -DTC_CONFIG_XT_H 57 TCMODULES += m_xt_old.o 58 LDLIBS += -lxtables 59 else 60 TCMODULES += m_ipt.o 61 endif 62 endif 63 endif 64 65 TCOBJ += $(TCMODULES) 66 LDLIBS += -L. -ltc -lm 67 68 ifeq ($(SHARED_LIBS),y) 69 LDLIBS += -ldl 70 LDFLAGS += -Wl,-export-dynamic 71 endif 72 73 TCLIB := tc_core.o 74 TCLIB += tc_red.o 75 TCLIB += tc_cbq.o 76 TCLIB += tc_estimator.o 77 TCLIB += tc_stab.o 78 79 CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB 80 81 TCSO := 82 ifeq ($(TC_CONFIG_ATM),y) 83 TCSO += q_atm.so 84 endif 85 86 YACC := bison 87 LEX := flex 88 89 %.so: %.c 90 $(CC) $(CFLAGS) -shared -fpic $< -o $@ 91 92 93 all: libtc.a tc $(TCSO) 94 95 tc: $(TCOBJ) $(LIBNETLINK) $(LIBUTIL) $(TCLIB) 96 97 libtc.a: $(TCLIB) 98 $(AR) rcs $@ $(TCLIB) 99 100 install: all 101 mkdir -p $(DESTDIR)$(LIBDIR)/tc 102 install -m 0755 tc $(DESTDIR)$(SBINDIR) 103 for i in $(TCSO); \ 104 do install -m 755 $$i $(DESTDIR)$(LIBDIR)/tc; \ 105 done 106 107 clean: 108 rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ 109 rm -f emp_ematch.yacc.output 110 111 q_atm.so: q_atm.c 112 $(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm 113 114 %.yacc.c: %.y 115 $(YACC) $(YACCFLAGS) -o $@ $< 116 117 %.lex.c: %.l 118 $(LEX) $(LEXFLAGS) -o$@ $< 119 120 ifneq ($(SHARED_LIBS),y) 121 122 tc: static-syms.o 123 static-syms.o: static-syms.h 124 static-syms.h: $(wildcard *.c) 125 files="$^" ; \ 126 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 127 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 128 done > $@ 129 130 endif 131