···121121122122Clearly, the syntax of build recipe files is complex enough to require actual parsing and evaluation.
123123124124-Such a static analysis of build recipes is possible, though. Lightweight parsers for build recipes already exist, such
125125-as [parse.c][muon-parser] from [muon][muon], which is a lightweight Meson implementation. Such a parser could be used to
126126-turn build recipes into [AST][ast]s, which can then be evaluated using custom rules that do nothing but collect
127127-the names of all dependencies referred to in the build recipe.
124124+Such a static analysis of build recipes is possible, though. Lightweight interpreters for build recipes already exist,
125125+such as [parse.c][muon-parser] from [muon][muon], which is a lightweight Meson implementation. In fact, meson itself
126126+provides an [IntrospectionInterpreter][meson-introspection] capable of identifying dependencies. Such interpreters could
127127+be used to turn build recipes into [AST][ast]s, which can then be evaluated using custom rules that do nothing but
128128+collect the names of all dependencies referred to in the build recipe.
128129129130Of course, such a parser-evaluator would have to be written for each build system, but once the most popular build
130131systems, such as CMake and Meson, are covered, it seems likely that the dependencies of a good proportion of C/C++
···245246[linker]: https://en.wikipedia.org/wiki/Linker_(computing)
246247[meson-deps]: https://mesonbuild.com/Dependencies.html
247248[meson-file]: https://github.com/numpy/numpy/blob/main/numpy/meson.build
249249+[meson-introspection]: https://github.com/mesonbuild/meson/blob/master/mesonbuild/ast/introspection.py
248250[meson]: https://mesonbuild.com/
249251[mkl]: https://docs.cirrus.ac.uk/software-libraries/intel_mkl/
250252[muon-parser]: https://git.sr.ht/~lattis/muon/tree/master/item/src/lang/parser.c