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