Eric W. Biederman | 0dc34c7 | 2011-07-13 09:48:26 -0700 | [diff] [blame] | 1 | IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ |
Masahide NAKAMURA | 288384f | 2006-11-24 12:27:09 +0900 | [diff] [blame] | 2 | rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \ |
Daniel Borkmann | 191b60b | 2013-04-30 06:22:50 +0000 | [diff] [blame] | 3 | ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \ |
Stephen Hemminger | e32d4db | 2007-10-11 13:01:42 -0700 | [diff] [blame] | 4 | ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \ |
Daniel Borkmann | c7272ca | 2016-12-06 02:21:57 +0100 | [diff] [blame] | 5 | iplink_vlan.o link_veth.o link_gre.o iplink_can.o iplink_xdp.o \ |
Phil Sutter | 541f1b3 | 2015-09-25 14:09:49 +0200 | [diff] [blame] | 6 | iplink_macvlan.o ipl2tp.o link_vti.o link_vti6.o \ |
Nicolas Dichtel | 1ce2de9 | 2012-12-12 10:51:47 +0100 | [diff] [blame] | 7 | iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \ |
Jiri Pirko | 8c39db3 | 2014-09-28 16:31:04 -0700 | [diff] [blame] | 8 | link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \ |
John W. Linville | 908755d | 2015-05-08 13:27:08 -0400 | [diff] [blame] | 9 | iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \ |
David Ahern | 1949f82 | 2016-12-11 16:53:15 -0800 | [diff] [blame] | 10 | iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \ |
| 11 | ipvrf.o |
Patrick McHardy | 5c302d5 | 2007-09-01 18:47:19 +0200 | [diff] [blame] | 12 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 13 | RTMONOBJ=rtmon.o |
| 14 | |
Eric W. Biederman | 2e8a07f | 2011-07-15 14:26:59 +0000 | [diff] [blame] | 15 | include ../Config |
| 16 | |
| 17 | ifeq ($(IP_CONFIG_SETNS),y) |
| 18 | CFLAGS += -DHAVE_SETNS |
| 19 | endif |
| 20 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 21 | ALLOBJ=$(IPOBJ) $(RTMONOBJ) |
osdl.net!shemminger | 03ffadf | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 22 | SCRIPTS=ifcfg rtpr routel routef |
| 23 | TARGETS=ip rtmon |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 24 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 25 | all: $(TARGETS) $(SCRIPTS) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 26 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 27 | ip: $(IPOBJ) $(LIBNETLINK) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 28 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 29 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 30 | rtmon: $(RTMONOBJ) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 31 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 32 | |
| 33 | install: all |
Mike Frysinger | 418a217 | 2008-03-16 04:27:01 -0400 | [diff] [blame] | 34 | install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) |
osdl.net!shemminger | 03ffadf | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 35 | install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 36 | |
| 37 | clean: |
| 38 | rm -f $(ALLOBJ) $(TARGETS) |
| 39 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 40 | SHARED_LIBS ?= y |
| 41 | ifeq ($(SHARED_LIBS),y) |
Vitaliy Gusev | d84914a | 2007-12-17 16:06:38 +0300 | [diff] [blame] | 42 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 43 | LDLIBS += -ldl |
Vitaliy Gusev | d84914a | 2007-12-17 16:06:38 +0300 | [diff] [blame] | 44 | LDFLAGS += -Wl,-export-dynamic |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 45 | |
| 46 | else |
| 47 | |
| 48 | ip: static-syms.o |
| 49 | static-syms.o: static-syms.h |
| 50 | static-syms.h: $(wildcard *.c) |
| 51 | files="$^" ; \ |
| 52 | for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ |
| 53 | sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ |
| 54 | done > $@ |
| 55 | |
| 56 | endif |