]> git.ipfire.org Git - thirdparty/lldpd.git/blob - src/daemon/Makefile.am
build: run cross-platforms test on ubuntu-latest
[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 syscall-names.h.tmp
108 syscall-names.h:
109 $(AM_V_GEN)
110 $(AM_V_at)echo "#include <sys/syscall.h>" | $(CPP) -dM - > $@.tmp ;\
111 echo "static const char *syscall_names[] = {" > $@ ;\
112 grep '^#define __NR_' $@.tmp | \
113 LC_ALL=C sed -r -n -e 's/^\#define[ \t]+__NR_([a-z0-9_]+)[ \t]+([0-9]+)(.*)/ [\2] = "\1",/p' >> $@ ;\
114 echo "};" >> $@ ;\
115 rm $@.tmp
116 nodist_liblldpd_la_SOURCES += syscall-names.h
117 liblldpd_la_SOURCES += priv-seccomp.c
118 liblldpd_la_CFLAGS += @libseccomp_CFLAGS@
119 liblldpd_la_LIBADD += @libseccomp_LIBS@
120 endif
121
122 # Add SNMP support if needed
123 if USE_SNMP
124 noinst_LTLIBRARIES += liblldpd-snmp.la
125 liblldpd_snmp_la_SOURCES = agent.c agent_priv.c agent.h
126 liblldpd_snmp_la_CFLAGS = $(liblldpd_la_CFLAGS) @NETSNMP_CFLAGS@
127 liblldpd_snmp_la_CPPFLAGS = $(liblldpd_la_CPPFLAGS)
128 liblldpd_la_LIBADD += liblldpd-snmp.la
129 lldpd_LDADD += @NETSNMP_LIBS@
130 endif
131
132 ## Systemtap/DTrace
133 EXTRA_DIST = dtrace2systemtap.awk
134 if ENABLE_SYSTEMTAP
135 BUILT_SOURCES += probes.h
136 CLEANFILES += probes.h lldpd.stp
137 probes.h: probes.d
138 $(AM_V_GEN)
139 $(AM_V_at)$(DTRACE) -C -h -s $< -o $@
140 probes.o: probes.d
141 $(AM_V_GEN)
142 $(AM_V_at)$(DTRACE) -C -G -s $< -o $@
143 lldpd_LDADD += probes.o
144
145 lldpd.stp: probes.d $(srcdir)/dtrace2systemtap.awk $(top_builddir)/config.status
146 $(AM_V_GEN)$(AWK) -f $(srcdir)/dtrace2systemtap.awk -v sbindir=$(sbindir) $< > $@ || ( rm -f $@ ; exit 1 )
147 tapsetdir = $(datadir)/systemtap/tapset
148 tapset_DATA = lldpd.stp
149 endif
150
151 ## libevent
152 if LIBEVENT_EMBEDDED
153 event.c: $(top_builddir)/libevent/libevent.la
154 $(top_builddir)/libevent/libevent.la: $(top_srcdir)/libevent/*.c $(top_srcdir)/libevent/*.h
155 (cd $(top_builddir)/libevent && $(MAKE))
156 endif
157
158 ## systemd service file
159 if HAVE_SYSTEMDSYSTEMUNITDIR
160 systemdsystemunit_DATA = lldpd.service
161 endif
162
163 if HAVE_SYSUSERSDIR
164 sysusers_DATA = lldpd.sysusers.conf
165 endif
166
167 if HOST_OS_LINUX
168 if HAVE_APPARMORDIR
169 apparmor_DATA = usr.sbin.lldpd
170 endif
171 endif
172
173 TEMPLATES = lldpd.8 lldpd.service lldpd.sysusers.conf usr.sbin.lldpd
174 EXTRA_DIST += lldpd.8.in lldpd.service.in lldpd.sysusers.conf.in usr.sbin.lldpd.in
175 CLEANFILES += $(TEMPLATES)
176 lldpd.8: lldpd.8.in
177 lldpd.service: lldpd.service.in
178 lldpd.sysusers.conf: lldpd.sysusers.conf.in
179 usr.sbin.lldpd: usr.sbin.lldpd.in
180 include $(top_srcdir)/edit.am