Jamal Hadi Salim | 65018ae | 2006-08-08 12:13:34 -0700 | [diff] [blame] | 1 | GENLOBJ=genl.o |
| 2 | |
| 3 | include ../Config |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 4 | SHARED_LIBS ?= y |
Jamal Hadi Salim | 65018ae | 2006-08-08 12:13:34 -0700 | [diff] [blame] | 5 | |
Stephen Hemminger | 46dc73a | 2011-03-09 10:39:17 -0800 | [diff] [blame] | 6 | CFLAGS += -fno-strict-aliasing |
| 7 | |
Jamal Hadi Salim | 65018ae | 2006-08-08 12:13:34 -0700 | [diff] [blame] | 8 | GENLMODULES := |
| 9 | GENLMODULES += ctrl.o |
| 10 | |
| 11 | GENLOBJ += $(GENLMODULES) |
| 12 | |
| 13 | GENLLIB := |
| 14 | |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 15 | ifeq ($(SHARED_LIBS),y) |
Stephen Hemminger | a18fa24 | 2006-10-19 13:13:20 -0700 | [diff] [blame] | 16 | LDFLAGS += -Wl,-export-dynamic |
| 17 | LDLIBS += -lm -ldl |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 18 | endif |
Jamal Hadi Salim | 65018ae | 2006-08-08 12:13:34 -0700 | [diff] [blame] | 19 | |
| 20 | all: genl |
| 21 | |
| 22 | genl: $(GENLOBJ) $(LIBNETLINK) $(LIBUTIL) $(GENLLIB) |
| 23 | |
| 24 | install: all |
Stephen Hemminger | a18fa24 | 2006-10-19 13:13:20 -0700 | [diff] [blame] | 25 | install -m 0755 genl $(DESTDIR)$(SBINDIR) |
Jamal Hadi Salim | 65018ae | 2006-08-08 12:13:34 -0700 | [diff] [blame] | 26 | |
| 27 | clean: |
| 28 | rm -f $(GENLOBJ) $(GENLLIB) genl |
Mike Frysinger | f2e27cf | 2009-11-06 06:09:22 -0500 | [diff] [blame] | 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 |