1 IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \ 2 rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \ 3 ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \ 4 ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \ 5 iplink_vlan.o link_veth.o link_gre.o iplink_can.o \ 6 iplink_macvlan.o ipl2tp.o link_vti.o link_vti6.o \ 7 iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \ 8 link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \ 9 iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \ 10 iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o 11 12 RTMONOBJ=rtmon.o 13 14 include ../Config 15 16 ifeq ($(IP_CONFIG_SETNS),y) 17 CFLAGS += -DHAVE_SETNS 18 endif 19 20 ALLOBJ=$(IPOBJ) $(RTMONOBJ) 21 SCRIPTS=ifcfg rtpr routel routef 22 TARGETS=ip rtmon 23 24 all: $(TARGETS) $(SCRIPTS) 25 26 ip: $(IPOBJ) $(LIBNETLINK) 27 28 rtmon: $(RTMONOBJ) 29 30 install: all 31 install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) 32 install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR) 33 34 clean: 35 rm -f $(ALLOBJ) $(TARGETS) 36 37 SHARED_LIBS ?= y 38 ifeq ($(SHARED_LIBS),y) 39 40 LDLIBS += -ldl 41 LDFLAGS += -Wl,-export-dynamic 42 43 else 44 45 ip: static-syms.o 46 static-syms.o: static-syms.h 47 static-syms.h: $(wildcard *.c) 48 files="$^" ; \ 49 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 50 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 51 done > $@ 52 53 endif 54