]> git.proxmox.com Git - mirror_frr.git/blobdiff - yang/subdir.am
yang: embed models into binaries
[mirror_frr.git] / yang / subdir.am
index d68a341a9faeac0a508cdf1922b56a0c0e04d98d..ee6fbc181d1cd4e1596703a0745c7b5741117174 100644 (file)
@@ -1,3 +1,24 @@
+SUFFIXES += .yang .yang.c .yin .yin.c
+EXTRA_DIST += yang/embedmodel.py
+
+.yang.yang.c:
+       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/yang/embedmodel.py $^ $@
+.yin.yin.c:
+       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/yang/embedmodel.py $^ $@
+
+# use .yang.c files like this:
+#
+# ripd_ripd_SOURCES = \
+#      ...
+# nodist_ripd_ripd_SOURCES = \
+#      yang/frr-ripd.yang.c \
+#      # end
+#
+# Note that putting the .yang.c file into a static library.a will NOT work
+# because the entire file is "optimized out" since it does not contain any
+# global symbols :(.  Just put it in the daemon.  Dynamic libraries.so work
+# without problems, as seen in libfrr.
+
 dist_yangmodels_DATA += yang/frr-module-translator.yang
 dist_yangmodels_DATA += yang/frr-interface.yang
 dist_yangmodels_DATA += yang/frr-route-types.yang