]>
Commit | Line | Data |
---|---|---|
d627ab69 VB |
1 | AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS) |
2 | AM_CPPFLAGS = $(LLDP_CPPFLAGS) | |
e6515ff5 | 3 | AM_LDFLAGS = $(LLDP_LDFLAGS) |
03ee074d | 4 | |
4b292b55 VB |
5 | lib_LTLIBRARIES = liblldpctl.la |
6 | include_HEADERS = lldpctl.h | |
7 | ||
f17837f7 VB |
8 | noinst_LTLIBRARIES = libfixedpoint.la |
9 | libfixedpoint_la_SOURCES = fixedpoint.h fixedpoint.c | |
10 | ||
d954509e | 11 | ATOM_FILES = \ |
94c98157 | 12 | atoms/config.c atoms/dot1.c atoms/dot3.c \ |
c576fd21 | 13 | atoms/interface.c atoms/med.c atoms/mgmt.c atoms/port.c \ |
99ef55d3 | 14 | atoms/custom.c atoms/chassis.c |
d954509e VB |
15 | liblldpctl_la_SOURCES = \ |
16 | lldpctl.h atom.h helpers.h \ | |
e3783368 | 17 | errors.c connection.c atom.c helpers.c \ |
d954509e | 18 | $(ATOM_FILES) |
2c18cfb8 | 19 | nodist_liblldpctl_la_SOURCES = atom-glue.c |
f17837f7 | 20 | liblldpctl_la_LIBADD = $(top_builddir)/src/libcommon-daemon-lib.la libfixedpoint.la |
4b292b55 | 21 | |
2c18cfb8 | 22 | atom-glue.c: $(ATOM_FILES) Makefile |
106aa50d | 23 | $(AM_V_GEN)(for f in $(ATOM_FILES:%=$(srcdir)/%); do \ |
2a64d539 | 24 | $(CC) -E $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
106aa50d | 25 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \ |
e3783368 VB |
26 | $(SED) -n 's+^void init_atom_builder_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \ |
27 | sort | \ | |
d954509e | 28 | $(AWK) '{ atoms[$$2] = 1 } \ |
2c18cfb8 VB |
29 | END { for (atom in atoms) { print "void init_atom_builder_"atom"(void);" } \ |
30 | print "void init_atom_builder() {"; \ | |
d954509e VB |
31 | print " static int init = 0; if (init) return; init++;"; \ |
32 | for (atom in atoms) { print " init_atom_builder_"atom"();" } \ | |
33 | print "}"; }' && \ | |
106aa50d | 34 | for f in $(ATOM_FILES:%=$(srcdir)/%); do \ |
2a64d539 | 35 | $(CC) -E $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
106aa50d | 36 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \ |
e3783368 | 37 | $(SED) -n 's+^void init_atom_map_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \ |
d954509e VB |
38 | sort -n | \ |
39 | $(AWK) '{ atoms[$$2] = 1 } \ | |
2c18cfb8 VB |
40 | END { for (atom in atoms) { print "void init_atom_map_"atom"(void);" } \ |
41 | print "void init_atom_map() {"; \ | |
d954509e VB |
42 | print " static int init = 0; if (init) return; init++;"; \ |
43 | for (atom in atoms) { print " init_atom_map_"atom"();" } \ | |
44 | print "}"; }' ) \ | |
45 | > $@.tmp | |
b921abc2 VB |
46 | $(AM_V_at)$(GREP) -q init_atom_builder_ $@.tmp |
47 | $(AM_V_at)$(GREP) -q init_atom_map_ $@.tmp | |
48 | $(AM_V_at)mv $@.tmp $@ | |
2c18cfb8 | 49 | CLEANFILES = atom-glue.c |
d954509e | 50 | |
4b292b55 | 51 | # -version-info format is `current`:`revision`:`age`. For more details, see: |
81291d63 | 52 | # https://www.sourceware.org/autobook/autobook/autobook_61.html#Library-Versioning |
f571f2db VB |
53 | # |
54 | # -version-number could be computed from -version-info, mostly major | |
55 | # is `current` - `age`, minor is `age` and revision is `revision' and | |
56 | # major.minor should be used when updaing lldpctl.map. | |
9d7e82a1 | 57 | liblldpctl_la_LDFLAGS = $(AM_LDFLAGS) -version-info 13:0:9 |
f571f2db VB |
58 | liblldpctl_la_DEPENDENCIES = libfixedpoint.la |
59 | ||
60 | if HAVE_LD_VERSION_SCRIPT | |
61 | liblldpctl_la_DEPENDENCIES += lldpctl.map | |
62 | liblldpctl_la_LDFLAGS += -Wl,--version-script=$(srcdir)/lldpctl.map | |
63 | else | |
64 | liblldpctl_la_LDFLAGS += -export-symbols-regex '^lldpctl_' | |
65 | endif | |
4b292b55 | 66 | |
4b292b55 | 67 | pkgconfig_DATA = lldpctl.pc |
95493844 VB |
68 | |
69 | TEMPLATES = lldpctl.pc | |
e92d8842 | 70 | EXTRA_DIST = lldpctl.pc.in lldpctl.map |
d954509e | 71 | CLEANFILES += $(TEMPLATES) |
95493844 VB |
72 | lldpctl.pc: lldpctl.pc.in |
73 | include $(top_srcdir)/edit.am |