core: add rule to dump packages' build order
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 2 Apr 2017 13:03:38 +0000 (15:03 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 13 Apr 2017 21:09:08 +0000 (23:09 +0200)
When debugging hidden dependencies, the build order is very important.
Most notably, it is interesting to identify potential culprits.

Add a new top-level rule, show-biuld-order, that dumps all the packages
in the order they would get built.

Note that there are a few differences with show-targets:

  - more packages are reported, becasue show-targets does not report
    host packages that have no prompt;

  - the output is line-based, because we're using $(info $(1)); getting
    a single output line like show-targets would require we use an
    actual command, like printf '%s ' $(1); but that takes a lot of
    time, while $(info $(1)) is almost instantaneous (the time to parse
    the Makefiles);

  - rootfs targets are not reported.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Peter Korsgaard <peter@korsgaard.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Makefile
package/pkg-generic.mk

index 941bf789c803635aa382b3c67d36baf5fae4179e..919d5898d05ad64a0cce1b299e0ca6f2ab5b7f2c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -757,6 +757,8 @@ legal-info: dirs legal-info-clean legal-info-prepare $(foreach p,$(PACKAGES),$(p
 show-targets:
        @echo $(PACKAGES) $(TARGETS_ROOTFS)
 
+show-build-order: $(patsubst %,%-show-build-order,$(PACKAGES))
+
 graph-build: $(O)/build/build-time.log
        @install -d $(GRAPHS_DIR)
        $(foreach o,name build duration,./support/scripts/graph-build-time \
index 31dbc545577a4630f55eceadaea5c273ab1d231c..3b26e6b4839b5f9d20cf81231b6e42e0b6569923 100644 (file)
@@ -737,6 +737,9 @@ $(1)-show-depends:
 $(1)-show-rdepends:
                        @echo $$($(2)_RDEPENDENCIES)
 
+$(1)-show-build-order: $$(patsubst %,%-show-build-order,$$($(2)_FINAL_ALL_DEPENDENCIES))
+       $$(info $(1))
+
 $(1)-graph-depends: graph-depends-requirements
        $(call pkg-graph-depends,$(1),--direct)