Go to file
Yann E. MORIN da4cb17aa1 Makefile: introduce show-vars, a json-formatted equivalent to printvars
The current printvars output suffers from a serious design flaw:
variables are not delimited, which makes it impossible to reliably
retrieve the value of variables; only variables that are known to
not contain a \n can be relatively safely extracted.

However, in some cases, it is important to be able to retrieve the
multi-line value of a variable, notably the CMDS or the hooks. One
such use-case (to follow in an unscheduled future) would be to hash
the variables that make up a package "configuration", and cache or
extract the files for that package to speed up the build.

Modeled after printvars and show-info, we introduce show-vars (what a
lack of imagination here) that outputs a json dictionary which keys are
the variable names, and for each variable, provides the raw and expanded
values.

Unlike printvars, we do not provide a way to get either the raw or
expanded value; both are systematically printed; a user will get just
the one is needs. Additionally, strings in JSON are quoted, so there is
no need to provide a way to quote variables; that would not make sense.

Note: for printvars, we require that the user provides an explicit
pattern to filter variables on. This is historical (see fd5bd12379,
Makefile: printvars: don't print anything when VARS is not set). The
underlying reasoning was that printvars is too "raw", and variables are
not well delimited, so printvars was mostly used to extract a few values
here and there, from scripts, or to quickly inspect a specific package's
variables during debugging.

But show-vars, although technically plain-text, being JSON, is not very
human-readable, and is mostly aimed at tools that will parse it with a
real JSON parser, and which will want to have a complete view of a lot
of variables at once. As such, and contrary to printvars, it makes sense
to report on all variables by default, unless the user explicitly
requested a subset.

As a final note: a lot of our variables only make sense in the context
of an actual make target. For example, a variable of package foo, that
contains $(@D)/bar, would expand to .../build/FOO-VERSION/bar. This is
because our CMDS and hooks are expanded as the recipe of a stamp file
that lies in the package build directory.

But for show-info, this falls flat on its face: it is not the stamp file
of a package, so there is no package directory, and show-info itself has
not directory part, so $(@D) expands to '.' (dot).

Additionally, some variables may contain calls to $(shell) (e.g. to call
pkg-config), and this also does not work with show-info.

These two issues make it impossible to emit the correct expanded value
of variables. To be noted: printvars has the exact same limitations for
the exact same reasons.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-12-30 21:37:02 +01:00
arch
board configs/imx6ulpico: bump U-Boot and kernel, switch to extlinux.conf 2021-12-29 23:53:16 +01:00
boot boot/barebox: bump version to 2021.12.0 2021-12-30 21:15:57 +01:00
configs configs/imx6ulpico: bump U-Boot and kernel, switch to extlinux.conf 2021-12-29 23:53:16 +01:00
docs docs/website: update for 2021.02.8 2021-12-14 23:25:34 +01:00
fs
linux linux: bump CIP RT kernel to version 5.10.83-cip1-rt1 2021-12-12 13:21:43 +01:00
package core/show-info: also export source and stamp directories in show-info 2021-12-30 21:36:01 +01:00
support support/misc/utils: introduce $(tab)=\t and $(escape)=\x1b 2021-12-30 21:31:27 +01:00
system
toolchain toolchain: re-generate Bootlin toolchain descriptions 2021-12-30 18:43:23 +01:00
utils utils/diffconfig: use python3 explicitly 2021-12-29 10:07:59 +01:00
.defconfig
.flake8
.gitignore
.gitlab-ci.yml
CHANGES Update for 2021.02.8 2021-12-14 23:22:57 +01:00
Config.in
Config.in.legacy toolchain: re-generate Bootlin toolchain descriptions 2021-12-30 18:43:23 +01:00
COPYING
DEVELOPERS configs/microchip_sama7g5ek: new defconfigs 2021-12-28 22:01:50 +01:00
Makefile Makefile: introduce show-vars, a json-formatted equivalent to printvars 2021-12-30 21:37:02 +01:00
Makefile.legacy
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches