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 \ |
Arnd Bergmann | d63a9b2 | 2009-12-26 11:22:57 -0800 | [diff] [blame] | 5 | iplink_vlan.o link_veth.o link_gre.o iplink_can.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 \ |
Tom Herbert | ec71cae | 2016-08-04 13:34:54 -0700 | [diff] [blame] | 10 | iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o |
Patrick McHardy | 5c302d5 | 2007-09-01 18:47:19 +0200 | [diff] [blame] | 11 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 12 | RTMONOBJ=rtmon.o |
| 13 | |
Eric W. Biederman | 2e8a07f | 2011-07-15 14:26:59 +0000 | [diff] [blame] | 14 | include ../Config |
| 15 | |
| 16 | ifeq ($(IP_CONFIG_SETNS),y) |
| 17 | CFLAGS += -DHAVE_SETNS |
| 18 | endif |
| 19 | |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 20 | ALLOBJ=$(IPOBJ) $(RTMONOBJ) |
osdl.net!shemminger | 03ffadf | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 21 | SCRIPTS=ifcfg rtpr routel routef |
| 22 | TARGETS=ip rtmon |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 23 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 24 | all: $(TARGETS) $(SCRIPTS) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 25 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 26 | ip: $(IPOBJ) $(LIBNETLINK) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 27 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 28 | |
Yegor Yefremov | 8ced4fc | 2012-02-27 15:21:15 +0100 | [diff] [blame] | 29 | rtmon: $(RTMONOBJ) |
David Ahern | 57bdf8b | 2016-05-24 15:04:49 -0700 | [diff] [blame] | 30 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 31 | |
| 32 | install: all |
Mike Frysinger | 418a217 | 2008-03-16 04:27:01 -0400 | [diff] [blame] | 33 | install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) |
osdl.net!shemminger | 03ffadf | 2005-02-09 22:05:41 +0000 | [diff] [blame] | 34 | install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 35 | |
| 36 | clean: |
| 37 | rm -f $(ALLOBJ) $(TARGETS) |
| 38 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 39 | SHARED_LIBS ?= y |
| 40 | ifeq ($(SHARED_LIBS),y) |
Vitaliy Gusev | d84914a | 2007-12-17 16:06:38 +0300 | [diff] [blame] | 41 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 42 | LDLIBS += -ldl |
Vitaliy Gusev | d84914a | 2007-12-17 16:06:38 +0300 | [diff] [blame] | 43 | LDFLAGS += -Wl,-export-dynamic |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 44 | |
| 45 | else |
| 46 | |
| 47 | ip: static-syms.o |
| 48 | static-syms.o: static-syms.h |
| 49 | static-syms.h: $(wildcard *.c) |
| 50 | files="$^" ; \ |
| 51 | for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ |
| 52 | sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ |
| 53 | done > $@ |
| 54 | |
| 55 | endif |