]> git.proxmox.com Git - mirror_frr.git/blame - lib/subdir.am
doc: add instructions for static linking (#5668)
[mirror_frr.git] / lib / subdir.am
CommitLineData
4a121f99
DL
1#
2# libfrr
3#
4lib_LTLIBRARIES += lib/libfrr.la
42efb0d4 5lib_libfrr_la_LDFLAGS = -version-info 0:0:0 -Xlinker -e_libfrr_version
2655e41f 6lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(LIBM)
4a121f99
DL
7
8lib_libfrr_la_SOURCES = \
8e1f6512 9 lib/agg_table.c \
bcea0c0f 10 lib/atomlist.c \
4a121f99
DL
11 lib/bfd.c \
12 lib/buffer.c \
13 lib/checksum.c \
14 lib/command.c \
15 lib/command_graph.c \
16 lib/command_lex.l \
17 lib/command_match.c \
18 lib/command_parse.y \
19 lib/csv.c \
aea03ad6 20 lib/debug.c \
96673e06 21 lib/defaults.c \
4a121f99 22 lib/distribute.c \
3155489a 23 lib/ferr.c \
4a121f99 24 lib/filter.c \
3e41733f 25 lib/frrcu.c \
5dbb0a7b 26 lib/frrlua.c \
4a121f99 27 lib/frr_pthread.c \
fe011935 28 lib/frrstr.c \
4a121f99
DL
29 lib/getopt.c \
30 lib/getopt1.c \
31 lib/grammar_sandbox.c \
32 lib/graph.c \
33 lib/hash.c \
34 lib/hook.c \
a94eca09 35 lib/id_alloc.c \
4a121f99
DL
36 lib/if.c \
37 lib/if_rmap.c \
38 lib/imsg-buffer.c \
39 lib/imsg.c \
40 lib/jhash.c \
41 lib/json.c \
42 lib/keychain.c \
b66d022e 43 lib/lib_errors.c \
1c0d8808 44 lib/lib_vty.c \
4a121f99
DL
45 lib/libfrr.c \
46 lib/linklist.c \
47 lib/log.c \
f73126c3 48 lib/log_vty.c \
4a121f99
DL
49 lib/md5.c \
50 lib/memory.c \
6edbb8b2 51 lib/mlag.c \
4a121f99 52 lib/module.c \
036fdaad 53 lib/mpls.c \
4a121f99
DL
54 lib/network.c \
55 lib/nexthop.c \
e26aedbe
PG
56 lib/netns_linux.c \
57 lib/netns_other.c \
7ee30f28 58 lib/nexthop_group.c \
1c2facd1
RW
59 lib/northbound.c \
60 lib/northbound_cli.c \
61 lib/northbound_db.c \
e128c002 62 lib/ntop.c \
4a121f99
DL
63 lib/openbsd-tree.c \
64 lib/pid_output.c \
65 lib/plist.c \
4a121f99
DL
66 lib/prefix.c \
67 lib/privs.c \
68 lib/ptm_lib.c \
5c52c06c 69 lib/pullwr.c \
4a121f99 70 lib/qobj.c \
5318d896 71 lib/ringbuf.c \
4a121f99 72 lib/routemap.c \
31bfa062 73 lib/sbuf.c \
440d5faa 74 lib/seqlock.c \
4a121f99
DL
75 lib/sha256.c \
76 lib/sigevent.c \
77 lib/skiplist.c \
78 lib/sockopt.c \
79 lib/sockunion.c \
80 lib/spf_backoff.c \
81 lib/srcdest_table.c \
82 lib/stream.c \
83 lib/strlcat.c \
84 lib/strlcpy.c \
85 lib/systemd.c \
86 lib/table.c \
87 lib/termtable.c \
88 lib/thread.c \
80911bc2 89 lib/typerb.c \
abd71baa 90 lib/typesafe.c \
4a121f99
DL
91 lib/vector.c \
92 lib/vrf.c \
93 lib/vty.c \
94 lib/wheel.c \
95 lib/workqueue.c \
1c2facd1
RW
96 lib/yang.c \
97 lib/yang_translator.c \
98 lib/yang_wrappers.c \
4a121f99 99 lib/zclient.c \
5c25bd87
DL
100 lib/printf/printf-pos.c \
101 lib/printf/vfprintf.c \
102 lib/printf/glue.c \
4a121f99
DL
103 # end
104
3a11599c
DL
105nodist_lib_libfrr_la_SOURCES = \
106 yang/frr-interface.yang.c \
107 yang/frr-route-types.yang.c \
e6a0538b 108 yang/ietf/ietf-routing-types.yang.c \
3a11599c
DL
109 yang/frr-module-translator.yang.c \
110 # end
111
74dc19a2
DL
112vtysh_scan += \
113 $(top_srcdir)/lib/distribute.c \
114 $(top_srcdir)/lib/filter.c \
115 $(top_srcdir)/lib/if.c \
116 $(top_srcdir)/lib/if_rmap.c \
117 $(top_srcdir)/lib/keychain.c \
1c0d8808 118 $(top_srcdir)/lib/lib_vty.c \
74dc19a2
DL
119 $(top_srcdir)/lib/nexthop_group.c \
120 $(top_srcdir)/lib/plist.c \
121 $(top_srcdir)/lib/routemap.c \
122 $(top_srcdir)/lib/vrf.c \
123 $(top_srcdir)/lib/vty.c \
124 # end
125# can be loaded as DSO - always include for vtysh
126vtysh_scan += $(top_srcdir)/lib/agentx.c
127
1c2facd1 128if SQLITE3
fdbd8086 129lib_libfrr_la_LIBADD += $(SQLITE3_LIBS)
1c2facd1
RW
130lib_libfrr_la_SOURCES += lib/db.c
131endif
132
8f90d89b
RW
133lib/if_clippy.c: $(CLIPPY_DEPS)
134lib/if.lo: lib/if_clippy.c
f1b32b2e 135lib/plist_clippy.c: $(CLIPPY_DEPS)
4a121f99 136lib/plist.lo: lib/plist_clippy.c
dba32923
DS
137lib/nexthop_group_clippy.c: $(CLIPPY_DEPS)
138lib/nexthop_group.lo: lib/nexthop_group_clippy.c
1c2facd1
RW
139lib/northbound_cli_clippy.c: $(CLIPPY_DEPS)
140lib/northbound_cli.lo: lib/northbound_cli_clippy.c
2950f5da
DS
141lib/vty_clippy.c: $(CLIPPY_DEPS)
142lib/vty.lo: lib/vty_clippy.c
f73126c3
SW
143lib/log_vty_clippy.c: $(CLIPPY_DEPS)
144lib/log_vty.lo: lib/log_vty_clippy.c
4a121f99
DL
145
146pkginclude_HEADERS += \
8e1f6512 147 lib/agg_table.h \
bcea0c0f 148 lib/atomlist.h \
4a121f99
DL
149 lib/bfd.h \
150 lib/bitfield.h \
151 lib/buffer.h \
152 lib/checksum.h \
14beb548 153 lib/mlag.h \
4a121f99
DL
154 lib/command.h \
155 lib/command_graph.h \
156 lib/command_match.h \
de1a880c 157 lib/compiler.h \
4a121f99 158 lib/csv.h \
1c2facd1 159 lib/db.h \
aea03ad6 160 lib/debug.h \
96673e06 161 lib/defaults.h \
4a121f99 162 lib/distribute.h \
3155489a 163 lib/ferr.h \
4a121f99 164 lib/filter.h \
cd85bc2e 165 lib/freebsd-queue.h \
5dbb0a7b 166 lib/frrlua.h \
4a121f99
DL
167 lib/frr_pthread.h \
168 lib/frratomic.h \
3e41733f 169 lib/frrcu.h \
fe011935 170 lib/frrstr.h \
4a121f99
DL
171 lib/getopt.h \
172 lib/graph.h \
173 lib/hash.h \
174 lib/hook.h \
17136bf2 175 lib/iana_afi.h \
a94eca09 176 lib/id_alloc.h \
4a121f99
DL
177 lib/if.h \
178 lib/if_rmap.h \
179 lib/imsg.h \
180 lib/ipaddr.h \
181 lib/jhash.h \
182 lib/json.h \
183 lib/keychain.h \
b66d022e 184 lib/lib_errors.h \
1c0d8808 185 lib/lib_vty.h \
4a121f99
DL
186 lib/libfrr.h \
187 lib/libospf.h \
188 lib/linklist.h \
189 lib/log.h \
f73126c3 190 lib/log_vty.h \
4a121f99
DL
191 lib/md5.h \
192 lib/memory.h \
4a121f99
DL
193 lib/module.h \
194 lib/monotime.h \
195 lib/mpls.h \
196 lib/network.h \
197 lib/nexthop.h \
7ee30f28 198 lib/nexthop_group.h \
50d89650 199 lib/nexthop_group_private.h \
1c2facd1
RW
200 lib/northbound.h \
201 lib/northbound_cli.h \
202 lib/northbound_db.h \
4a121f99
DL
203 lib/ns.h \
204 lib/openbsd-queue.h \
205 lib/openbsd-tree.h \
206 lib/plist.h \
4a121f99 207 lib/prefix.h \
5c25bd87 208 lib/printfrr.h \
4a121f99
DL
209 lib/privs.h \
210 lib/ptm_lib.h \
5c52c06c 211 lib/pullwr.h \
6833ae01 212 lib/pw.h \
4a121f99 213 lib/qobj.h \
cd85bc2e 214 lib/queue.h \
5318d896 215 lib/ringbuf.h \
4a121f99 216 lib/routemap.h \
31bfa062 217 lib/sbuf.h \
440d5faa 218 lib/seqlock.h \
4a121f99
DL
219 lib/sha256.h \
220 lib/sigevent.h \
221 lib/skiplist.h \
98ea5be8 222 lib/smux.h \
4a121f99
DL
223 lib/sockopt.h \
224 lib/sockunion.h \
225 lib/spf_backoff.h \
226 lib/srcdest_table.h \
227 lib/stream.h \
228 lib/systemd.h \
229 lib/table.h \
230 lib/termtable.h \
231 lib/thread.h \
80911bc2 232 lib/typerb.h \
abd71baa 233 lib/typesafe.h \
4a121f99 234 lib/vector.h \
4a121f99
DL
235 lib/vlan.h \
236 lib/vrf.h \
237 lib/vrf_int.h \
238 lib/vty.h \
239 lib/vxlan.h \
240 lib/wheel.h \
241 lib/workqueue.h \
1c2facd1
RW
242 lib/yang.h \
243 lib/yang_translator.h \
244 lib/yang_wrappers.h \
4a121f99
DL
245 lib/zassert.h \
246 lib/zclient.h \
247 lib/zebra.h \
0031a6bb 248 lib/pbr.h \
4a121f99
DL
249 # end
250
58f8a9ec 251
70d27c5b
DL
252nodist_pkginclude_HEADERS += \
253 lib/route_types.h \
254 lib/version.h \
255 # end
256
4a121f99
DL
257noinst_HEADERS += \
258 lib/clippy.h \
259 lib/log_int.h \
260 lib/plist_int.h \
5c25bd87
DL
261 lib/printf/printfcommon.h \
262 lib/printf/printflocal.h \
4a121f99
DL
263 #end
264
d6e76257
DL
265# General note about module and module helper library (libfrrsnmp, libfrrzmq)
266# linking: If we're linking libfrr statically into daemons, we *must* remove
267# libfrr from modules because modules will always link it in dynamically and
268# thus 2 copies of libfrr will be loaded... hilarity ensues.
269#
270# Not linking libfrr into modules should generally work fine because the
271# executable refers to libfrr either way and the dynamic linker should make
272# libfrr available to modules. If some OS platform has a dynamic linker that
273# doesn't do that, libfrr needs to be readded to modules, but _only_ _if_
274# it's not linked into daemons statically.
275
4a121f99
DL
276#
277# SNMP support
278#
279if SNMP
280lib_LTLIBRARIES += lib/libfrrsnmp.la
281endif
282
7aad1594 283lib_libfrrsnmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu99
4a121f99 284lib_libfrrsnmp_la_LDFLAGS = -version-info 0:0:0
d6e76257 285lib_libfrrsnmp_la_LIBADD = $(SNMP_LIBS)
4a121f99
DL
286lib_libfrrsnmp_la_SOURCES = \
287 lib/agentx.c \
4a121f99
DL
288 lib/snmp.c \
289 # end
290
fe9e7b71
DL
291#
292# c-ares support
293#
294if CARES
295lib_LTLIBRARIES += lib/libfrrcares.la
296pkginclude_HEADERS += lib/resolver.h
297endif
298
299lib_libfrrcares_la_CFLAGS = $(WERROR) $(CARES_CFLAGS)
300lib_libfrrcares_la_LDFLAGS = -version-info 0:0:0
301lib_libfrrcares_la_LIBADD = $(CARES_LIBS)
302lib_libfrrcares_la_SOURCES = \
303 lib/resolver.c \
304 #end
305
b6116506
DL
306#
307# ZeroMQ support
308#
309if ZEROMQ
310lib_LTLIBRARIES += lib/libfrrzmq.la
311pkginclude_HEADERS += lib/frr_zmq.h
312endif
313
314lib_libfrrzmq_la_CFLAGS = $(WERROR) $(ZEROMQ_CFLAGS)
315lib_libfrrzmq_la_LDFLAGS = -version-info 0:0:0
d6e76257 316lib_libfrrzmq_la_LIBADD = $(ZEROMQ_LIBS)
b6116506
DL
317lib_libfrrzmq_la_SOURCES = \
318 lib/frr_zmq.c \
319 #end
320
5bce33b3
RW
321#
322# Tail-f's ConfD support
323#
324if CONFD
325module_LTLIBRARIES += lib/confd.la
326endif
327
328lib_confd_la_CFLAGS = $(WERROR) $(CONFD_CFLAGS)
329lib_confd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
fdbd8086 330lib_confd_la_LIBADD = lib/libfrr.la $(CONFD_LIBS)
5bce33b3
RW
331lib_confd_la_SOURCES = lib/northbound_confd.c
332
a7ca2199
RW
333#
334# Sysrepo support
335#
336if SYSREPO
337module_LTLIBRARIES += lib/sysrepo.la
338endif
339
fdbd8086 340lib_sysrepo_la_CFLAGS = $(WERROR) $(SYSREPO_CFLAGS)
a7ca2199 341lib_sysrepo_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
fdbd8086 342lib_sysrepo_la_LIBADD = lib/libfrr.la $(SYSREPO_LIBS)
a7ca2199
RW
343lib_sysrepo_la_SOURCES = lib/northbound_sysrepo.c
344
ec2ac5f2
RW
345#
346# gRPC northbound plugin
347#
348if GRPC
349module_LTLIBRARIES += lib/grpc.la
350endif
351
352lib_grpc_la_CXXFLAGS = $(WERROR) $(GRPC_CFLAGS)
353lib_grpc_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
354lib_grpc_la_LIBADD = lib/libfrr.la grpc/libfrrgrpc_pb.la $(GRPC_LIBS)
355lib_grpc_la_SOURCES = lib/northbound_grpc.cpp
356
4a121f99
DL
357#
358# CLI utilities
359#
360noinst_PROGRAMS += \
4a121f99
DL
361 lib/grammar_sandbox \
362 # end
363
89727c8d
DL
364if BUILD_CLIPPY
365noinst_PROGRAMS += lib/clippy
366else
a71c5039
DL
367if HOSTTOOLS_CLIPPY
368$(CLIPPY):
369 @$(MAKE) -C $(top_builddir)/hosttools lib/route_types.h lib/clippy
370endif
89727c8d
DL
371endif
372
4a121f99
DL
373lib_grammar_sandbox_SOURCES = \
374 lib/grammar_sandbox_main.c
375lib_grammar_sandbox_LDADD = \
376 lib/libfrr.la
377
dbac691d
DL
378lib_clippy_CPPFLAGS = $(AM_CPPFLAGS) -D_GNU_SOURCE -DBUILDING_CLIPPY
379lib_clippy_CFLAGS = $(PYTHON_CFLAGS)
4a121f99 380lib_clippy_LDADD = $(PYTHON_LIBS)
dbac691d 381lib_clippy_LDFLAGS = -export-dynamic
4a121f99
DL
382lib_clippy_SOURCES = \
383 lib/clippy.c \
384 lib/command_graph.c \
385 lib/command_lex.l \
386 lib/command_parse.y \
387 lib/command_py.c \
388 lib/defun_lex.l \
389 lib/graph.c \
390 lib/memory.c \
391 lib/vector.c \
392 # end
393
aad24c5b
DL
394# (global) clippy rules for all directories
395
396AM_V_CLIPPY = $(am__v_CLIPPY_$(V))
397am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY))
398am__v_CLIPPY_0 = @echo " CLIPPY " $@;
399am__v_CLIPPY_1 =
400
a71c5039 401CLIPPY_DEPS = $(CLIPPY) $(top_srcdir)/python/clidef.py
aad24c5b 402
ec2ac5f2 403SUFFIXES = _clippy.c .proto .pb-c.c .pb-c.h .pb.h .pb.cc .grpc.pb.cc
aad24c5b 404.c_clippy.c:
a71c5039 405 $(AM_V_CLIPPY) $(CLIPPY) $(top_srcdir)/python/clidef.py -o $@ $<
aad24c5b
DL
406
407## automake's "ylwrap" is a great piece of GNU software... not.
408.l.c:
409 $(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
410.y.c:
411 $(AM_V_YACC)$(am__skipyacc) $(YACCCOMPILE) $<
4a121f99
DL
412
413#
414# generated sources & extra foo
415#
416EXTRA_DIST += \
417 lib/command_lex.h \
70d27c5b 418 lib/command_parse.h \
4a121f99 419 lib/gitversion.pl \
4a121f99
DL
420 lib/route_types.pl \
421 lib/route_types.txt \
422 # end
423
424BUILT_SOURCES += \
4a121f99
DL
425 lib/gitversion.h \
426 lib/route_types.h \
427 # end
428
f1b32b2e
DL
429## force route_types.h
430$(lib_clippy_OBJECTS): lib/route_types.h
431$(lib_libfrr_la_OBJECTS): lib/route_types.h
432
4a121f99
DL
433AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@ @BISON_VERBOSE@
434
435lib/command_lex.h: lib/command_lex.c
436 @if test ! -f $@; then rm -f "lib/command_lex.c"; else :; fi
437 @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) "lib/command_lex.c"; else :; fi
f1b32b2e 438lib/command_lex.lo: lib/command_parse.h
4a121f99 439lib/command_parse.lo: lib/command_lex.h
fdbd8086
DL
440lib/clippy-command_lex.$(OBJEXT): lib/command_parse.h
441lib/clippy-command_parse.$(OBJEXT): lib/command_lex.h
f1b32b2e 442lib/lib_clippy-command_lex.$(OBJEXT): lib/command_parse.h
4a121f99
DL
443lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h
444
445lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl
fdbd8086 446 $(PERL) $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@
67cf020d 447DISTCLEANFILES += lib/route_types.h
4a121f99
DL
448
449if GIT_VERSION
450# bit of a trick here to always have up-to-date git stamps without triggering
451# unneccessary rebuilds. .PHONY causes the .tmp file to be rebuilt always,
452# but if we use that on gitversion.h it'll ripple through the .c file deps.
453# (even if gitversion.h's file timestamp doesn't change, make will think it
454# did, because of .PHONY...)
455
9e53b315 456PHONY_GITVERSION=lib/gitversion.h.tmp
4a121f99
DL
457.SILENT: lib/gitversion.h lib/gitversion.h.tmp
458GITH=lib/gitversion.h
459lib/gitversion.h.tmp: $(top_srcdir)/.git
fdbd8086 460 $(PERL) $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
4a121f99 461lib/gitversion.h: lib/gitversion.h.tmp
bd402424 462 { test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp ${GITH}.tmp ${GITH}
4a121f99
DL
463
464else
9e53b315 465PHONY_GITVERSION=lib/gitversion.h
4a121f99
DL
466lib/gitversion.h:
467 true
468endif
9e53b315 469.PHONY: $(PHONY_GITVERSION)