-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathMakefile.am
More file actions
218 lines (186 loc) · 8.81 KB
/
Copy pathMakefile.am
File metadata and controls
218 lines (186 loc) · 8.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# target programs to be installed in ${sbindir}
sbin_PROGRAMS = lldpad dcbtool lldptool vdptool
check_PROGRAMS = lldp_clif_test
TESTS = $(check_PROGRAMS)
# package nltest and vdptest, but do not install it anywhere
if BUILD_DEBUG
noinst_PROGRAMS = nltest vdptest qbg22sim
endif
# look for header files in the include directory
# pass the value of ${sysconfdir} to the C pre-processor as SYSCONFDIR
AM_CPPFLAGS = -I${srcdir}/include -DSYSCONFDIR="\"${sysconfdir}\"" \
-D_FORTIFY_SOURCE=2
ACLOCAL_AMFLAGS = -I m4
parse_cli.o: CFLAGS+=-U_FORTIFY_SOURCE -Wno-error
## system requires a shared libconfig
AM_CFLAGS = $(LIBCONFIG_CFLAGS) $(LIBNL_CFLAGS) $(LIBNL_GENL_CFLAGS)
AM_LDFLAGS = $(LIBCONFIG_LIBS) $(LIBNL_LIBS) $(LIBNL_GENL_LIBS) -lrt
## header files to be installed, for programs using the client interface to lldpad
lldpad_includedir= ${includedir}/lldpad
lldpad_include_HEADERS = include/dcb_types.h \
include/clif.h include/lldp_dcbx_cmds.h \
include/lldpad.h include/lldp_mand_cmds.h \
include/clif_msgs.h include/lldp_basman_cmds.h include/lldp_8023_cmds.h \
include/lldp_med_cmds.h include/lldp_util.h \
include/lldp_evb_cmds.h include/qbg_vdp_cmds.h include/lldp_8021qaz_cmds.h \
include/clif_sock.h include/linux/dcbnl.h \
include/linux/netlink.h include/linux/rtnetlink.h \
include/lldpad_status.h
noinst_HEADERS = include/config.h include/ctrl_iface.h \
include/dcb_driver_interface.h \
include/dcb_events.h include/dcb_persist_store.h include/dcb_protocol.h \
include/dcb_rule_chk.h include/lldp_dcbx_nl.h include/eloop.h \
include/lldpad_shm.h include/event_iface.h include/messages.h \
include/parse_cli.h include/version.h include/lldptool_cli.h include/list.h \
include/lldp_mand_clif.h include/lldp_basman_clif.h include/lldp_med_clif.h \
include/lldp_8023_clif.h include/lldp_dcbx_clif.h include/lldp_evb_clif.h \
include/lldp_evb22_clif.h include/qbg_vdp_clif.h include/qbg_vdpnl.h \
include/qbg_vdp22_clif.h include/lldp_8021qaz_clif.h \
include/lldp_orgspec_clif.h include/lldp_cisco_clif.h \
include/lldptool.h include/lldp_rtnl.h include/dcbtool.h include/lldp_dcbx_cfg.h \
include/qbg_vdp22_cmds.h include/qbg_vdp22_clif.h include/linux/ethtool.h \
include/linux/if_bonding.h include/linux/if_bridge.h include/linux/if.h \
include/linux/if_link.h include/linux/if_vlan.h include/linux/ethtool_netlink.h
lldpad_SOURCES = lldpad.c config.c lldp_dcbx_nl.c ctrl_iface.c \
event_iface.c eloop.c lldp_dcbx_cmds.c log.c lldpad_shm.c \
dcb_protocol.c dcb_rule_chk.c list.c lldp_rtnl.c \
$(lldpad_include_HEADERS) $(noinst_HEADERS) \
lldp/ports.c lldp/agent.c lldp/l2_packet_linux.c lldp/tx.c \
lldp/rx.c lldp/agent.h lldp/l2_packet.h lldp/mibdata.h lldp/ports.h \
lldp/states.h include/lldp.h include/lldp_mod.h \
lldp_dcbx.c include/lldp_dcbx.h tlv_dcbx.c include/tlv_dcbx.h \
lldp_dcbx_cfg.c include/lldp_dcbx_cfg.h lldp_util.c \
lldp_mand.c include/lldp_mand.h \
lldp_mand_cmds.c lldp_basman_cmds.c lldp_8023_cmds.c lldp_med_cmds.c \
lldp_evb_cmds.c lldp_evb.c include/lldp_evb.h qbg/vdp_cmds.c \
include/qbg_vdp_cmds.h \
include/qbg_ecp.h include/qbg_utils.h qbg/ecp.c qbg_utils.c \
qbg/vdp.c include/qbg_vdp.h \
lldp_ethtool.c include/lldp_ethtool.h \
lldp_tlv.c include/lldp_tlv.h \
lldp_basman.c include/lldp_basman.h \
lldp_med.c include/lldp_med.h \
lldp_8023.c include/lldp_8023.h \
lldp_8021qaz.c include/lldp_8021qaz.h \
lldp_8021qaz_cmds.c include/lldp_8021qaz_cmds.h \
include/lldp_evb22.h lldp_evb22.c lldp_evb22_cmds.c \
include/qbg22.h include/qbg_ecp22.h qbg/ecp22.c \
include/qbg_vdp22.h qbg/vdp22.c qbg/vdpnl.c qbg/vdp22sm.c qbg/vdp22br.c \
include/qbg_vdp22def.h qbg/vdp22_cmds.c qbg/vdp_ascii.c \
include/qbg_vdp22_oui.h qbg/vdp22_oui.c include/vdp_cisco.h \
qbg/vdp22cisco_oui.c
lib_LTLIBRARIES = liblldp_clif.la
liblldp_clif_la_LDFLAGS = -version-info 1:0:0
liblldp_clif_includedir = ${srcdir}/include
liblldp_clif_la_SOURCES = clif.c
vdptool_SOURCES = vdptool.c lldp_util.c qbg/vdp22_clif.c vdptool_cisco_oui.c
vdptool_LDADD = liblldp_clif.la
vdptool_LDFLAGS = -llldp_clif $(LIBNL_LIBS)
dcbtool_SOURCES = dcbtool.c dcbtool_cmds.c parse_cli.l \
weak_readline.c lldp_rtnl.c lldp_util.c \
$(lldpad_include_HEADERS) $(noinst_HEADERS)
dcbtool_LDADD = liblldp_clif.la
dcbtool_LDFLAGS = -ldl -llldp_clif $(LIBNL_LIBS)
lldptool_SOURCES = lldptool.c lldptool_cmds.c lldp_rtnl.c \
lldp_mand_clif.c lldp_basman_clif.c lldp_med_clif.c \
lldp_8023_clif.c lldp_dcbx_clif.c lldp_util.c \
lldp_8021qaz_clif.c lldp_evb_clif.c qbg/vdp_clif.c \
lldp_orgspec_clif.c lldp_cisco_clif.c lldp_evb22_clif.c \
weak_readline.c $(lldpad_include_HEADERS) $(noinst_HEADERS)
lldptool_LDADD = liblldp_clif.la
lldptool_LDFLAGS = -ldl -llldp_clif $(LIBNL_LIBS)
if BUILD_DEBUG
nltest_SOURCES = test/nltest.c test/nltest.h
vdptest_SOURCES = test/vdptest.c
vdptest_LDADD = liblldp_clif.la
vdptest_LDFLAGS = -llldp_clif
qbg22sim_SOURCES = test/qbg22sim.c
qbg22sim_LDFLAGS = -lrt
endif
## put a spec file and documentation in the distribution archive
dist_noinst_DATA = lldpad.spec README COPYING ChangeLog lldpad.init
## netns/scapy integration test suite sources (see check-integration below)
EXTRA_DIST = test/pytest
## strip Python bytecode caches (created by running check-integration
## in-tree) out of both `make clean` and `make dist` output; they're
## build artifacts, not sources.
clean-local:
find $(srcdir)/test/pytest -name '__pycache__' -type d -exec rm -rf {} +
rm -rf $(srcdir)/test/pytest/.pytest_cache
dist-hook:
find $(distdir)/test/pytest -name '__pycache__' -type d -exec rm -rf {} +
rm -rf $(distdir)/test/pytest/.pytest_cache
## man pages
dist_man_MANS = docs/lldpad.8 docs/dcbtool.8 docs/lldptool.8 \
docs/lldptool-ets.8 docs/lldptool-pfc.8 docs/lldptool-app.8 \
docs/lldptool-evb.8 docs/lldptool-vdp.8 docs/lldptool-med.8 \
docs/lldptool-dcbx.8 docs/lldptool-add-eth-caps.8 \
docs/lldptool-evb22.8 docs/vdptool.8 \
docs/liblldp_clif-vdp22.3
if BUILD_DEBUG
dist_man_MANS += test/qbg22sim.1 test/vdptest.1
else
dist_noinst_DATA += test/qbg22sim.1 test/vdptest.1
endif
## force the creation of an empty configuration directory at install time
lldpadconfigdir = /var/lib/lldpad
installdirs-local:
$(MKDIR_P) $(DESTDIR)$(lldpadconfigdir)
install-data-hook: installdirs-local
## pkg-config data file, for client interface software to find headers
pkgconfigdir = ${libdir}/pkgconfig
pkgconfig_DATA = lldpad.pc liblldp_clif.pc
systemdsystemunitdir = $(prefix)/lib/systemd/system
dist_systemdsystemunit_DATA = lldpad.service lldpad.socket
bashcompletiondir = $(sysconfdir)/bash_completion.d
dist_bashcompletion_DATA = contrib/bash_completion/lldpad contrib/bash_completion/lldptool
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-debug
lldp_clif_test_SOURCES = test/lldp_clif_test.c lldp_basman_clif.c lldp_util.c \
lldp_rtnl.c
lldp_clif_test_LDFLAGS = -lrt $(LIBNL_LIBS)
## netns/scapy integration test suite (test/pytest/): not part of the
## default `check` since it needs pytest+scapy and real root (to create
## network namespaces - see test/pytest/README.md's "Privilege model"),
## neither of which every build host has. Run explicitly with
## `sudo make check-integration` (individual cases skip themselves
## cleanly, rather than failing, if run without root).
##
## This also covers test/pytest/qbg/, the ported test/qbg22/ EVB/ECP/VDP
## case suite - but that one additionally needs qbg22sim and vdptest,
## which are noinst_PROGRAMS built only with --enable-debug; without it,
## those cases skip themselves cleanly at test time rather than failing
## the build here.
##
## Cases run in parallel (pytest-xdist, `-n auto`) by default - `make -j`
## does *not* parallelize this, since check-integration is one target
## with one recipe (one pytest invocation); the actual concurrency knob
## is PYTEST below. Override e.g. `make check-integration PYTEST=pytest`
## to force serial, or `PYTEST="pytest -n 4"` to pick a worker count.
PYTEST ?= pytest -n auto
if BUILD_DEBUG
QBG_TEST_BINS = qbg22sim$(EXEEXT) vdptest$(EXEEXT)
else
QBG_TEST_BINS =
endif
.PHONY: check-integration
check-integration: lldpad$(EXEEXT) lldptool$(EXEEXT) vdptool$(EXEEXT) $(QBG_TEST_BINS)
@pytest_bin=`echo $(PYTEST) | awk '{print $$1}'`; \
if ! command -v "$$pytest_bin" >/dev/null 2>&1; then \
echo "error: '$$pytest_bin' not found; install $(srcdir)/test/pytest/requirements.txt" >&2; \
exit 1; \
fi
OPENLLDP_LLDPAD=$(abs_builddir)/lldpad$(EXEEXT) \
OPENLLDP_LLDPTOOL=$(abs_builddir)/lldptool$(EXEEXT) \
OPENLLDP_VDPTOOL=$(abs_builddir)/vdptool$(EXEEXT) \
OPENLLDP_QBG22SIM=$(abs_builddir)/qbg22sim$(EXEEXT) \
OPENLLDP_VDPTEST=$(abs_builddir)/vdptest$(EXEEXT) \
$(PYTEST) $(srcdir)/test/pytest -v
RPMBUILD_TOP = $(abs_top_builddir)/rpm/rpmbuild
RPMBUILD_OPT ?= --without check
# Build user-space RPMs
rpm: dist $(srcdir)/lldpad.spec
${MKDIR_P} ${RPMBUILD_TOP}/SOURCES
cp ${DIST_ARCHIVES} ${RPMBUILD_TOP}/SOURCES
rpmbuild ${RPMBUILD_OPT} \
-D "_topdir ${RPMBUILD_TOP}" \
-ba $(srcdir)/lldpad.spec