#!/bin/sh # $Id$ # @Id. r="" robj="" echo -n "Creating deps.mk for $1..." >/dev/stderr add () { cond=true for i in $r; do if [ $i = $1 ]; then cond=false break fi done if $cond; then r="$r $1" robj="$robj $1.o" fi } parse () { while read a; do echo $a | grep '(\* END USE \*)' >/dev/null 2>&1 if [ "$?" = "0" ]; then break fi for dep in `echo $a | grep '(\* DEP \*)' | sed 's/(\* DEP \*)//g' | sed 's/,//g' | sed 's/;//g'`; do DEPNAME=`echo $1 | rev | cut -d'/' -f1 | rev | cut -d'.' -f1` parse $2/$dep.pas $2 $DEPNAME done done < $1 DEPNAME=`echo $1 | rev | cut -d'/' -f1 | rev | cut -d'.' -f1` add $DEPNAME if [ ! "x$3" = "x" ]; then eval "data=\"\$deps_$3\"" cond=true for i in $data; do if [ $i = $DEPNAME.o ]; then cond=false break fi done if $cond; then eval "deps_$3=\"$data $DEPNAME.o\"" fi fi } for i in `ls -d $1/*.pas`; do echo -n " `echo $i | rev | cut -d"/" -f1 | rev`" >/dev/stderr parse `echo $i` $1 done echo >/dev/stderr echo "all: $robj" for i in $r; do eval "data=\"\$deps_$i\"" echo "$i.o: $i.pas $data" echo " \$(PC) -vw -l- \$(PCFLAGS) -oamb\$(EXEC) -Fu../lib $i.pas" done