1GENLOBJ=genl.o 2 3include ../config.mk 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 $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ 24 25install: all 26 install -m 0755 genl $(DESTDIR)$(SBINDIR) 27 28clean: 29 rm -f $(GENLOBJ) $(GENLLIB) genl 30 31ifneq ($(SHARED_LIBS),y) 32 33genl: static-syms.o 34static-syms.o: static-syms.h 35static-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 41endif 42