[PATCH] Use file names relative to the source directory in the #include directives.
Hello! I've got tired typing "find src -type f -name 'cl_foo.h'" ever and ever, hence this patch: http://theor.jinr.ru/~varg/patchbomb/0001-Use-file-names-relative-to-the-sou... (I don't post it here since it's quite big: ~ 500kb uncompressed). All (except src/Makefile.in) hunks were automagically generated with the following shell script: if [ ! -f src/base/cl_free.cc ]; then echo "`basename $0`: please chdir to the CLN top source directory." exit 2 fi FILES=$(find src -type f -name '*.cc' -or -name '*.h' | \ xargs grep -l -e '#include\ "cl_.*\.h' | sort -n | uniq) SED_SCRIPT=$0.sed for FILE in $FILES; do sed -n -e \ 's,^#include[ \t]\+\"cl_\([^.]\+\)\.\(h\|\(cc\)\)\"[ \t]*$,cl_\1.\2,p' \ $FILE done | sort -n | uniq | \ while read inc; do real_inc=$(find src -type f -name $inc) if [ `echo $real_inc | wc -l` -ge 2 ]; then echo "***" >&2 echo "*** ${inc} included by $FILE is ambigous" >&2 echo "***" >&2 exit 1 elif [ -z "$real_inc" ]; then # Probably configure-generated file? inc_in=$(find src -type f -name ${inc}.in) if [ -n "inc_in" ]; then real_inc=${inc_in%%.in} fi fi if [ -n "$real_inc" ]; then echo "s%^#include[ \\\\t]\\+\\\"${inc}\\\"%#include\\ \\\"${real_inc##src/}\\\"%g" fi done | sort -n | uniq > $SED_SCRIPT for FILE in $FILES; do sed --in-place=.bak -f $SED_SCRIPT $FILE done Best regards, Alexei -- All science is either physics or stamp collecting.
participants (1)
-
Alexei Sheplyakov