blob: 1928489e7f9095affe0425396b088a0a6d546efc [file] [log] [blame]
Eric W. Biederman0dc34c72011-07-13 09:48:26 -07001IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
Masahide NAKAMURA288384f2006-11-24 12:27:09 +09002 rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
Daniel Borkmann191b60b2013-04-30 06:22:50 +00003 ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \
Stephen Hemmingere32d4db2007-10-11 13:01:42 -07004 ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
Daniel Borkmannc7272ca2016-12-06 02:21:57 +01005 iplink_vlan.o link_veth.o link_gre.o iplink_can.o iplink_xdp.o \
Phil Sutter541f1b32015-09-25 14:09:49 +02006 iplink_macvlan.o ipl2tp.o link_vti.o link_vti6.o \
Nicolas Dichtel1ce2de92012-12-12 10:51:47 +01007 iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \
Jiri Pirko8c39db32014-09-28 16:31:04 -07008 link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \
John W. Linville908755d2015-05-08 13:27:08 -04009 iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \
David Ahern1949f822016-12-11 16:53:15 -080010 iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \
11 ipvrf.o
Patrick McHardy5c302d52007-09-01 18:47:19 +020012
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000013RTMONOBJ=rtmon.o
14
Eric W. Biederman2e8a07f2011-07-15 14:26:59 +000015include ../Config
16
17ifeq ($(IP_CONFIG_SETNS),y)
18 CFLAGS += -DHAVE_SETNS
19endif
20
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000021ALLOBJ=$(IPOBJ) $(RTMONOBJ)
osdl.net!shemminger03ffadf2005-02-09 22:05:41 +000022SCRIPTS=ifcfg rtpr routel routef
23TARGETS=ip rtmon
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000024
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010025all: $(TARGETS) $(SCRIPTS)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000026
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010027ip: $(IPOBJ) $(LIBNETLINK)
David Ahern57bdf8b2016-05-24 15:04:49 -070028 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000029
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010030rtmon: $(RTMONOBJ)
David Ahern57bdf8b2016-05-24 15:04:49 -070031 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000032
33install: all
Mike Frysinger418a2172008-03-16 04:27:01 -040034 install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)
osdl.net!shemminger03ffadf2005-02-09 22:05:41 +000035 install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000036
37clean:
38 rm -f $(ALLOBJ) $(TARGETS)
39
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050040SHARED_LIBS ?= y
41ifeq ($(SHARED_LIBS),y)
Vitaliy Gusevd84914a2007-12-17 16:06:38 +030042
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050043LDLIBS += -ldl
Vitaliy Gusevd84914a2007-12-17 16:06:38 +030044LDFLAGS += -Wl,-export-dynamic
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050045
46else
47
48ip: static-syms.o
49static-syms.o: static-syms.h
50static-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
56endif