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