Hello again,
the following tool calculates the dependencies in $(MAINBOARD)/auto.c and inserts these into the two makefiles for normal and fallback images. It intentionally disregards the referenced header files, but instead it helped me to find an incorrect inclusion of bist.h in the basis I presently use. Thus you might be forced to inspect these by hand, after running the script. Once again, the script only searches for lines of the type
#include "whatever/you/like"
The call is simple enough:
watch_auto_c.sh targets/msi/ms6147/ms6147/
Please regard this snippet as taster of what could be done, were the incorporated dependencies deeper in the python tool itself. Already now the manipulated makefiles catch very well the groundwork changes I do to the subsystems for the boot images.
Best regards for now,
Mats E Andersson
---
#!/bin/sh # # A tool to include direct dependencies for auto.c. # A constant is built containing these dependencies, # and is then inserted into {normal,fallback}/Makefile. # if [ -z "$1" ];then echo "A target directory is mandatory. Aborting." exit 1 fi
if [ ! -s "$1/Makefile" ]; then echo "Wrong directory, or "Makefile" is missing." exit 1 fi
if grep -q AUTO_C_INCLUDES $1/fallback/Makefile; then echo "Already done." exit 0 fi
TOP=$(sed -n 's/TOP:=(.*)/\1/p' $1/Makefile.settings) TARGET_DIR=$(sed -n 's/TARGET_DIR:=(.*)/\1/p' $1/Makefile.settings) TARGET_DIR=$(dirname $TARGET_DIR)
AUTO_C_INCLUDES=$(perl -n -e 'if ( m/^\s*#\s*include\s*"/ ) { m/"(.*)"/; print "$(TOP)/src/" . $1 . " ";};' $TOP/src/mainboard/$TARGET_DIR/auto.c)
for nn in $1/{normal,fallback}/Makefile; do sed -i "/^CRT0_INCLUDES/,/^$/ {/^$/a\ AUTO_C_INCLUDES:=$AUTO_C_INCLUDES\n }; s/.*:.*/auto.c.*/& $(AUTO_C_INCLUDES)/;" $nn done