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 \ |
| 2 | tc_exec.o tc_bpf.o m_police.o m_estimator.o m_action.o m_ematch.o \ |
| 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 |
net[shemminger]!shemminger | 7e7c737 | 2005-01-17 23:32:51 +0000 | [diff] [blame] | 53 | TCMODULES += p_ip.o |
| 54 | TCMODULES += p_icmp.o |
| 55 | TCMODULES += p_tcp.o |
| 56 | TCMODULES += p_udp.o |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 57 | TCMODULES += em_nbyte.o |
| 58 | TCMODULES += em_cmp.o |
| 59 | TCMODULES += em_u32.o |
Rostislav Lisovy | 7b5f30e | 2012-08-20 13:11:55 -0700 | [diff] [blame] | 60 | TCMODULES += em_canid.o |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 61 | TCMODULES += em_meta.o |
John Fastabend | 9149530 | 2011-04-12 08:57:27 -0700 | [diff] [blame] | 62 | TCMODULES += q_mqprio.o |
Eric Dumazet | 185d88f | 2012-05-10 20:22:35 +0000 | [diff] [blame] | 63 | TCMODULES += q_codel.o |
Eric Dumazet | c3524ef | 2012-05-11 09:49:50 +0000 | [diff] [blame] | 64 | TCMODULES += q_fq_codel.o |
Eric Dumazet | bc113e4 | 2013-08-29 19:30:36 -0700 | [diff] [blame] | 65 | TCMODULES += q_fq.o |
Vijay Subramanian | 80dd880 | 2014-01-07 22:00:39 -0800 | [diff] [blame] | 66 | TCMODULES += q_pie.o |
Terry Lam | ac74bd2 | 2014-05-09 12:10:47 -0700 | [diff] [blame] | 67 | TCMODULES += q_hhf.o |
Daniel Borkmann | 8f9afdd | 2016-01-12 01:42:20 +0100 | [diff] [blame] | 68 | TCMODULES += q_clsact.o |
Daniel Borkmann | 4bd6244 | 2015-04-16 21:20:06 +0200 | [diff] [blame] | 69 | TCMODULES += e_bpf.o |
Yotam Gigi | d5cbf3f | 2016-08-31 09:28:26 +0200 | [diff] [blame] | 70 | TCMODULES += f_matchall.o |
net[shemminger]!shemminger | 7e7c737 | 2005-01-17 23:32:51 +0000 | [diff] [blame] | 71 | |
Florian Westphal | 8194411 | 2012-08-09 09:18:50 +0000 | [diff] [blame] | 72 | ifeq ($(TC_CONFIG_IPSET), y) |
Matt Burgess | 92905c6 | 2012-10-02 19:01:32 +0100 | [diff] [blame] | 73 | ifeq ($(TC_CONFIG_XT), y) |
| 74 | TCMODULES += em_ipset.o |
| 75 | endif |
Florian Westphal | 8194411 | 2012-08-09 09:18:50 +0000 | [diff] [blame] | 76 | endif |
| 77 | |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 78 | TCSO := |
| 79 | ifeq ($(TC_CONFIG_ATM),y) |
| 80 | TCSO += q_atm.so |
| 81 | endif |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 82 | |
| 83 | ifeq ($(TC_CONFIG_XT),y) |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 84 | TCSO += m_xt.so |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 85 | else |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 86 | ifeq ($(TC_CONFIG_XT_OLD),y) |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 87 | TCSO += m_xt_old.so |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 88 | else |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 89 | ifeq ($(TC_CONFIG_XT_OLD_H),y) |
| 90 | CFLAGS += -DTC_CONFIG_XT_H |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 91 | TCSO += m_xt_old.so |
Andreas Henriksson | 80d689d | 2009-12-02 16:11:21 +0100 | [diff] [blame] | 92 | else |
| 93 | TCMODULES += m_ipt.o |
| 94 | endif |
Jamal Hadi Salim | 63c7d26 | 2009-02-07 08:19:20 -0500 | [diff] [blame] | 95 | endif |
| 96 | endif |
| 97 | |
Daniel Borkmann | 11c39b5 | 2015-03-16 19:37:41 +0100 | [diff] [blame] | 98 | ifeq ($(TC_CONFIG_ELF),y) |
| 99 | CFLAGS += -DHAVE_ELF |
| 100 | LDLIBS += -lelf |
| 101 | endif |
| 102 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 103 | TCOBJ += $(TCMODULES) |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 104 | LDLIBS += -L. -ltc -lm |
| 105 | |
| 106 | ifeq ($(SHARED_LIBS),y) |
| 107 | LDLIBS += -ldl |
| 108 | LDFLAGS += -Wl,-export-dynamic |
| 109 | endif |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 110 | |
| 111 | TCLIB := tc_core.o |
| 112 | TCLIB += tc_red.o |
| 113 | TCLIB += tc_cbq.o |
| 114 | TCLIB += tc_estimator.o |
Jussi Kivilinna | 839c845 | 2008-07-25 16:19:09 +0300 | [diff] [blame] | 115 | TCLIB += tc_stab.o |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 116 | |
osdl.net!shemminger | 9bf19a8 | 2004-08-30 21:20:10 +0000 | [diff] [blame] | 117 | CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB |
Andreas Henriksson | 12ddfff | 2010-03-11 10:54:31 +0000 | [diff] [blame] | 118 | ifneq ($(IPT_LIB_DIR),) |
| 119 | CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\" |
| 120 | endif |
osdl.net!shemminger | 9bf19a8 | 2004-08-30 21:20:10 +0000 | [diff] [blame] | 121 | |
shemminger | c0fc3ab | 2005-06-23 20:16:43 +0000 | [diff] [blame] | 122 | YACC := bison |
| 123 | LEX := flex |
Stephen Hemminger | 155ad80 | 2012-01-03 13:55:59 -0800 | [diff] [blame] | 124 | CFLAGS += -DYY_NO_INPUT |
shemminger | c0fc3ab | 2005-06-23 20:16:43 +0000 | [diff] [blame] | 125 | |
Christoph J. Thompson | 5c434a9 | 2012-03-01 17:46:26 +0100 | [diff] [blame] | 126 | MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 127 | |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 128 | %.so: %.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 129 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -shared -fpic $< -o $@ |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 130 | |
osdl.net!shemminger | a2218e8 | 2004-08-23 20:21:21 +0000 | [diff] [blame] | 131 | |
osdl.net!shemminger | 6cc2f07 | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 132 | all: libtc.a tc $(TCSO) |
site!shemminger | d5b4855 | 2005-02-07 18:01:21 +0000 | [diff] [blame] | 133 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 134 | tc: $(TCOBJ) $(TCLIB) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 135 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
net[shemminger]!shemminger | 8e64f6f | 2004-08-30 21:07:09 +0000 | [diff] [blame] | 136 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 137 | libtc.a: $(TCLIB) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 138 | $(QUIET_AR)$(AR) rcs $@ $(TCLIB) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 139 | |
| 140 | install: all |
Mike Frysinger | bf51268 | 2010-06-09 14:52:03 +0000 | [diff] [blame] | 141 | mkdir -p $(MODDESTDIR) |
| 142 | install -m 0755 tc $(DESTDIR)$(SBINDIR) |
osdl.net!shemminger | 69286fe | 2004-08-30 20:54:46 +0000 | [diff] [blame] | 143 | for i in $(TCSO); \ |
Mike Frysinger | bf51268 | 2010-06-09 14:52:03 +0000 | [diff] [blame] | 144 | do install -m 755 $$i $(MODDESTDIR); \ |
osdl.net!shemminger | a2218e8 | 2004-08-23 20:21:21 +0000 | [diff] [blame] | 145 | done |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 146 | if [ ! -f $(MODDESTDIR)/m_ipt.so ]; then \ |
| 147 | if [ -f $(MODDESTDIR)/m_xt.so ]; \ |
| 148 | then ln -s m_xt.so $(MODDESTDIR)/m_ipt.so ; \ |
| 149 | elif [ -f $(MODDESTDIR)/m_xt_old.so ]; \ |
| 150 | then ln -s m_xt_old.so $(MODDESTDIR)/m_ipt.so ; \ |
| 151 | fi; \ |
| 152 | fi |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 153 | |
| 154 | clean: |
shemminger | 87773db | 2005-06-23 17:23:53 +0000 | [diff] [blame] | 155 | rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \ |
Stephen Hemminger | 93ba481 | 2011-11-02 16:39:36 -0700 | [diff] [blame] | 156 | rm -f emp_ematch.yacc.* |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 157 | |
osdl.net!shemminger | d3ea2e8 | 2004-07-02 17:47:53 +0000 | [diff] [blame] | 158 | q_atm.so: q_atm.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 159 | $(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] | 160 | |
Andreas Henriksson | ab814d6 | 2010-04-12 20:24:23 +0200 | [diff] [blame] | 161 | m_xt.so: m_xt.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 162 | $(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] | 163 | |
| 164 | m_xt_old.so: m_xt_old.c |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 165 | $(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] | 166 | |
Benjamin Poirier | 5ab3a4d | 2013-02-06 11:19:24 +0000 | [diff] [blame] | 167 | em_ipset.o: CFLAGS += $$($(PKG_CONFIG) xtables --cflags) |
| 168 | |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 169 | %.yacc.c: %.y |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 170 | $(QUIET_YACC)$(YACC) $(YACCFLAGS) -o $@ $< |
shemminger | 9ddbb02 | 2005-06-23 17:21:46 +0000 | [diff] [blame] | 171 | |
| 172 | %.lex.c: %.l |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 173 | $(QUIET_LEX)$(LEX) $(LEXFLAGS) -o$@ $< |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 174 | |
Mike Frysinger | aa48b59 | 2011-10-18 17:38:08 -0400 | [diff] [blame] | 175 | # our lexer includes the header from yacc, so make sure |
| 176 | # we don't attempt to compile it before the header has |
| 177 | # been generated as part of the yacc step. |
| 178 | emp_ematch.lex.o: emp_ematch.yacc.c |
| 179 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 180 | ifneq ($(SHARED_LIBS),y) |
| 181 | |
| 182 | tc: static-syms.o |
| 183 | static-syms.o: static-syms.h |
| 184 | static-syms.h: $(wildcard *.c) |
| 185 | files="$^" ; \ |
| 186 | for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ |
| 187 | sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ |
| 188 | done > $@ |
| 189 | |
| 190 | endif |