#!/bin/csh -f # Generate makefile dependencies from the source files. # # rcsid="$Header: /ufs/repository/magic/scripts/depend,v 1.1 2000/10/20 18:40:40 tim Exp $" # Example usage: # depend *.c # # Output should then be placed in the Makefile. # be careful not to put any funny characters such as *,[,] in this line: set HEADER_PREFIX='${H}/' echo '# Do not put anything after this line! The rest of this file was produced' echo "# by the program ~cad/src/magic/scripts/depend on `date`." echo " " foreach i ($*) echo \# include file dependencies for \"${i}\" >>/tmp/dependA$$ echo ${i:r}.o:\ $i >>/tmp/dependA$$ fgrep '#include' $i \ | sed -e '/>/tmp/dependA$$ echo ' ' >>/tmp/dependA$$ end set nonomatch foreach j (*.h) sed "/${j}/s%\${HEADER_PREFIX}${j}%${j}%" /tmp/dependB$$ mv /tmp/dependB$$ /tmp/dependA$$ end unset nonomatch cat /tmp/dependA$$ rm /tmp/dependA$$