blob: 844639e42442a40440ba6076aca946202a7eb77b [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 \
Arnd Bergmannd63a9b22009-12-26 11:22:57 -08005 iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
Steffen Klassert2f7fbec2014-09-26 09:11:37 +02006 iplink_macvlan.o iplink_macvtap.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 \
9 iplink_bridge_slave.o
Patrick McHardy5c302d52007-09-01 18:47:19 +020010
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000011RTMONOBJ=rtmon.o
12
Eric W. Biederman2e8a07f2011-07-15 14:26:59 +000013include ../Config
14
15ifeq ($(IP_CONFIG_SETNS),y)
16 CFLAGS += -DHAVE_SETNS
17endif
18
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000019ALLOBJ=$(IPOBJ) $(RTMONOBJ)
osdl.net!shemminger03ffadf2005-02-09 22:05:41 +000020SCRIPTS=ifcfg rtpr routel routef
21TARGETS=ip rtmon
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000022
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010023all: $(TARGETS) $(SCRIPTS)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000024
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010025ip: $(IPOBJ) $(LIBNETLINK)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000026
Yegor Yefremov8ced4fc2012-02-27 15:21:15 +010027rtmon: $(RTMONOBJ)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000028
29install: all
Mike Frysinger418a2172008-03-16 04:27:01 -040030 install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)
osdl.net!shemminger03ffadf2005-02-09 22:05:41 +000031 install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000032
33clean:
34 rm -f $(ALLOBJ) $(TARGETS)
35
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050036SHARED_LIBS ?= y
37ifeq ($(SHARED_LIBS),y)
Vitaliy Gusevd84914a2007-12-17 16:06:38 +030038
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050039LDLIBS += -ldl
Vitaliy Gusevd84914a2007-12-17 16:06:38 +030040LDFLAGS += -Wl,-export-dynamic
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050041
42else
43
44ip: static-syms.o
45static-syms.o: static-syms.h
46static-syms.h: $(wildcard *.c)
47 files="$^" ; \
48 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
49 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
50 done > $@
51
52endif