mkimage-profiles/bin/report-targets2vars
Michael Shigorin 788cad885e initial target tracing support and reporting
The purpose is being able to examine particular target interdependency
graph for a given image having been configured to avoid convoluted
dependencies (loops in particular).

The implementation is based on SHELL hook hint by John Graham-Cumming:
http://cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
2012-03-19 19:23:38 +02:00

53 lines
869 B
Bash
Executable File

#!/bin/sh
DISTCFG=build/distcfg.mk
[ -s "$DISTCFG" ] || exit 1
VARIABLES=
echo "graph { rankdir=LR;"
echo " { node [height=.1,width=.3,fontname=Helvetica,fontsize=10];"
feat_vars()
{
FEATURE=
while read first second rest; do
case "$first" in
\#[A-Z]*)
continue;; # overridden feature
\#) # feature mark
case "$second" in
profile/*)
FEATURE=;;
*)
FEATURE="$second";;
esac
;;
*)
case "$second" in
=|+=|?=)
case "$first" in
DISTCFG_MK|SUBPROFILES|FEATURES|IMAGE*|MKIMAGE_*)
continue;;
*)
VAR="$first"
VARIABLES="$VARIABLES; $VAR"
;;
esac
;;
*)
continue;;
esac
;;
esac
[ -n "$FEATURE" -a -n "$VAR" ] || continue
echo " \"$FEATURE\" -- \"$VAR\";"
done < "$DISTCFG"
echo " { node [shape=box]$VARIABLES; }"
}
feat_vars | LC_COLLATE=C sort -ru
echo " }"
echo "}"