netifd: update to latest git HEAD (FS#2087)
[openwrt/openwrt.git] / package / network / utils / iproute2 / patches / 190-link-libelf-to-tc-only.patch
1 --- a/configure
2 +++ b/configure
3 @@ -231,8 +231,9 @@ check_elf()
4 echo "HAVE_ELF:=y" >>$CONFIG
5 echo "yes"
6
7 - echo 'CFLAGS += -DHAVE_ELF' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
8 - echo 'LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
9 + echo 'CFLAGS += -DHAVE_ELF' >> $CONFIG
10 + echo 'ELF_CFLAGS += ' `${PKG_CONFIG} libelf --cflags` >> $CONFIG
11 + echo 'ELF_LDLIBS += ' `${PKG_CONFIG} libelf --libs` >>$CONFIG
12 else
13 echo "no"
14 fi
15 --- a/lib/Makefile
16 +++ b/lib/Makefile
17 @@ -11,9 +11,17 @@ UTILOBJ = utils.o rt_names.o ll_map.o ll
18 inet_proto.o namespace.o json_writer.o json_print.o \
19 names.o color.o bpf.o exec.o fs.o
20
21 +ELFOBJ=$(patsubst %.o,%.elf.o,$(UTILOBJ))
22 +
23 NLOBJ=libgenl.o libnetlink.o
24
25 -all: libnetlink.a libutil.a
26 +all: libnetlink.a libutil.a libutil-elf.a
27 +
28 +%.o: %.c
29 + $(QUIET_CC)$(CC) $(CFLAGS) -UHAVE_ELF $(EXTRA_CFLAGS) -c -o $@ $<
30 +
31 +%.elf.o: %.c
32 + $(QUIET_CC)$(CC) $(CFLAGS) $(ELF_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
33
34 libnetlink.a: $(NLOBJ)
35 $(QUIET_AR)$(AR) rcs $@ $^
36 @@ -21,7 +29,10 @@ libnetlink.a: $(NLOBJ)
37 libutil.a: $(UTILOBJ) $(ADDLIB)
38 $(QUIET_AR)$(AR) rcs $@ $^
39
40 +libutil-elf.a: $(ELFOBJ) $(ADDLIB)
41 + $(QUIET_AR)$(AR) rcs $@ $^
42 +
43 install:
44
45 clean:
46 - rm -f $(NLOBJ) $(UTILOBJ) $(ADDLIB) libnetlink.a libutil.a
47 + rm -f $(NLOBJ) $(UTILOBJ) $(ELFOBJ) $(ADDLIB) libnetlink.a libutil.a libutil-elf.a
48 --- a/tc/Makefile
49 +++ b/tc/Makefile
50 @@ -133,8 +133,8 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
51
52 all: tc $(TCSO)
53
54 -tc: $(TCOBJ) $(LIBNETLINK) libtc.a
55 - $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
56 +tc: $(TCOBJ) $(subst libutil.a,libutil-elf.a,$(LIBNETLINK)) libtc.a
57 + $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) $(ELF_LDLIBS) -o $@
58
59 libtc.a: $(TCLIB)
60 $(QUIET_AR)$(AR) rcs $@ $^