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