• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1GENLOBJ=genl.o
2
3include ../Config
4SHARED_LIBS ?= y
5
6CFLAGS += -fno-strict-aliasing
7
8GENLMODULES :=
9GENLMODULES += ctrl.o
10
11GENLOBJ += $(GENLMODULES)
12
13GENLLIB :=
14
15ifeq ($(SHARED_LIBS),y)
16LDFLAGS += -Wl,-export-dynamic
17LDLIBS  += -lm -ldl
18endif
19
20all: genl
21
22genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB)
23
24install: all
25	install -m 0755 genl $(DESTDIR)$(SBINDIR)
26
27clean:
28	rm -f $(GENLOBJ) $(GENLLIB) genl
29
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
41