blob: 03d1f26a1cee51b5a263a0cc9abf17e2f35adfe3 [file] [log] [blame]
Jamal Hadi Salim65018ae2006-08-08 12:13:34 -07001GENLOBJ=genl.o
2
3include ../Config
Mike Frysingerf2e27cf2009-11-06 06:09:22 -05004SHARED_LIBS ?= y
Jamal Hadi Salim65018ae2006-08-08 12:13:34 -07005
Stephen Hemminger46dc73a2011-03-09 10:39:17 -08006CFLAGS += -fno-strict-aliasing
7
Jamal Hadi Salim65018ae2006-08-08 12:13:34 -07008GENLMODULES :=
9GENLMODULES += ctrl.o
10
11GENLOBJ += $(GENLMODULES)
12
13GENLLIB :=
14
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050015ifeq ($(SHARED_LIBS),y)
Stephen Hemmingera18fa242006-10-19 13:13:20 -070016LDFLAGS += -Wl,-export-dynamic
17LDLIBS += -lm -ldl
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050018endif
Jamal Hadi Salim65018ae2006-08-08 12:13:34 -070019
20all: genl
21
22genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB)
23
24install: all
Stephen Hemmingera18fa242006-10-19 13:13:20 -070025 install -m 0755 genl $(DESTDIR)$(SBINDIR)
Jamal Hadi Salim65018ae2006-08-08 12:13:34 -070026
27clean:
28 rm -f $(GENLOBJ) $(GENLLIB) genl
Mike Frysingerf2e27cf2009-11-06 06:09:22 -050029
30ifneq ($(SHARED_LIBS),y)
31
32genl: static-syms.o
33static-syms.o: static-syms.h
34static-syms.h: $(wildcard *.c)
35 files="$^" ; \
36 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
37 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
38 done > $@
39
40endif