From 20a34def21f82d23fb639d44e5107d68160ec454 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 8 Jul 2011 16:28:51 +0400 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D1=88=D0=B8=D0=BB=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C,=20=D1=87?= =?UTF-8?q?=D1=82=D0=BE=D0=B1=D1=8B=20=D0=B1=D1=8B=D0=BB=D0=BE=204=20?= =?UTF-8?q?=D0=BC=D0=B0=D1=81=D1=81=D0=B8=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/smake/smake.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/bash/smake/smake.sh b/bash/smake/smake.sh index eb50d03..c6e4319 100755 --- a/bash/smake/smake.sh +++ b/bash/smake/smake.sh @@ -129,6 +129,7 @@ echo "target_objs = \\" >> Makefile for to in $target_obj_lst; do echo -e "\t$to \\" >> Makefile done +echo >> Makefile echo '$(TARGET): $(target_objs)' >> Makefile echo -e '\t$(CC) $(LDFLAGS) -o $@ $(target_objs)' >> Makefile @@ -145,13 +146,14 @@ for cf in `echo "$target_dep_lst" | grep -P '.c$'`; do fi done if [ "$CF" == "" ]; then - files_not_dound="$files_not_found\n$cf" + files_not_found="$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` + old_target_dep_lst= files_not_found= while [[ "$target_dep_lst" != "$old_target_dep_lst" ]]; do old_target_dep_lst=$target_dep_lst @@ -174,9 +176,25 @@ for cf in `echo "$target_dep_lst" | grep -P '.c$'`; do done done - echo "$to: " >> Makefile + target_dep_lst= + for f in $old_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=`echo "$F $target_dep_lst" | sed 's~ ~\n~g' | sort -u` + done + + echo "$to: \\" >> Makefile for td in $target_dep_lst; do - td=`echo "$td" | sed "s~^\./~~ ; s~${HOME}~$\(HOME\)~"` + td=`echo "$td" | sed "s~^\./~~ ; s~^\./~~ ; s~${HOME}~$\(HOME\)~"` echo -e "\t$td \\" >> Makefile done echo >> Makefile