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