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 += q_choke.o 19 TCMODULES += q_sfb.o 20 TCMODULES += f_rsvp.o 21 TCMODULES += f_u32.o 22 TCMODULES += f_route.o 23 TCMODULES += f_fw.o 24 TCMODULES += f_basic.o 25 TCMODULES += f_flow.o 26 TCMODULES += f_cgroup.o 27 TCMODULES += q_dsmark.o 28 TCMODULES += q_gred.o 29 TCMODULES += f_tcindex.o 30 TCMODULES += q_ingress.o 31 TCMODULES += q_hfsc.o 32 TCMODULES += q_htb.o 33 TCMODULES += q_drr.o 34 TCMODULES += q_qfq.o 35 TCMODULES += m_gact.o 36 TCMODULES += m_mirred.o 37 TCMODULES += m_nat.o 38 TCMODULES += m_pedit.o 39 TCMODULES += m_skbedit.o 40 TCMODULES += m_csum.o 41 TCMODULES += p_ip.o 42 TCMODULES += p_icmp.o 43 TCMODULES += p_tcp.o 44 TCMODULES += p_udp.o 45 TCMODULES += em_nbyte.o 46 TCMODULES += em_cmp.o 47 TCMODULES += em_u32.o 48 TCMODULES += em_meta.o 49 TCMODULES += q_mqprio.o 50 51 TCSO := 52 ifeq ($(TC_CONFIG_ATM),y) 53 TCSO += q_atm.so 54 endif 55 56 ifeq ($(TC_CONFIG_XT),y) 57 TCSO += m_xt.so 58 else 59 ifeq ($(TC_CONFIG_XT_OLD),y) 60 TCSO += m_xt_old.so 61 else 62 ifeq ($(TC_CONFIG_XT_OLD_H),y) 63 CFLAGS += -DTC_CONFIG_XT_H 64 TCSO += m_xt_old.so 65 else 66 TCMODULES += m_ipt.o 67 endif 68 endif 69 endif 70 71 TCOBJ += $(TCMODULES) 72 LDLIBS += -L. -ltc -lm 73 74 ifeq ($(SHARED_LIBS),y) 75 LDLIBS += -ldl 76 LDFLAGS += -Wl,-export-dynamic 77 endif 78 79 TCLIB := tc_core.o 80 TCLIB += tc_red.o 81 TCLIB += tc_cbq.o 82 TCLIB += tc_estimator.o 83 TCLIB += tc_stab.o 84 85 CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB 86 ifneq ($(IPT_LIB_DIR),) 87 CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" 88 endif 89 90 YACC := bison 91 LEX := flex 92 CFLAGS += -DYY_NO_INPUT 93 94 MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc 95 96 %.so: %.c 97 $(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ 98 99 100 all: libtc.a tc $(TCSO) 101 102 tc: $(TCOBJ) $(TCLIB) 103 104 libtc.a: $(TCLIB) 105 $(AR) rcs $@ $(TCLIB) 106 107 install: all 108 mkdir -p $(MODDESTDIR) 109 install -m 0755 tc $(DESTDIR)$(SBINDIR) 110 for i in $(TCSO); \ 111 do install -m 755 $$i $(MODDESTDIR); \ 112 done 113 if [ ! -f $(MODDESTDIR)/m_ipt.so ]; then \ 114 if [ -f $(MODDESTDIR)/m_xt.so ]; \ 115 then ln -s m_xt.so $(MODDESTDIR)/m_ipt.so ; \ 116 elif [ -f $(MODDESTDIR)/m_xt_old.so ]; \ 117 then ln -s m_xt_old.so $(MODDESTDIR)/m_ipt.so ; \ 118 fi; \ 119 fi 120 121 clean: 122 rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ 123 rm -f emp_ematch.yacc.* 124 125 q_atm.so: q_atm.c 126 $(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm 127 128 m_xt.so: m_xt.c 129 $(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$(pkg-config xtables --cflags --libs) 130 131 m_xt_old.so: m_xt_old.c 132 $(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$(pkg-config xtables --cflags --libs) 133 134 %.yacc.c: %.y 135 $(YACC) $(YACCFLAGS) -o $@ $< 136 137 %.lex.c: %.l 138 $(LEX) $(LEXFLAGS) -o$@ $< 139 140 # our lexer includes the header from yacc, so make sure 141 # we don't attempt to compile it before the header has 142 # been generated as part of the yacc step. 143 emp_ematch.lex.o: emp_ematch.yacc.c 144 145 ifneq ($(SHARED_LIBS),y) 146 147 tc: static-syms.o 148 static-syms.o: static-syms.h 149 static-syms.h: $(wildcard *.c) 150 files="$^" ; \ 151 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 152 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 153 done > $@ 154 155 endif 156