1 IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.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 \ 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 7 RTMONOBJ=rtmon.o 8 9 ALLOBJ=$(IPOBJ) $(RTMONOBJ) 10 SCRIPTS=ifcfg rtpr routel routef 11 TARGETS=ip rtmon 12 13 all: $(TARGETS) $(SCRIPTS) $(LIBS) 14 15 ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL) 16 17 rtmon: $(RTMONOBJ) $(LIBNETLINK) 18 19 install: all 20 install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR) 21 install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR) 22 23 clean: 24 rm -f $(ALLOBJ) $(TARGETS) 25 26 SHARED_LIBS ?= y 27 ifeq ($(SHARED_LIBS),y) 28 29 LDLIBS += -ldl 30 LDFLAGS += -Wl,-export-dynamic 31 32 else 33 34 ip: static-syms.o 35 static-syms.o: static-syms.h 36 static-syms.h: $(wildcard *.c) 37 files="$^" ; \ 38 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 39 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 40 done > $@ 41 42 endif 43