re-establish kernel assert()s.
[minix.git] / commands / scripts / mkdep.sh
blobad2f1ee0752cae062998061d9641e5d94f166c00
1 #!/bin/sh
3 # mkdep 1.1 - Generate Makefile dependencies. Author: Kees J. Bot
5 # Does what 'cc -M' should do, but no compiler gets it right, they all
6 # strip the leading path of the '.o' file.)
8 # Added option to generate .depend files in subdirectories of given dir.
9 # Jorrit N. Herder
11 set -e
13 case $# in
15 # Display help ...
16 0)
17 echo "Usage: mkdep 'cpp command' file ..." >&2
18 echo " mkdep directory" >&2
21 # Create .depend files ...
23 echo "Creating .depend files in $1"
24 for dir in `find $1 -type d ! -name CVS ! -name .svn`
26 touch $dir/.depend
27 done
32 # Get dependencies ...
34 cpp="$1"; shift
36 for f
38 : < "$f" || exit
40 o=`expr "$f" : '\(.*\)\..*'`.o
41 o=`basename $o`
43 echo
45 $cpp "$f" | \
46 sed -e '/^#/!d
47 s/.*"\(.*\)".*/\1/
48 s:^\./::' \
49 -e '/^<built-in>$/d' \
50 -e '/^<command line>$/d' \
51 -e "s:^:$o\: :" | \
52 sort -u
53 done
54 esac
56 exit 0
59 # $PchId: mkdep.sh,v 1.3 1998/07/23 21:24:38 philip Exp $