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