]> git.proxmox.com Git - mirror_frr.git/blob - lib/subdir.am
build: unconditionally enable format checks
[mirror_frr.git] / lib / subdir.am
1 #
2 # libfrr
3 #
4
5 lib_LTLIBRARIES += lib/libfrr.la
6 lib_libfrr_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:0:0 -Xlinker -e_libfrr_version
7 lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(UST_LIBS) $(LIBCRYPT) $(LIBDL) $(LIBM)
8
9 lib_libfrr_la_SOURCES = \
10 lib/agg_table.c \
11 lib/atomlist.c \
12 lib/base64.c \
13 lib/bfd.c \
14 lib/buffer.c \
15 lib/checksum.c \
16 lib/command.c \
17 lib/command_graph.c \
18 lib/command_lex.l \
19 lib/command_match.c \
20 lib/command_parse.y \
21 lib/cspf.c \
22 lib/csv.c \
23 lib/debug.c \
24 lib/defaults.c \
25 lib/distribute.c \
26 lib/explicit_bzero.c \
27 lib/ferr.c \
28 lib/filter.c \
29 lib/filter_cli.c \
30 lib/filter_nb.c \
31 lib/frrcu.c \
32 lib/frrlua.c \
33 lib/frrscript.c \
34 lib/frr_pthread.c \
35 lib/frrstr.c \
36 lib/getopt.c \
37 lib/getopt1.c \
38 lib/grammar_sandbox.c \
39 lib/graph.c \
40 lib/hash.c \
41 lib/hook.c \
42 lib/id_alloc.c \
43 lib/if.c \
44 lib/if_rmap.c \
45 lib/imsg-buffer.c \
46 lib/imsg.c \
47 lib/jhash.c \
48 lib/json.c \
49 lib/keychain.c \
50 lib/ldp_sync.c \
51 lib/lib_errors.c \
52 lib/lib_vty.c \
53 lib/libfrr.c \
54 lib/libfrr_trace.c \
55 lib/linklist.c \
56 lib/link_state.c \
57 lib/log.c \
58 lib/log_filter.c \
59 lib/log_vty.c \
60 lib/md5.c \
61 lib/memory.c \
62 lib/mlag.c \
63 lib/module.c \
64 lib/mpls.c \
65 lib/srv6.c \
66 lib/network.c \
67 lib/nexthop.c \
68 lib/netns_linux.c \
69 lib/netns_other.c \
70 lib/nexthop_group.c \
71 lib/northbound.c \
72 lib/northbound_cli.c \
73 lib/northbound_db.c \
74 lib/ntop.c \
75 lib/openbsd-tree.c \
76 lib/pid_output.c \
77 lib/plist.c \
78 lib/prefix.c \
79 lib/privs.c \
80 lib/ptm_lib.c \
81 lib/pullwr.c \
82 lib/qobj.c \
83 lib/ringbuf.c \
84 lib/routemap.c \
85 lib/routemap_cli.c \
86 lib/routemap_northbound.c \
87 lib/sbuf.c \
88 lib/seqlock.c \
89 lib/sha256.c \
90 lib/sigevent.c \
91 lib/skiplist.c \
92 lib/sockopt.c \
93 lib/sockunion.c \
94 lib/spf_backoff.c \
95 lib/srcdest_table.c \
96 lib/stream.c \
97 lib/strformat.c \
98 lib/strlcat.c \
99 lib/strlcpy.c \
100 lib/systemd.c \
101 lib/table.c \
102 lib/termtable.c \
103 lib/thread.c \
104 lib/typerb.c \
105 lib/typesafe.c \
106 lib/vector.c \
107 lib/vrf.c \
108 lib/vty.c \
109 lib/wheel.c \
110 lib/workqueue.c \
111 lib/xref.c \
112 lib/yang.c \
113 lib/yang_translator.c \
114 lib/yang_wrappers.c \
115 lib/zclient.c \
116 lib/zlog.c \
117 lib/zlog_5424.c \
118 lib/zlog_5424_cli.c \
119 lib/zlog_live.c \
120 lib/zlog_targets.c \
121 lib/printf/printf-pos.c \
122 lib/printf/vfprintf.c \
123 lib/printf/glue.c \
124 lib/routing_nb.c \
125 lib/routing_nb_config.c \
126 # end
127
128 nodist_lib_libfrr_la_SOURCES = \
129 yang/frr-filter.yang.c \
130 yang/frr-interface.yang.c \
131 yang/frr-route-map.yang.c \
132 yang/frr-route-types.yang.c \
133 yang/frr-vrf.yang.c \
134 yang/frr-routing.yang.c \
135 yang/frr-nexthop.yang.c \
136 yang/ietf/ietf-routing-types.yang.c \
137 yang/ietf/ietf-interfaces.yang.c \
138 yang/ietf/ietf-bgp-types.yang.c \
139 yang/frr-module-translator.yang.c \
140 # end
141
142 vtysh_scan += \
143 lib/distribute.c \
144 lib/filter.c \
145 lib/filter_cli.c \
146 lib/if.c \
147 lib/if_rmap.c \
148 lib/keychain.c \
149 lib/lib_vty.c \
150 lib/log_vty.c \
151 lib/nexthop_group.c \
152 lib/plist.c \
153 lib/routemap.c \
154 lib/routemap_cli.c \
155 lib/spf_backoff.c \
156 lib/thread.c \
157 lib/vrf.c \
158 lib/vty.c \
159 # end
160 # can be loaded as DSO - always include for vtysh
161 vtysh_scan += lib/agentx.c
162
163 if SQLITE3
164 lib_libfrr_la_LIBADD += $(SQLITE3_LIBS)
165 lib_libfrr_la_SOURCES += lib/db.c
166 endif
167
168 clippy_scan += \
169 lib/if.c \
170 lib/filter_cli.c \
171 lib/log_vty.c \
172 lib/nexthop_group.c \
173 lib/northbound_cli.c \
174 lib/plist.c \
175 lib/routemap_cli.c \
176 lib/thread.c \
177 lib/vty.c \
178 lib/zlog_5424_cli.c \
179 # end
180
181 pkginclude_HEADERS += \
182 lib/agg_table.h \
183 lib/atomlist.h \
184 lib/base64.h \
185 lib/bfd.h \
186 lib/bitfield.h \
187 lib/buffer.h \
188 lib/checksum.h \
189 lib/mlag.h \
190 lib/command.h \
191 lib/command_graph.h \
192 lib/command_match.h \
193 lib/compiler.h \
194 lib/cspf.h \
195 lib/csv.h \
196 lib/db.h \
197 lib/debug.h \
198 lib/defaults.h \
199 lib/distribute.h \
200 lib/ferr.h \
201 lib/filter.h \
202 lib/freebsd-queue.h \
203 lib/frrlua.h \
204 lib/frrscript.h \
205 lib/frr_pthread.h \
206 lib/frratomic.h \
207 lib/frrcu.h \
208 lib/frrstr.h \
209 lib/getopt.h \
210 lib/graph.h \
211 lib/hash.h \
212 lib/hook.h \
213 lib/iana_afi.h \
214 lib/id_alloc.h \
215 lib/if.h \
216 lib/if_rmap.h \
217 lib/imsg.h \
218 lib/ipaddr.h \
219 lib/jhash.h \
220 lib/json.h \
221 lib/keychain.h \
222 lib/ldp_sync.h \
223 lib/lib_errors.h \
224 lib/lib_vty.h \
225 lib/libfrr.h \
226 lib/libfrr_trace.h \
227 lib/libospf.h \
228 lib/linklist.h \
229 lib/link_state.h \
230 lib/log.h \
231 lib/log_vty.h \
232 lib/md5.h \
233 lib/memory.h \
234 lib/module.h \
235 lib/monotime.h \
236 lib/mpls.h \
237 lib/srv6.h \
238 lib/network.h \
239 lib/nexthop.h \
240 lib/nexthop_group.h \
241 lib/nexthop_group_private.h \
242 lib/northbound.h \
243 lib/northbound_cli.h \
244 lib/northbound_db.h \
245 lib/ns.h \
246 lib/openbsd-queue.h \
247 lib/openbsd-tree.h \
248 lib/plist.h \
249 lib/prefix.h \
250 lib/printfrr.h \
251 lib/privs.h \
252 lib/ptm_lib.h \
253 lib/pullwr.h \
254 lib/pw.h \
255 lib/qobj.h \
256 lib/queue.h \
257 lib/ringbuf.h \
258 lib/routemap.h \
259 lib/route_opaque.h \
260 lib/sbuf.h \
261 lib/seqlock.h \
262 lib/sha256.h \
263 lib/sigevent.h \
264 lib/skiplist.h \
265 lib/smux.h \
266 lib/sockopt.h \
267 lib/sockunion.h \
268 lib/spf_backoff.h \
269 lib/srcdest_table.h \
270 lib/srte.h \
271 lib/stream.h \
272 lib/systemd.h \
273 lib/table.h \
274 lib/termtable.h \
275 lib/thread.h \
276 lib/trace.h \
277 lib/typerb.h \
278 lib/typesafe.h \
279 lib/vector.h \
280 lib/vlan.h \
281 lib/vrf.h \
282 lib/vrf_int.h \
283 lib/vty.h \
284 lib/vxlan.h \
285 lib/wheel.h \
286 lib/workqueue.h \
287 lib/xref.h \
288 lib/yang.h \
289 lib/yang_translator.h \
290 lib/yang_wrappers.h \
291 lib/zclient.h \
292 lib/zebra.h \
293 lib/zlog.h \
294 lib/zlog_5424.h \
295 lib/zlog_live.h \
296 lib/zlog_targets.h \
297 lib/pbr.h \
298 lib/routing_nb.h \
299 \
300 lib/assert/assert.h \
301 # end
302
303
304 nodist_pkginclude_HEADERS += \
305 lib/route_types.h \
306 lib/version.h \
307 # end
308
309 noinst_HEADERS += \
310 lib/clippy.h \
311 lib/plist_int.h \
312 lib/printf/printfcommon.h \
313 lib/printf/printflocal.h \
314 #end
315
316 # General note about module and module helper library (libfrrsnmp, libfrrzmq)
317 # linking: If we're linking libfrr statically into daemons, we *must* remove
318 # libfrr from modules because modules will always link it in dynamically and
319 # thus 2 copies of libfrr will be loaded... hilarity ensues.
320 #
321 # Not linking libfrr into modules should generally work fine because the
322 # executable refers to libfrr either way and the dynamic linker should make
323 # libfrr available to modules. If some OS platform has a dynamic linker that
324 # doesn't do that, libfrr needs to be readded to modules, but _only_ _if_
325 # it's not linked into daemons statically.
326
327 #
328 # SNMP support
329 #
330 if SNMP
331 lib_LTLIBRARIES += lib/libfrrsnmp.la
332 endif
333
334 lib_libfrrsnmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11
335 lib_libfrrsnmp_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:0:0
336 lib_libfrrsnmp_la_LIBADD = $(SNMP_LIBS)
337 lib_libfrrsnmp_la_SOURCES = \
338 lib/agentx.c \
339 lib/snmp.c \
340 # end
341
342
343 #
344 # c-ares support
345 #
346 if CARES
347 lib_LTLIBRARIES += lib/libfrrcares.la
348 pkginclude_HEADERS += lib/resolver.h
349 vtysh_scan += lib/resolver.c
350 endif
351
352 lib_libfrrcares_la_CFLAGS = $(AM_CFLAGS) $(CARES_CFLAGS)
353 lib_libfrrcares_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:0:0
354 lib_libfrrcares_la_LIBADD = $(CARES_LIBS)
355 lib_libfrrcares_la_SOURCES = \
356 lib/resolver.c \
357 #end
358
359 #
360 # ZeroMQ support
361 #
362 if ZEROMQ
363 lib_LTLIBRARIES += lib/libfrrzmq.la
364 pkginclude_HEADERS += lib/frr_zmq.h
365 endif
366
367 lib_libfrrzmq_la_CFLAGS = $(AM_CFLAGS) $(ZEROMQ_CFLAGS)
368 lib_libfrrzmq_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:0:0
369 lib_libfrrzmq_la_LIBADD = $(ZEROMQ_LIBS)
370 lib_libfrrzmq_la_SOURCES = \
371 lib/frr_zmq.c \
372 #end
373
374 #
375 # Tail-f's ConfD support
376 #
377 if CONFD
378 module_LTLIBRARIES += lib/confd.la
379 endif
380
381 lib_confd_la_CFLAGS = $(AM_CFLAGS) $(CONFD_CFLAGS)
382 lib_confd_la_LDFLAGS = $(MODULE_LDFLAGS)
383 lib_confd_la_LIBADD = lib/libfrr.la $(CONFD_LIBS)
384 lib_confd_la_SOURCES = lib/northbound_confd.c
385
386 #
387 # Sysrepo support
388 #
389 if SYSREPO
390 module_LTLIBRARIES += lib/sysrepo.la
391 endif
392
393 lib_sysrepo_la_CFLAGS = $(AM_CFLAGS) $(SYSREPO_CFLAGS)
394 lib_sysrepo_la_LDFLAGS = $(MODULE_LDFLAGS)
395 lib_sysrepo_la_LIBADD = lib/libfrr.la $(SYSREPO_LIBS)
396 lib_sysrepo_la_SOURCES = lib/northbound_sysrepo.c
397
398 #
399 # gRPC northbound plugin
400 #
401 if GRPC
402 module_LTLIBRARIES += lib/grpc.la
403 endif
404
405 lib_grpc_la_CXXFLAGS = $(WERROR) $(GRPC_CFLAGS)
406 lib_grpc_la_LDFLAGS = $(MODULE_LDFLAGS)
407 lib_grpc_la_LIBADD = lib/libfrr.la grpc/libfrrgrpc_pb.la $(GRPC_LIBS)
408 lib_grpc_la_SOURCES = lib/northbound_grpc.cpp
409
410 #
411 # CLI utilities
412 #
413 noinst_PROGRAMS += \
414 lib/grammar_sandbox \
415 # end
416
417 if BUILD_CLIPPY
418 noinst_PROGRAMS += lib/clippy
419 else
420 if HOSTTOOLS_CLIPPY
421 $(CLIPPY):
422 @$(MAKE) -C $(top_builddir)/hosttools lib/route_types.h lib/clippy
423 endif
424 endif
425
426 lib_grammar_sandbox_SOURCES = \
427 lib/grammar_sandbox_main.c
428 lib_grammar_sandbox_LDADD = \
429 lib/libfrr.la
430
431 lib_clippy_CPPFLAGS = $(CPPFLAGS_BASE) -D_GNU_SOURCE -DBUILDING_CLIPPY
432 lib_clippy_CFLAGS = $(AC_CFLAGS) $(PYTHON_CFLAGS)
433 lib_clippy_LDADD = $(PYTHON_LIBS) $(UST_LIBS) -lelf
434 # no $(SAN_FLAGS) here
435 lib_clippy_LDFLAGS = -export-dynamic $(AC_LDFLAGS) $(AC_LDFLAGS_EXEC)
436 lib_clippy_SOURCES = \
437 lib/jhash.c \
438 lib/clippy.c \
439 lib/command_graph.c \
440 lib/command_lex.l \
441 lib/command_parse.y \
442 lib/command_py.c \
443 lib/defun_lex.l \
444 lib/elf_py.c \
445 lib/graph.c \
446 lib/libfrr_trace.c \
447 lib/memory.c \
448 lib/typesafe.c \
449 lib/vector.c \
450 # end
451
452 # (global) clippy rules for all directories
453
454 AM_V_CLIPPY = $(am__v_CLIPPY_$(V))
455 am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY))
456 am__v_CLIPPY_0 = @echo " CLIPPY " $@;
457 am__v_CLIPPY_1 =
458
459 CLIPPY_DEPS = $(CLIPPY) $(top_srcdir)/python/clidef.py
460
461 SUFFIXES += _clippy.c
462 .c_clippy.c:
463 $(AM_V_CLIPPY) $(CLIPPY) $(top_srcdir)/python/clidef.py -o $@ $<
464
465 # xrelfo, the ELF xref extractor
466
467 AM_V_XRELFO = $(am__v_XRELFO_$(V))
468 am__v_XRELFO_ = $(am__v_XRELFO_$(AM_DEFAULT_VERBOSITY))
469 am__v_XRELFO_0 = @echo " XRELFO " $@;
470 am__v_XRELFO_1 =
471
472 XRELFO_FLAGS = -Wlog-format -Wlog-args
473
474 SUFFIXES += .xref
475 %.xref: % $(CLIPPY)
476 $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py $(WERROR) $(XRELFO_FLAGS) -o $@ $<
477
478 # dependencies added in python/makefile.py
479 frr.xref:
480 $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -o $@ $^
481 all-am: frr.xref
482
483 clean-xref:
484 -rm -rf $(xrefs) frr.xref
485 clean-local: clean-xref
486
487 ## automake's "ylwrap" is a great piece of GNU software... not.
488 .l.c:
489 $(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
490 .y.c:
491 $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $<
492
493 #
494 # generated sources & extra foo
495 #
496 EXTRA_DIST += \
497 lib/command_lex.h \
498 lib/command_parse.h \
499 lib/gitversion.pl \
500 lib/route_types.pl \
501 lib/route_types.txt \
502 # end
503
504 BUILT_SOURCES += \
505 lib/gitversion.h \
506 lib/route_types.h \
507 # end
508
509 ## force route_types.h
510 $(lib_clippy_OBJECTS): lib/route_types.h
511 $(lib_libfrr_la_OBJECTS): lib/route_types.h
512
513 AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@ @BISON_VERBOSE@
514
515 lib/command_lex.h: lib/command_lex.c
516 @if test ! -f $@; then rm -f "lib/command_lex.c"; else :; fi
517 @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) "lib/command_lex.c"; else :; fi
518 lib/command_lex.lo: lib/command_parse.h
519 lib/command_parse.lo: lib/command_lex.h
520 lib/clippy-command_lex.$(OBJEXT): lib/command_parse.h
521 lib/clippy-command_parse.$(OBJEXT): lib/command_lex.h
522 lib/lib_clippy-command_lex.$(OBJEXT): lib/command_parse.h
523 lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h
524
525 DISTCLEANFILES += lib/command_lex.h \
526 lib/command_lex.c \
527 lib/command_parse.h \
528 lib/command_parse.c
529
530 rt_enabled =
531
532 if BABELD
533 rt_enabled += --enabled babeld
534 endif
535 if BFDD
536 rt_enabled += --enabled bfdd
537 endif
538 if BGPD
539 rt_enabled += --enabled bgpd
540 if ENABLE_BGP_VNC
541 rt_enabled += --enabled bgpd-vnc
542 endif
543 endif
544 if EIGRPD
545 rt_enabled += --enabled eigrpd
546 endif
547 if ISISD
548 rt_enabled += --enabled isisd
549 endif
550 if FABRICD
551 rt_enabled += --enabled fabricd
552 endif
553 if LDPD
554 rt_enabled += --enabled ldpd
555 endif
556 if NHRPD
557 rt_enabled += --enabled nhrpd
558 endif
559 if OSPFD
560 rt_enabled += --enabled ospfd
561 endif
562 if OSPF6D
563 rt_enabled += --enabled ospf6d
564 endif
565 if PBRD
566 rt_enabled += --enabled pbrd
567 endif
568 if PIMD
569 rt_enabled += --enabled pimd
570 endif
571 if RIPD
572 rt_enabled += --enabled ripd
573 endif
574 if RIPNGD
575 rt_enabled += --enabled ripngd
576 endif
577 if SHARPD
578 rt_enabled += --enabled sharpd
579 endif
580 if ZEBRA
581 rt_enabled += --enabled zebra
582 endif
583
584 lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl
585 $(PERL) $(top_srcdir)/lib/route_types.pl $(rt_enabled) < $(top_srcdir)/lib/route_types.txt > $@
586 DISTCLEANFILES += lib/route_types.h
587
588 if GIT_VERSION
589 # bit of a trick here to always have up-to-date git stamps without triggering
590 # unnecessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
591 # but if we use that on gitversion.h it'll ripple through the .c file deps.
592 # (even if gitversion.h's file timestamp doesn't change, make will think it
593 # did, because of .PHONY...)
594
595 PHONY_GITVERSION=lib/gitversion.h.tmp
596 .SILENT: lib/gitversion.h lib/gitversion.h.tmp
597 GITH=lib/gitversion.h
598 lib/gitversion.h.tmp: $(top_srcdir)/.git
599 $(PERL) $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
600 lib/gitversion.h: lib/gitversion.h.tmp
601 { test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp ${GITH}.tmp ${GITH}
602
603 else
604 PHONY_GITVERSION=lib/gitversion.h
605 lib/gitversion.h:
606 true
607 endif
608 .PHONY: $(PHONY_GITVERSION)