]> git.ipfire.org Git - thirdparty/lldpd.git/blob - src/daemon/Makefile.am
interfaces: move bitmaps function to a dedicated file
[thirdparty/lldpd.git] / src / daemon / Makefile.am
1 AM_CFLAGS = -I $(top_srcdir)/include $(LLDP_CFLAGS)
2 AM_CPPFLAGS = $(LLDP_CPPFLAGS)
3 AM_LDFLAGS = $(LLDP_LDFLAGS)
4 BUILT_SOURCES =
5 CLEANFILES =
6
7 sbin_PROGRAMS = lldpd
8 man_MANS = lldpd.8
9
10 noinst_LTLIBRARIES = liblldpd.la
11
12 ## Convenience library for lldpd and tests
13 nodist_liblldpd_la_SOURCES =
14 liblldpd_la_SOURCES = \
15 frame.h frame.c \
16 lldp-tlv.h \
17 client.c \
18 priv.c \
19 privsep.c privsep_io.c privsep_fd.c \
20 interfaces.c \
21 event.c lldpd.c \
22 pattern.c \
23 bitmap.c \
24 probes.d trace.h \
25 protocols/lldp.c \
26 protocols/cdp.c \
27 protocols/cdp.h \
28 protocols/sonmp.c \
29 protocols/sonmp.h \
30 protocols/edp.c \
31 protocols/edp.h
32 liblldpd_la_CFLAGS = $(AM_CFLAGS) @libevent_CFLAGS@ @libcap_CFLAGS@
33 liblldpd_la_CPPFLAGS = $(AM_CPPFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' -DLLDPCLI_PATH='"$(sbindir)/lldpcli"'
34 liblldpd_la_LIBADD = \
35 $(top_builddir)/src/libcommon-daemon-client.la \
36 $(top_builddir)/src/libcommon-daemon-lib.la @libevent_LIBS@ @libcap_LIBS@
37
38 ## lldpd
39 lldpd_SOURCES = main.c
40 lldpd_LDFLAGS = $(AM_LDFLAGS) $(LLDP_BIN_LDFLAGS)
41 lldpd_LDADD = liblldpd.la @libevent_LDFLAGS@
42
43 if HOST_OS_LINUX
44 liblldpd_la_SOURCES += \
45 forward-linux.c \
46 interfaces-linux.c \
47 netlink.c \
48 dmi-linux.c \
49 priv-linux.c
50 endif
51 if HOST_OS_DRAGONFLY
52 liblldpd_la_SOURCES += \
53 forward-bsd.c \
54 interfaces-bpf.c \
55 interfaces-bsd.c \
56 dmi-dummy.c \
57 priv-bsd.c
58 endif
59 if HOST_OS_FREEBSD
60 liblldpd_la_SOURCES += \
61 forward-bsd.c \
62 interfaces-bpf.c \
63 interfaces-bsd.c \
64 dmi-freebsd.c \
65 priv-bsd.c
66 endif
67 if HOST_OS_OPENBSD
68 liblldpd_la_SOURCES += \
69 interfaces-bpf.c \
70 forward-bsd.c \
71 interfaces-bsd.c \
72 dmi-openbsd.c \
73 priv-bsd.c
74 endif
75 if HOST_OS_NETBSD
76 liblldpd_la_SOURCES += \
77 forward-bsd.c \
78 interfaces-bpf.c \
79 interfaces-bsd.c \
80 dmi-dummy.c \
81 priv-bsd.c
82 endif
83 if HOST_OS_OSX
84 liblldpd_la_SOURCES += \
85 forward-bsd.c \
86 interfaces-bpf.c \
87 interfaces-bsd.c \
88 dmi-osx.c \
89 priv-bsd.c
90 liblldpd_la_LDFLAGS = $(AM_LDFLAGS)
91 liblldpd_la_LDFLAGS += -framework Foundation
92 liblldpd_la_LDFLAGS += -framework CoreFoundation -framework IOKit
93 liblldpd_la_LDFLAGS += -framework IOKit
94 endif
95 if HOST_OS_SOLARIS
96 liblldpd_la_SOURCES += \
97 forward-solaris.c \
98 interfaces-bpf.c \
99 interfaces-solaris.c \
100 dmi-dummy.c \
101 priv-bsd.c
102 endif
103
104 # seccomp support
105 if USE_SECCOMP
106 BUILT_SOURCES += syscall-names.h
107 CLEANFILES += syscall-names.h
108 syscall-names.h:
109 $(AM_V_GEN)
110 $(AM_V_at)echo "static const char *syscall_names[] = {" > $@ ;\
111 echo "#include <sys/syscall.h>" | cpp -dM | grep '^#define __NR_' | \
112 LC_ALL=C sed -r -n -e 's/^\#define[ \t]+__NR_([a-z0-9_]+)[ \t]+([0-9]+)(.*)/ [\2] = "\1",/p' >> $@ ;\
113 echo "};" >> $@
114 nodist_liblldpd_la_SOURCES += syscall-names.h
115 liblldpd_la_SOURCES += priv-seccomp.c
116 liblldpd_la_CFLAGS += @libseccomp_CFLAGS@
117 liblldpd_la_LIBADD += @libseccomp_LIBS@
118 endif
119
120 # Add SNMP support if needed
121 if USE_SNMP
122 noinst_LTLIBRARIES += liblldpd-snmp.la
123 liblldpd_snmp_la_SOURCES = agent.c agent_priv.c agent.h
124 liblldpd_snmp_la_CFLAGS = $(liblldpd_la_CFLAGS) @NETSNMP_CFLAGS@
125 liblldpd_snmp_la_CPPFLAGS = $(liblldpd_la_CPPFLAGS)
126 liblldpd_la_LIBADD += liblldpd-snmp.la
127 lldpd_LDADD += @NETSNMP_LIBS@
128 endif
129
130 ## Systemtap/DTrace
131 EXTRA_DIST = dtrace2systemtap.awk
132 if ENABLE_SYSTEMTAP
133 BUILT_SOURCES += probes.h
134 CLEANFILES += probes.h
135 probes.h: probes.d
136 $(AM_V_GEN)
137 $(AM_V_at)$(DTRACE) -C -h -s $< -o $@
138 probes.o: probes.d
139 $(AM_V_GEN)
140 $(AM_V_at)$(DTRACE) -C -G -s $< -o $@
141 lldpd_LDADD += probes.o
142
143 lldpd.stp: probes.d $(srcdir)/dtrace2systemtap.awk $(top_builddir)/config.status
144 $(AM_V_GEN)$(AWK) -f $(srcdir)/dtrace2systemtap.awk -v sbindir=$(sbindir) $< > $@ || ( rm -f $@ ; exit 1 )
145 tapsetdir = $(datadir)/systemtap/tapset
146 tapset_DATA = lldpd.stp
147 endif
148
149 ## libevent
150 if LIBEVENT_EMBEDDED
151 event.c: $(top_builddir)/libevent/libevent.la
152 $(top_builddir)/libevent/libevent.la: $(top_srcdir)/libevent/*.c $(top_srcdir)/libevent/*.h
153 (cd $(top_builddir)/libevent && $(MAKE))
154 endif
155
156 ## systemd service file
157 if HAVE_SYSTEMDSYSTEMUNITDIR
158 systemdsystemunit_DATA = lldpd.service
159 endif
160
161 if HAVE_SYSUSERSDIR
162 sysusers_DATA = lldpd.sysusers.conf
163 endif
164
165 if HOST_OS_LINUX
166 if HAVE_APPARMORDIR
167 apparmor_DATA = usr.sbin.lldpd
168 endif
169 endif
170
171 TEMPLATES = lldpd.8 lldpd.service lldpd.sysusers.conf usr.sbin.lldpd
172 EXTRA_DIST += lldpd.8.in lldpd.service.in lldpd.sysusers.conf.in usr.sbin.lldpd.in
173 CLEANFILES += $(TEMPLATES)
174 lldpd.8: lldpd.8.in
175 lldpd.service: lldpd.service.in
176 lldpd.sysusers.conf: lldpd.sysusers.conf.in
177 usr.sbin.lldpd: usr.sbin.lldpd.in
178 include $(top_srcdir)/edit.am