]>
Commit | Line | Data |
---|---|---|
6054c1eb | 1 | # SPDX-License-Identifier: GPL-2.0 |
65018ae4 JHS |
2 | GENLOBJ=genl.o |
3 | ||
5f1df307 | 4 | include ../config.mk |
f2e27cfb | 5 | SHARED_LIBS ?= y |
65018ae4 | 6 | |
46dc73a5 SH |
7 | CFLAGS += -fno-strict-aliasing |
8 | ||
65018ae4 JHS |
9 | GENLMODULES := |
10 | GENLMODULES += ctrl.o | |
11 | ||
12 | GENLOBJ += $(GENLMODULES) | |
13 | ||
14 | GENLLIB := | |
15 | ||
f2e27cfb | 16 | ifeq ($(SHARED_LIBS),y) |
a18fa24a SH |
17 | LDFLAGS += -Wl,-export-dynamic |
18 | LDLIBS += -lm -ldl | |
f2e27cfb | 19 | endif |
65018ae4 JHS |
20 | |
21 | all: genl | |
22 | ||
23 | genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB) | |
57bdf8b7 | 24 | $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ |
65018ae4 JHS |
25 | |
26 | install: all | |
a18fa24a | 27 | install -m 0755 genl $(DESTDIR)$(SBINDIR) |
65018ae4 JHS |
28 | |
29 | clean: | |
30 | rm -f $(GENLOBJ) $(GENLLIB) genl | |
f2e27cfb MF |
31 | |
32 | ifneq ($(SHARED_LIBS),y) | |
33 | ||
34 | genl: static-syms.o | |
35 | static-syms.o: static-syms.h | |
36 | static-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 | ||
42 | endif |