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