Daniel Borkmann | 4bd6244 | 2015-04-16 21:20:06 +0200 | [diff] [blame] | 1 | TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o tc_monitor.o \ |
Daniel Borkmann | e422566 | 2016-11-10 01:20:59 +0100 | [diff] [blame] | 2 | tc_exec.o m_police.o m_estimator.o m_action.o m_ematch.o \ |
Daniel Borkmann | 4bd6244 | 2015-04-16 21:20:06 +0200 | [diff] [blame] | 3 | emp_ematch.yacc.o emp_ematch.lex.o |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 4 | |
osdl.net!shemminger | adff36d | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 5 | include ../Config |
Vadim Kochan | 67e1d73 | 2014-12-24 23:04:11 +0200 | [diff] [blame] | 6 | |
| 7 | ifeq ($(IP_CONFIG_SETNS),y) |
| 8 | CFLAGS += -DHAVE_SETNS |
| 9 | endif |
| 10 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 11 | SHARED_LIBS ?= y |
osdl.net!shemminger | adff36d | 2004-06-25 21:14:22 +0000 | [diff] [blame] | 12 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 13 | TCMODULES := |
| 14 | TCMODULES += q_fifo.o |
| 15 | TCMODULES += q_sfq.o |
| 16 | TCMODULES += q_red.o |
| 17 | TCMODULES += q_prio.o |
| 18 | TCMODULES += q_tbf.o |
| 19 | TCMODULES += q_cbq.o |
Stephen Hemminger | 45305c2 | 2007-10-16 14:27:42 -0700 | [diff] [blame] | 20 | TCMODULES += q_rr.o |
Alexander Duyck | fe1a34f | 2008-12-05 14:16:42 -0800 | [diff] [blame] | 21 | TCMODULES += q_multiq.o |
Stephen Hemminger | 954df8c | 2007-06-25 09:42:30 -0700 | [diff] [blame] | 22 | TCMODULES += q_netem.o |
Stephen Hemminger | a4eca97 | 2011-01-13 09:23:17 -0800 | [diff] [blame] | 23 | TCMODULES += q_choke.o |
Juliusz Chroboczek | d7f3299 | 2011-03-24 18:44:09 +0100 | [diff] [blame] | 24 | TCMODULES += q_sfb.o |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 25 | TCMODULES += f_rsvp.o |
| 26 | TCMODULES += f_u32.o |
| 27 | TCMODULES += f_route.o |
| 28 | TCMODULES += f_fw.o |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 29 | TCMODULES += f_basic.o |
Daniel Borkmann | d05df68 | 2013-10-28 12:35:33 +0100 | [diff] [blame] | 30 | TCMODULES += f_bpf.o |
Patrick McHardy | 9932abb | 2008-01-31 18:58:59 +0100 | [diff] [blame] | 31 | TCMODULES += f_flow.o |
Thomas Graf | ff213c4 | 2009-04-09 07:01:51 -0400 | [diff] [blame] | 32 | TCMODULES += f_cgroup.o |
Jiri Pirko | 30eb304 | 2015-05-15 13:34:04 +0200 | [diff] [blame] | 33 | TCMODULES += f_flower.o |
osdl.org!shemminger | cda17fc | 2004-06-09 21:31:01 +0000 | [diff] [blame] | 34 | TCMODULES += q_dsmark.o |
| 35 | TCMODULES += q_gred.o |
| 36 | TCMODULES += f_tcindex.o |
| 37 | TCMODULES += q_ingress.o |
osdl.net!shemminger | 4b1bbd9 | 2004-08-09 16:35:28 +0000 | [diff] [blame] | 38 | TCMODULES += q_hfsc.o |
| 39 | TCMODULES += q_htb.o |
Patrick McHardy | c86f349 | 2008-11-19 16:08:05 +0100 | [diff] [blame] | 40 | TCMODULES += q_drr.o |
Stephen Hemminger | c441bd4 | 2011-01-07 09:43:27 -0800 | [diff] [blame] | 41 | TCMODULES += q_qfq.o |
osdl.net!shemminger | 9bf19a8 | 2004-08-30 21:20:10 +0000 | [diff] [blame] | 42 | TCMODULES += m_gact.o |
net[shemminger]!shemminger | 00fa848 | 2004-12-08 20:13:56 +0000 | [diff] [blame] | 43 | TCMODULES += m_mirred.o |
Herbert Xu | fc2d020 | 2007-10-12 17:08:40 +0800 | [diff] [blame] | 44 | TCMODULES += m_nat.o |
net[shemminger]!shemminger | 7e7c737 | 2005-01-17 23:32:51 +0000 | [diff] [blame] | 45 | TCMODULES += m_pedit.o |
Jamal Hadi Salim | d3e5112 | 2016-05-07 09:35:23 -0400 | [diff] [blame] | 46 | TCMODULES += m_ife.o |
Alexander Duyck | f72a7aa | 2009-01-06 19:27:03 -0800 | [diff] [blame] | 47 | TCMODULES += m_skbedit.o |
Gregoire Baron | 3822cc9 | 2010-12-01 11:17:46 -0800 | [diff] [blame] | 48 | TCMODULES += m_csum.o |
Jamal Hadi Salim | 087f46e | 2013-09-29 07:33:42 -0400 | [diff] [blame] | 49 | TCMODULES += m_simple.o |
Jiri Pirko | 8b1c021 | 2014-11-21 12:31:30 +0100 | [diff] [blame] | 50 | TCMODULES += m_vlan.o |
Felix Fietkau | b8d5c9a | 2015-02-15 11:57:19 -0500 | [diff] [blame] | 51 | TCMODULES += m_connmark.o |
Jiri Pirko | 86ab59a | 2015-01-19 16:56:30 +0100 | [diff] [blame] | 52 | TCMODULES += m_bpf.o |
Amir Vadai | d57639a | 2016-12-02 13:25:15 +0200 | [diff] [blame] | 53 | TCMODULES += m_tunnel_key.o |
net[shemminger]!shemminger | 7e7c737 | 2005-01-17 23:32:51 +0000 | [diff] [blame] | 54 | TCMODULES += p_ip.o |
| 55 | TCMODULES += p_icmp.o |
| 56 | TCMODULES += p_tcp.o |
| 57 | TCMODULES += p_udp.o |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 58 | TCMODULES += em_nbyte.o |
| 59 | TCMODULES += em_cmp.o |
| 60 | TCMODULES += em_u32.o |
Rostislav Lisovy | 7b5f30e | 2012-08-20 13:11:55 -0700 | [diff] [blame] | 61 | TCMODULES += em_canid.o |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 62 | TCMODULES += em_meta.o |
John Fastabend | 9149530 | 2011-04-12 08:57:27 -0700 | [diff] [blame] | 63 | TCMODULES += q_mqprio.o |
Eric Dumazet | 185d88f | 2012-05-10 20:22:35 +0000 | [diff] [blame] | 64 | TCMODULES += q_codel.o |
Eric Dumazet | c3524ef | 2012-05-11 09:49:50 +0000 | [diff] [blame] | 65 | TCMODULES += q_fq_codel.o |
Eric Dumazet | bc113e4 | 2013-08-29 19:30:36 -0700 | [diff] [blame] | 66 | TCMODULES += q_fq.o |
Vijay Subramanian | 80dd880 | 2014-01-07 22:00:39 -0800 | [diff] [blame] | 67 | TCMODULES += q_pie.o |
Terry Lam | ac74bd2 | 2014-05-09 12:10:47 -0700 | [diff] [blame] | 68 | TCMODULES += q_hhf.o |
Daniel Borkmann | 8f9afdd | 2016-01-12 01:42:20 +0100 | [diff] [blame] | 69 | TCMODULES += q_clsact.o |
Daniel Borkmann | 4bd6244 | 2015-04-16 21:20:06 +0200 | [diff] [blame] | 70 | TCMODULES += e_bpf.o |
Yotam Gigi | d5cbf3f | 2016-08-31 09:28:26 +0200 | [diff] [blame] | 71 | TCMODULES += f_matchall.o |
net[shemminger]!shemminger | 7e7c737 | 2005-01-17 23:32:51 +0000 | [diff] [blame] | 72 | |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 73 | TCSO := |
| 74 | ifeq ($(TC_CONFIG_ATM),y) |
| 75 | TCSO += q_atm.so |
| 76 | endif |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 77 | |
Daniel Borkmann | 4710e46 | 2016-10-18 14:13:09 +0200 | [diff] [blame] | 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 |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 84 | else |
Daniel Borkmann | 4710e46 | 2016-10-18 14:13:09 +0200 | [diff] [blame] | 85 | ifeq ($(TC_CONFIG_XT_OLD),y) |
| 86 | TCSO += m_xt_old.so |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 87 | else |
Daniel Borkmann | 4710e46 | 2016-10-18 14:13:09 +0200 | [diff] [blame] | 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 |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 94 | endif |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 95 | endif |
| 96 | endif |
| 97 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 98 | TCOBJ += $(TCMODULES) |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 99 | LDLIBS += -L. -ltc -lm |
| 100 | |
| 101 | ifeq ($(SHARED_LIBS),y) |
| 102 | LDLIBS += -ldl |
| 103 | LDFLAGS += -Wl,-export-dynamic |
| 104 | endif |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 105 | |
| 106 | TCLIB := tc_core.o |
| 107 | TCLIB += tc_red.o |
| 108 | TCLIB += tc_cbq.o |
| 109 | TCLIB += tc_estimator.o |
Jussi Kivilinna | 839c845 | 2008-07-25 16:19:09 +0300 | [diff] [blame] | 110 | TCLIB += tc_stab.o |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 111 | |
osdl.net!shemminger | 9bf19a8 | 2004-08-30 21:20:10 +0000 | [diff] [blame] | 112 | CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB |
Andreas Henriksson | 12ddfff | 2010-03-11 10:54:31 +0000 | [diff] [blame] | 113 | ifneq ($(IPT_LIB_DIR),) |
| 114 | CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" |
| 115 | endif |
osdl.net!shemminger | 9bf19a8 | 2004-08-30 21:20:10 +0000 | [diff] [blame] | 116 | |
shemminger | c0fc3ab | 2005-06-23 20:16:43 +0000 | [diff] [blame] | 117 | YACC := bison |
| 118 | LEX := flex |
Stephen Hemminger | 155ad80 | 2012-01-03 13:55:59 -0800 | [diff] [blame] | 119 | CFLAGS += -DYY_NO_INPUT |
shemminger | c0fc3ab | 2005-06-23 20:16:43 +0000 | [diff] [blame] | 120 | |
Christoph J. Thompson | 5c434a9 | 2012-03-01 17:46:26 +0100 | [diff] [blame] | 121 | MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 122 | |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 123 | %.so: %.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 124 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 125 | |
osdl.net!shemminger | a2218e8 | 2004-08-23 20:21:21 +0000 | [diff] [blame] | 126 | |
osdl.net!shemminger | 6cc2f07 | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 127 | all: libtc.a tc $(TCSO) |
site!shemminger | d5b4855 | 2005-02-07 18:01:21 +0000 | [diff] [blame] | 128 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 129 | tc: $(TCOBJ) $(TCLIB) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 130 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
net[shemminger]!shemminger | 8e64f6f | 2004-08-30 21:07:09 +0000 | [diff] [blame] | 131 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 132 | libtc.a: $(TCLIB) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 133 | $(QUIET_AR)$(AR) rcs $@ $(TCLIB) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 134 | |
| 135 | install: all |
Mike Frysinger | bf51268 | 2010-06-09 14:52:03 +0000 | [diff] [blame] | 136 | mkdir -p $(MODDESTDIR) |
| 137 | install -m 0755 tc $(DESTDIR)$(SBINDIR) |
osdl.net!shemminger | 69286fe | 2004-08-30 20:54:46 +0000 | [diff] [blame] | 138 | for i in $(TCSO); \ |
Mike Frysinger | bf51268 | 2010-06-09 14:52:03 +0000 | [diff] [blame] | 139 | do install -m 755 $$i $(MODDESTDIR); \ |
osdl.net!shemminger | a2218e8 | 2004-08-23 20:21:21 +0000 | [diff] [blame] | 140 | done |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 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 |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 148 | |
| 149 | clean: |
shemminger | 87773db | 2005-06-23 17:23:53 +0000 | [diff] [blame] | 150 | rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ |
Stephen Hemminger | 93ba481 | 2011-11-02 16:39:36 -0700 | [diff] [blame] | 151 | rm -f emp_ematch.yacc.* |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 152 | |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 153 | q_atm.so: q_atm.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 154 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 155 | |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 156 | m_xt.so: m_xt.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 157 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt.so m_xt.c $$($(PKG_CONFIG) xtables --cflags --libs) |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 158 | |
| 159 | m_xt_old.so: m_xt_old.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 160 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic -o m_xt_old.so m_xt_old.c $$($(PKG_CONFIG) xtables --cflags --libs) |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 161 | |
Benjamin Poirier | 5ab3a4d | 2013-02-06 11:19:24 +0000 | [diff] [blame] | 162 | em_ipset.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags) |
| 163 | |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 164 | %.yacc.c: %.y |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 165 | $(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $< |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 166 | |
| 167 | %.lex.c: %.l |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 168 | $(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $< |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 169 | |
Mike Frysinger | aa48b59 | 2011-10-18 17:38:08 -0400 | [diff] [blame] | 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 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 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 |