]> git.proxmox.com Git - mirror_frr.git/blame - lib/subdir.am
build: improve clippy options
[mirror_frr.git] / lib / subdir.am
CommitLineData
4a121f99
DL
1#
2# libfrr
3#
4lib_LTLIBRARIES += lib/libfrr.la
42efb0d4 5lib_libfrr_la_LDFLAGS = -version-info 0:0:0 -Xlinker -e_libfrr_version
2655e41f 6lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(LIBM)
4a121f99
DL
7
8lib_libfrr_la_SOURCES = \
8e1f6512 9 lib/agg_table.c \
bcea0c0f 10 lib/atomlist.c \
4a121f99
DL
11 lib/bfd.c \
12 lib/buffer.c \
13 lib/checksum.c \
14 lib/command.c \
15 lib/command_graph.c \
16 lib/command_lex.l \
17 lib/command_match.c \
18 lib/command_parse.y \
19 lib/csv.c \
aea03ad6 20 lib/debug.c \
4a121f99 21 lib/distribute.c \
3155489a 22 lib/ferr.c \
4a121f99 23 lib/filter.c \
5dbb0a7b 24 lib/frrlua.c \
4a121f99 25 lib/frr_pthread.c \
fe011935 26 lib/frrstr.c \
4a121f99
DL
27 lib/getopt.c \
28 lib/getopt1.c \
29 lib/grammar_sandbox.c \
30 lib/graph.c \
31 lib/hash.c \
32 lib/hook.c \
a94eca09 33 lib/id_alloc.c \
4a121f99
DL
34 lib/if.c \
35 lib/if_rmap.c \
36 lib/imsg-buffer.c \
37 lib/imsg.c \
38 lib/jhash.c \
39 lib/json.c \
40 lib/keychain.c \
b66d022e 41 lib/lib_errors.c \
4a121f99
DL
42 lib/libfrr.c \
43 lib/linklist.c \
44 lib/log.c \
45 lib/md5.c \
46 lib/memory.c \
47 lib/memory_vty.c \
6edbb8b2 48 lib/mlag.c \
4a121f99 49 lib/module.c \
036fdaad 50 lib/mpls.c \
4a121f99
DL
51 lib/network.c \
52 lib/nexthop.c \
e26aedbe
PG
53 lib/netns_linux.c \
54 lib/netns_other.c \
7ee30f28 55 lib/nexthop_group.c \
1c2facd1
RW
56 lib/northbound.c \
57 lib/northbound_cli.c \
58 lib/northbound_db.c \
e128c002 59 lib/ntop.c \
4a121f99
DL
60 lib/openbsd-tree.c \
61 lib/pid_output.c \
62 lib/plist.c \
7629b6b7 63 lib/pqueue.c \
4a121f99
DL
64 lib/prefix.c \
65 lib/privs.c \
66 lib/ptm_lib.c \
67 lib/qobj.c \
5318d896 68 lib/ringbuf.c \
4a121f99 69 lib/routemap.c \
31bfa062 70 lib/sbuf.c \
440d5faa 71 lib/seqlock.c \
4a121f99
DL
72 lib/sha256.c \
73 lib/sigevent.c \
74 lib/skiplist.c \
75 lib/sockopt.c \
76 lib/sockunion.c \
77 lib/spf_backoff.c \
78 lib/srcdest_table.c \
79 lib/stream.c \
80 lib/strlcat.c \
81 lib/strlcpy.c \
82 lib/systemd.c \
83 lib/table.c \
84 lib/termtable.c \
85 lib/thread.c \
80911bc2 86 lib/typerb.c \
abd71baa 87 lib/typesafe.c \
4a121f99
DL
88 lib/vector.c \
89 lib/vrf.c \
90 lib/vty.c \
91 lib/wheel.c \
92 lib/workqueue.c \
1c2facd1
RW
93 lib/yang.c \
94 lib/yang_translator.c \
95 lib/yang_wrappers.c \
4a121f99 96 lib/zclient.c \
e26aedbe 97 lib/logicalrouter.c \
5c25bd87
DL
98 lib/printf/printf-pos.c \
99 lib/printf/vfprintf.c \
100 lib/printf/glue.c \
4a121f99
DL
101 # end
102
3a11599c
DL
103nodist_lib_libfrr_la_SOURCES = \
104 yang/frr-interface.yang.c \
105 yang/frr-route-types.yang.c \
106 yang/frr-module-translator.yang.c \
107 # end
108
74dc19a2
DL
109vtysh_scan += \
110 $(top_srcdir)/lib/distribute.c \
111 $(top_srcdir)/lib/filter.c \
112 $(top_srcdir)/lib/if.c \
113 $(top_srcdir)/lib/if_rmap.c \
114 $(top_srcdir)/lib/keychain.c \
115 $(top_srcdir)/lib/logicalrouter.c \
116 $(top_srcdir)/lib/nexthop_group.c \
117 $(top_srcdir)/lib/plist.c \
118 $(top_srcdir)/lib/routemap.c \
119 $(top_srcdir)/lib/vrf.c \
120 $(top_srcdir)/lib/vty.c \
121 # end
122# can be loaded as DSO - always include for vtysh
123vtysh_scan += $(top_srcdir)/lib/agentx.c
124
1c2facd1 125if SQLITE3
fdbd8086 126lib_libfrr_la_LIBADD += $(SQLITE3_LIBS)
1c2facd1
RW
127lib_libfrr_la_SOURCES += lib/db.c
128endif
129
8f90d89b
RW
130lib/if_clippy.c: $(CLIPPY_DEPS)
131lib/if.lo: lib/if_clippy.c
f1b32b2e 132lib/plist_clippy.c: $(CLIPPY_DEPS)
4a121f99 133lib/plist.lo: lib/plist_clippy.c
dba32923
DS
134lib/nexthop_group_clippy.c: $(CLIPPY_DEPS)
135lib/nexthop_group.lo: lib/nexthop_group_clippy.c
1c2facd1
RW
136lib/northbound_cli_clippy.c: $(CLIPPY_DEPS)
137lib/northbound_cli.lo: lib/northbound_cli_clippy.c
2950f5da
DS
138lib/vty_clippy.c: $(CLIPPY_DEPS)
139lib/vty.lo: lib/vty_clippy.c
4a121f99
DL
140
141pkginclude_HEADERS += \
8e1f6512 142 lib/agg_table.h \
bcea0c0f 143 lib/atomlist.h \
4a121f99
DL
144 lib/bfd.h \
145 lib/bitfield.h \
146 lib/buffer.h \
147 lib/checksum.h \
14beb548 148 lib/mlag.h \
4a121f99
DL
149 lib/command.h \
150 lib/command_graph.h \
151 lib/command_match.h \
de1a880c 152 lib/compiler.h \
4a121f99 153 lib/csv.h \
1c2facd1 154 lib/db.h \
aea03ad6 155 lib/debug.h \
4a121f99 156 lib/distribute.h \
3155489a 157 lib/ferr.h \
4a121f99 158 lib/filter.h \
cd85bc2e 159 lib/freebsd-queue.h \
5dbb0a7b 160 lib/frrlua.h \
4a121f99
DL
161 lib/frr_pthread.h \
162 lib/frratomic.h \
fe011935 163 lib/frrstr.h \
4a121f99
DL
164 lib/getopt.h \
165 lib/graph.h \
166 lib/hash.h \
167 lib/hook.h \
a94eca09 168 lib/id_alloc.h \
4a121f99
DL
169 lib/if.h \
170 lib/if_rmap.h \
171 lib/imsg.h \
172 lib/ipaddr.h \
173 lib/jhash.h \
174 lib/json.h \
175 lib/keychain.h \
b66d022e 176 lib/lib_errors.h \
4a121f99
DL
177 lib/libfrr.h \
178 lib/libospf.h \
179 lib/linklist.h \
180 lib/log.h \
181 lib/md5.h \
182 lib/memory.h \
183 lib/memory_vty.h \
184 lib/module.h \
185 lib/monotime.h \
186 lib/mpls.h \
187 lib/network.h \
188 lib/nexthop.h \
7ee30f28 189 lib/nexthop_group.h \
1c2facd1
RW
190 lib/northbound.h \
191 lib/northbound_cli.h \
192 lib/northbound_db.h \
4a121f99
DL
193 lib/ns.h \
194 lib/openbsd-queue.h \
195 lib/openbsd-tree.h \
196 lib/plist.h \
7629b6b7 197 lib/pqueue.h \
4a121f99 198 lib/prefix.h \
5c25bd87 199 lib/printfrr.h \
4a121f99
DL
200 lib/privs.h \
201 lib/ptm_lib.h \
6833ae01 202 lib/pw.h \
4a121f99 203 lib/qobj.h \
cd85bc2e 204 lib/queue.h \
5318d896 205 lib/ringbuf.h \
4a121f99 206 lib/routemap.h \
31bfa062 207 lib/sbuf.h \
440d5faa 208 lib/seqlock.h \
4a121f99
DL
209 lib/sha256.h \
210 lib/sigevent.h \
211 lib/skiplist.h \
98ea5be8 212 lib/smux.h \
4a121f99
DL
213 lib/sockopt.h \
214 lib/sockunion.h \
215 lib/spf_backoff.h \
216 lib/srcdest_table.h \
217 lib/stream.h \
218 lib/systemd.h \
219 lib/table.h \
220 lib/termtable.h \
221 lib/thread.h \
80911bc2 222 lib/typerb.h \
abd71baa 223 lib/typesafe.h \
4a121f99 224 lib/vector.h \
4a121f99
DL
225 lib/vlan.h \
226 lib/vrf.h \
227 lib/vrf_int.h \
228 lib/vty.h \
229 lib/vxlan.h \
230 lib/wheel.h \
231 lib/workqueue.h \
1c2facd1
RW
232 lib/yang.h \
233 lib/yang_translator.h \
234 lib/yang_wrappers.h \
4a121f99
DL
235 lib/zassert.h \
236 lib/zclient.h \
237 lib/zebra.h \
e26aedbe 238 lib/logicalrouter.h \
0031a6bb 239 lib/pbr.h \
4a121f99
DL
240 # end
241
58f8a9ec 242
70d27c5b
DL
243nodist_pkginclude_HEADERS += \
244 lib/route_types.h \
245 lib/version.h \
246 # end
247
4a121f99
DL
248noinst_HEADERS += \
249 lib/clippy.h \
250 lib/log_int.h \
251 lib/plist_int.h \
5c25bd87
DL
252 lib/printf/printfcommon.h \
253 lib/printf/printflocal.h \
4a121f99
DL
254 #end
255
d6e76257
DL
256# General note about module and module helper library (libfrrsnmp, libfrrzmq)
257# linking: If we're linking libfrr statically into daemons, we *must* remove
258# libfrr from modules because modules will always link it in dynamically and
259# thus 2 copies of libfrr will be loaded... hilarity ensues.
260#
261# Not linking libfrr into modules should generally work fine because the
262# executable refers to libfrr either way and the dynamic linker should make
263# libfrr available to modules. If some OS platform has a dynamic linker that
264# doesn't do that, libfrr needs to be readded to modules, but _only_ _if_
265# it's not linked into daemons statically.
266
4a121f99
DL
267#
268# SNMP support
269#
270if SNMP
271lib_LTLIBRARIES += lib/libfrrsnmp.la
272endif
273
7aad1594 274lib_libfrrsnmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu99
4a121f99 275lib_libfrrsnmp_la_LDFLAGS = -version-info 0:0:0
d6e76257 276lib_libfrrsnmp_la_LIBADD = $(SNMP_LIBS)
4a121f99
DL
277lib_libfrrsnmp_la_SOURCES = \
278 lib/agentx.c \
4a121f99
DL
279 lib/snmp.c \
280 # end
281
b6116506
DL
282#
283# ZeroMQ support
284#
285if ZEROMQ
286lib_LTLIBRARIES += lib/libfrrzmq.la
287pkginclude_HEADERS += lib/frr_zmq.h
288endif
289
290lib_libfrrzmq_la_CFLAGS = $(WERROR) $(ZEROMQ_CFLAGS)
291lib_libfrrzmq_la_LDFLAGS = -version-info 0:0:0
d6e76257 292lib_libfrrzmq_la_LIBADD = $(ZEROMQ_LIBS)
b6116506
DL
293lib_libfrrzmq_la_SOURCES = \
294 lib/frr_zmq.c \
295 #end
296
5bce33b3
RW
297#
298# Tail-f's ConfD support
299#
300if CONFD
301module_LTLIBRARIES += lib/confd.la
302endif
303
304lib_confd_la_CFLAGS = $(WERROR) $(CONFD_CFLAGS)
305lib_confd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
fdbd8086 306lib_confd_la_LIBADD = lib/libfrr.la $(CONFD_LIBS)
5bce33b3
RW
307lib_confd_la_SOURCES = lib/northbound_confd.c
308
a7ca2199
RW
309#
310# Sysrepo support
311#
312if SYSREPO
313module_LTLIBRARIES += lib/sysrepo.la
314endif
315
fdbd8086 316lib_sysrepo_la_CFLAGS = $(WERROR) $(SYSREPO_CFLAGS)
a7ca2199 317lib_sysrepo_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
fdbd8086 318lib_sysrepo_la_LIBADD = lib/libfrr.la $(SYSREPO_LIBS)
a7ca2199
RW
319lib_sysrepo_la_SOURCES = lib/northbound_sysrepo.c
320
ec2ac5f2
RW
321#
322# gRPC northbound plugin
323#
324if GRPC
325module_LTLIBRARIES += lib/grpc.la
326endif
327
328lib_grpc_la_CXXFLAGS = $(WERROR) $(GRPC_CFLAGS)
329lib_grpc_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
330lib_grpc_la_LIBADD = lib/libfrr.la grpc/libfrrgrpc_pb.la $(GRPC_LIBS)
331lib_grpc_la_SOURCES = lib/northbound_grpc.cpp
332
4a121f99
DL
333#
334# CLI utilities
335#
336noinst_PROGRAMS += \
4a121f99
DL
337 lib/grammar_sandbox \
338 # end
339
89727c8d
DL
340if BUILD_CLIPPY
341noinst_PROGRAMS += lib/clippy
342else
a71c5039
DL
343if HOSTTOOLS_CLIPPY
344$(CLIPPY):
345 @$(MAKE) -C $(top_builddir)/hosttools lib/route_types.h lib/clippy
346endif
89727c8d
DL
347endif
348
4a121f99
DL
349lib_grammar_sandbox_SOURCES = \
350 lib/grammar_sandbox_main.c
351lib_grammar_sandbox_LDADD = \
352 lib/libfrr.la
353
dbac691d
DL
354lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY
355lib_clippy_CFLAGS = $(PYTHON_CFLAGS)
4a121f99 356lib_clippy_LDADD = $(PYTHON_LIBS)
dbac691d 357lib_clippy_LDFLAGS = -export-dynamic
4a121f99
DL
358lib_clippy_SOURCES = \
359 lib/clippy.c \
360 lib/command_graph.c \
361 lib/command_lex.l \
362 lib/command_parse.y \
363 lib/command_py.c \
364 lib/defun_lex.l \
365 lib/graph.c \
366 lib/memory.c \
367 lib/vector.c \
368 # end
369
aad24c5b
DL
370# (global) clippy rules for all directories
371
372AM_V_CLIPPY = $(am__v_CLIPPY_$(V))
373am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY))
374am__v_CLIPPY_0 = @echo " CLIPPY " $@;
375am__v_CLIPPY_1 =
376
a71c5039 377CLIPPY_DEPS = $(CLIPPY) $(top_srcdir)/python/clidef.py
aad24c5b 378
ec2ac5f2 379SUFFIXES = _clippy.c .proto .pb-c.c .pb-c.h .pb.h .pb.cc .grpc.pb.cc
aad24c5b 380.c_clippy.c:
a71c5039 381 $(AM_V_CLIPPY) $(CLIPPY) $(top_srcdir)/python/clidef.py -o $@ $<
aad24c5b
DL
382
383## automake's "ylwrap" is a great piece of GNU software... not.
384.l.c:
385 $(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
386.y.c:
387 $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $<
4a121f99
DL
388
389#
390# generated sources & extra foo
391#
392EXTRA_DIST += \
393 lib/command_lex.h \
70d27c5b 394 lib/command_parse.h \
4a121f99 395 lib/gitversion.pl \
4a121f99
DL
396 lib/route_types.pl \
397 lib/route_types.txt \
398 # end
399
400BUILT_SOURCES += \
4a121f99
DL
401 lib/gitversion.h \
402 lib/route_types.h \
403 # end
404
f1b32b2e
DL
405## force route_types.h
406$(lib_clippy_OBJECTS): lib/route_types.h
407$(lib_libfrr_la_OBJECTS): lib/route_types.h
408
4a121f99
DL
409AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@ @BISON_VERBOSE@
410
411lib/command_lex.h: lib/command_lex.c
412 @if test ! -f $@; then rm -f "lib/command_lex.c"; else :; fi
413 @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) "lib/command_lex.c"; else :; fi
f1b32b2e 414lib/command_lex.lo: lib/command_parse.h
4a121f99 415lib/command_parse.lo: lib/command_lex.h
fdbd8086
DL
416lib/clippy-command_lex.$(OBJEXT): lib/command_parse.h
417lib/clippy-command_parse.$(OBJEXT): lib/command_lex.h
f1b32b2e 418lib/lib_clippy-command_lex.$(OBJEXT): lib/command_parse.h
4a121f99
DL
419lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h
420
421lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl
fdbd8086 422 $(PERL) $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@
67cf020d 423DISTCLEANFILES += lib/route_types.h
4a121f99
DL
424
425if GIT_VERSION
426# bit of a trick here to always have up-to-date git stamps without triggering
427# unneccessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
428# but if we use that on gitversion.h it'll ripple through the .c file deps.
429# (even if gitversion.h's file timestamp doesn't change, make will think it
430# did, because of .PHONY...)
431
9e53b315 432PHONY_GITVERSION=lib/gitversion.h.tmp
4a121f99
DL
433.SILENT: lib/gitversion.h lib/gitversion.h.tmp
434GITH=lib/gitversion.h
435lib/gitversion.h.tmp: $(top_srcdir)/.git
fdbd8086 436 $(PERL) $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
4a121f99 437lib/gitversion.h: lib/gitversion.h.tmp
bd402424 438 { test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp ${GITH}.tmp ${GITH}
4a121f99
DL
439
440else
9e53b315 441PHONY_GITVERSION=lib/gitversion.h
4a121f99
DL
442lib/gitversion.h:
443 true
444endif
9e53b315 445.PHONY: $(PHONY_GITVERSION)