]> git.proxmox.com Git - mirror_frr.git/commitdiff
build: extract xrefs
authorDavid Lamparter <equinox@diac24.net>
Tue, 28 Apr 2020 11:17:20 +0000 (13:17 +0200)
committerDavid Lamparter <equinox@diac24.net>
Tue, 23 Feb 2021 15:56:58 +0000 (16:56 +0100)
Signed-off-by: David Lamparter <equinox@diac24.net>
.gitignore
lib/subdir.am
python/makefile.py

index fbbb04b60c5a26982b23461e4266154599151caf..97349769adeb62e8c4e9c21d60224240d5a31d10 100644 (file)
@@ -59,6 +59,7 @@
 *.cg.json
 *.cg.dot
 *.cg.svg
+*.xref
 
 ### gcov outputs
 
index 15c64921404318e787b97a9c5892164378f8e056..96d5fcba307f04fa49f8be24ff0b1c3eb65af01d 100644 (file)
@@ -441,6 +441,26 @@ SUFFIXES += _clippy.c
 .c_clippy.c:
        $(AM_V_CLIPPY) $(CLIPPY) $(top_srcdir)/python/clidef.py -o $@ $<
 
+# xrelfo, the ELF xref extractor
+
+AM_V_XRELFO = $(am__v_XRELFO_$(V))
+am__v_XRELFO_ = $(am__v_XRELFO_$(AM_DEFAULT_VERBOSITY))
+am__v_XRELFO_0 = @echo "  XRELFO  " $@;
+am__v_XRELFO_1 =
+
+SUFFIXES += .xref
+%.xref: % $(CLIPPY)
+       $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -Wlog-format -o $@ $<
+
+# dependencies added in python/makefile.py
+frr.xref:
+       $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -o $@ $^
+all-am: frr.xref
+
+clean-xref:
+       -rm -rf $(xrefs) frr.xref
+clean-local: clean-xref
+
 ## automake's "ylwrap" is a great piece of GNU software... not.
 .l.c:
        $(AM_V_LEX)$(am__skiplex) $(LEXCOMPILE) $<
index 10c73df72df3a3873750730f48091ad98b4c21c0..44658013b3f49e2826a5f9422aeb5e033bef399e 100644 (file)
@@ -31,6 +31,10 @@ clippy_scan = mv["clippy_scan"].strip().split()
 for clippy_file in clippy_scan:
     assert clippy_file.endswith(".c")
 
+xref_targets = []
+for varname in ["bin_PROGRAMS", "sbin_PROGRAMS", "lib_LTLIBRARIES", "module_LTLIBRARIES"]:
+    xref_targets.extend(mv[varname].strip().split())
+
 # check for files using clippy but not listed in clippy_scan
 if args.dev_build:
     basepath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -124,6 +128,14 @@ out_lines.append("# clippy{\n# main clippy targets")
 for clippy_file in clippy_scan:
     out_lines.append(clippydep.substitute(clippybase=clippy_file[:-2]))
 
+out_lines.append("")
+out_lines.append("xrefs = %s" % (" ".join(["%s.xref" % target for target in xref_targets])))
+out_lines.append("frr.xref: $(xrefs)")
+out_lines.append("")
+
+#frr.xref: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(lib_LTLIBRARIES) $(module_LTLIBRARIES)
+#      $(AM_V_XRELFO) $(CLIPPY) $(top_srcdir)/python/xrelfo.py -o $@ $^
+
 out_lines.append("")
 out_lines.extend(bcdeps)
 out_lines.append("")