1 GENLOBJ=genl.o 2 3 include ../Config 4 SHARED_LIBS ?= y 5 6 GENLMODULES := 7 GENLMODULES += ctrl.o 8 9 GENLOBJ += $(GENLMODULES) 10 11 GENLLIB := 12 13 ifeq ($(SHARED_LIBS),y) 14 LDFLAGS += -Wl,-export-dynamic 15 LDLIBS += -lm -ldl 16 endif 17 18 all: genl 19 20 genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB) 21 22 install: all 23 install -m 0755 genl $(DESTDIR)$(SBINDIR) 24 25 clean: 26 rm -f $(GENLOBJ) $(GENLLIB) genl 27 28 ifneq ($(SHARED_LIBS),y) 29 30 genl: static-syms.o 31 static-syms.o: static-syms.h 32 static-syms.h: $(wildcard *.c) 33 files="$^" ; \ 34 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 35 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 36 done > $@ 37 38 endif 39