1 GENLOBJ=genl.o 2 3 include ../config.mk 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 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ 24 25 install: all 26 install -m 0755 genl $(DESTDIR)$(SBINDIR) 27 28 clean: 29 rm -f $(GENLOBJ) $(GENLLIB) genl 30 31 ifneq ($(SHARED_LIBS),y) 32 33 genl: static-syms.o 34 static-syms.o: static-syms.h 35 static-syms.h: $(wildcard *.c) 36 files="$^" ; \ 37 for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \ 38 sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \ 39 done > $@ 40 41 endif 42