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