diff --git a/Makefile b/Makefile index fd4f9c85df..5d7528af64 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconf defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \ print-version olddefconfig distclean manual manual-% check-package \ - check-package-external + check-package-external show-info-all # Some global targets do not trigger a build, but are used to collect # metadata, or do various checks. When such targets are triggered, @@ -142,7 +142,7 @@ nobuild_targets := source %-source \ clean distclean help show-targets graph-depends \ %-graph-depends %-show-depends %-show-version \ graph-build graph-size list-defconfigs \ - savedefconfig update-defconfig printvars show-vars + savedefconfig update-defconfig printvars show-vars show-info-all ifeq ($(MAKECMDGOALS),) BR_BUILDING = y else ifneq ($(filter-out $(nobuild_targets),$(MAKECMDGOALS)),) @@ -236,6 +236,13 @@ BR2_CONFIG = $(CONFIG_DIR)/.config ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) -include $(BR2_CONFIG) endif +# show-info-all needs to access the PACKAGES_ALL variable. This variable +# contains a reference to every package present in Buildroot. +# Since the 'show-info-all' command might be used without actually having a +# dotconfig this condition is forced to be set true. +ifeq ($(MAKECMDGOALS),show-info-all) +BR2_HAVE_DOT_CONFIG = y +endif ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),) # Disable top-level parallel build if per-package directories is not @@ -941,15 +948,22 @@ check-dependencies: $(TOPDIR)/support/scripts/graph-depends -C .PHONY: show-info -show-info: +show-info: show-info-inner +show-info: SHOW_INFO_PACKAGES = \ + $(foreach i,$(PACKAGES) $(TARGETS_ROOTFS), \ + $(i) $($(call UPPERCASE,$(i))_FINAL_RECURSIVE_DEPENDENCIES) \ + ) + +.PHONY: show-info-all +show-info-all: show-info-inner +show-info-all: SHOW_INFO_PACKAGES = $(PACKAGES_ALL) + +.PHONY: show-info-inner +show-info-inner: @: $(info $(call clean-json, \ { $(foreach p, \ - $(sort $(foreach i,$(PACKAGES) $(TARGETS_ROOTFS), \ - $(i) \ - $($(call UPPERCASE,$(i))_FINAL_RECURSIVE_DEPENDENCIES) \ - ) \ - ), \ + $(sort $(SHOW_INFO_PACKAGES)), \ $(call json-info,$(call UPPERCASE,$(p)))$(comma) \ ) } \ ) \ @@ -1220,6 +1234,8 @@ help: @echo ' external-deps - list external packages used' @echo ' legal-info - generate info about license compliance' @echo ' show-info - generate info about packages, as a JSON blurb' + @echo ' show-info-all - generate info about all packages in Buildroot,' + @echo ' regardless of configuration or target architecture' @echo ' pkg-stats - generate info about packages as JSON and HTML' @echo ' printvars - dump internal variables selected with VARS=...' @echo ' show-vars - dump all internal variables as a JSON blurb; use VARS=...' diff --git a/docs/manual/common-usage.adoc b/docs/manual/common-usage.adoc index 7437a7c3c0..631c2f7788 100644 --- a/docs/manual/common-usage.adoc +++ b/docs/manual/common-usage.adoc @@ -170,6 +170,18 @@ by using the +show-info+ make target: make show-info ---- +Buildroot can also produce information in the +show-info+ format about all +packages regardless of the configuration or architecture by using ++show-info-all+. +This is used for maintenance tasks that require information about every +package in the tree, such as generating a full-tree SBOM for +https://security.buildroot.org[]. +It does not require a +.config+ file: + +---- +make show-info-all +---- + Buildroot can also produce details about packages as HTML and JSON output using the +pkg-stats+ make target. Amongst other things, these details include whether known CVEs (security vulnerabilities) affect