выводятся цели-объекты без зависимостей, пора домой...

This commit is contained in:
Kolan Sh 2011-07-08 19:13:55 +04:00
parent 02cfb8f0ba
commit f0bf0b48f1
1 changed files with 7 additions and 131 deletions

View File

@ -150,8 +150,18 @@ for i in `seq 0 $((nfiles-1))`; do
carry=true
done
echo >> Makefile
echo >> Makefile
# ======= Object's rules =======
for i in `seq 0 $((nfiles-1))`; do
extension=`basename ${flist[$i]} | sed 's~.*\.~~g'`
f=`echo ${flist[$i]} | sed "s~.$extension$~~"`
[[ "$extension" != c && "$extension" != cpp
&& "$extension" != cxx && "$extension" != cc ]] && continue
echo "`basename $f.o:` \\" >> Makefile
echo >> Makefile
done
# ======= Warning =======
files_not_found=`echo -e "$files_not_found" | sort -u`
@ -159,137 +169,3 @@ if [ "$files_not_found" != "" ]; then
echo WARNING: Include files not found: $files_not_found
fi
#####################################################################################
#####################################################################################
#####################################################################################
#####################################################################################
#####################################################################################
exit 0
cat $RULES_FILE >> Makefile
REP_INCLUDE=`echo $REP_INCLUDE | sed "s~-I~~g ; s~\\$(HOME)~${HOME}~"`
# --- Target deplist ---
target_dep_lst=`remove_c_comments.pl $REP_TARGET.c | 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"
C=`echo $f | sed 's~\.h$~\.c~'`
if [ -f "$d/$C" ]; then
target_dep_lst="$target_dep_lst $C"
fi
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
if [ $DEBUG == 1 ]; then
echo -e "target_dep_lst:\n`echo $target_dep_lst | sed -e 's~ ~\n~g' | sed 's~\(^..\)~ \1~g'`"
fi
# --- Target's objects ---
target_obj_lst=`echo "$target_dep_lst" | grep -P '.c$' | sed -e 's~.c$~.o~'`
if [ $DEBUG == 1 ]; then
echo -e "target_obj_lst:\n`echo $target_obj_lst | sed -e 's~ ~\n~g' | sed 's~\(^..\)~ \1~g'`"
fi
# --- Target's target ;) ---
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
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_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
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
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~^\./~~ ; s~${HOME}~$\(HOME\)~"`
echo -e "\t$td \\" >> Makefile
done
echo >> Makefile
done
# ======= Warning =======
files_not_found=`echo -e "$files_not_found" | sort -u`
if [ "$files_not_found" != "" ]; then
echo WARNING: Include files not found: $files_not_found
fi