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