• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1IPOBJ=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
7RTMONOBJ=rtmon.o
8
9ALLOBJ=$(IPOBJ) $(RTMONOBJ)
10SCRIPTS=ifcfg rtpr routel routef
11TARGETS=ip rtmon
12
13all: $(TARGETS) $(SCRIPTS) $(LIBS)
14
15ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL)
16
17rtmon: $(RTMONOBJ) $(LIBNETLINK)
18
19install: all
20	install -m 0755 $(TARGETS) $(DESTDIR)$(SBINDIR)
21	install -m 0755 $(SCRIPTS) $(DESTDIR)$(SBINDIR)
22
23clean:
24	rm -f $(ALLOBJ) $(TARGETS)
25
26SHARED_LIBS ?= y
27ifeq ($(SHARED_LIBS),y)
28
29LDLIBS += -ldl
30LDFLAGS += -Wl,-export-dynamic
31
32else
33
34ip: static-syms.o
35static-syms.o: static-syms.h
36static-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
42endif
43