Don't define new make functions in the product/board configuration, for two reasons:
- If the function is later used in an
Android.mkfile, it will no longer be defined when the product configuration is converted to Starlark, and the
Android.mkfile may not work as intended.
- The Makefile to Starlark converter only looks at one file at a time, and function definitions are often in different files than where they're invoked.
While a make function is really just a variable that's evaluated using the
$(call) function, the Make to Starlark converter will assume any
variable defined with the
define keyword is a function definition and reject
it. So a function would look like:
Some text, arg1: $(1)
We provide scripts to automatically replace some common functions with ones that are defined in the core build system Makefiles. They can be found at build/bazel/mk2rbc.