выводятся зависимости объектов, но нужно сделать замены типа $(HOME) и добавить поиск C-файлов, расположенных во вне

This commit is contained in:
Kolan Sh 2011-07-08 15:25:29 +04:00
parent 0cff50dc7d
commit 2202239c13
1 changed files with 44 additions and 0 deletions

View File

@ -136,7 +136,51 @@ echo -e '\t$(CC) $(LDFLAGS) -o $@ $(target_objs)' >> Makefile
echo >> Makefile
# --- Object files deplist ---
for cf in `echo "$target_dep_lst" | grep -P '.c$'`; do
CF=""
for d in . $REP_INCLUDE; do
if [ -f "$d/$cf" ]; then
CF="$d/$cf"
break
fi
done
if [ "$CF" == "" ]; then
files_not_dound="$files_not_found\n$cf"
continue
fi
to=`basename "$cf" | sed 's~.c$~.o~'`
target_dep_lst="$CF "`remove_c_comments.pl $CF | grep -P '^[\t ]*#include[\t ]*"' | sed 's~[^"]*"\([^"]*\)".*~\1~' | sort -u`
files_not_found=
while [[ "$target_dep_lst" != "$old_target_dep_lst" ]]; do
old_target_dep_lst=$target_dep_lst
for f in $target_dep_lst; do
F=""
for d in . $REP_INCLUDE; do
if [ -f "$d/$f" ]; then
F="$d/$f"
break
fi
done
if [ "$F" == "" ]; then
files_not_found="$files_not_found\n$f"
continue
fi
target_dep_lst="$target_dep_lst "`remove_c_comments.pl $F \
| grep -P '^[\t ]*#include[\t ]*"' \
| sed 's~[^"]*"\([^"]*\)".*~\1~' | sort -u`
target_dep_lst=`echo $target_dep_lst | sed 's~ ~\n~g' | sort -u`
done
done
echo "$to: " >> Makefile
for td in $target_dep_lst; do
td=`echo "$td" | sed 's~^\./~~ ; s~a~a~'`
echo -e "\t$td \\" >> Makefile
done
echo >> Makefile
done