3 # Copyright (c) 1994, 1996
4 # The Regents of the University of California. All rights reserved.
6 # Redistribution and use in source and binary forms are permitted
7 # provided that this notice is preserved and that due credit is given
8 # to the University of California at Berkeley. The name of the University
9 # may not be used to endorse or promote products derived from this
10 # software without specific prior written permission. This software
11 # is provided ``as is'' without express or implied warranty.
13 # @(#)mkdep.sh 5.11 (Berkeley) 5/5/88
16 PATH
=/bin
:/usr
/bin
:/usr
/ucb
:/usr
/local:/usr
/local
/bin
19 MAKE
=Makefile
# default makefile name is "Makefile"
20 CC
=cc
# default C compiler is "cc"
24 # -c allows you to specify the C compiler
29 # -f allows you to select a makefile name
34 # the -p flag produces "program: program.c" style dependencies
35 # so .o's don't get produced
45 echo 'usage: mkdep [-p] [-c cc] [-f makefile] [flags] file ...'
49 if [ ! -w $MAKE ]; then
50 echo "mkdep: no writeable file \"$MAKE\""
56 trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
60 sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
63 # DO NOT DELETE THIS LINE -- mkdep uses it.
64 # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
68 # If your compiler doesn't have -M, add it. If you can't, the next two
69 # lines will try and replace the "cc -M". The real problem is that this
70 # hack can't deal with anything that requires a search path, and doesn't
71 # even try for anything using bracket (<>) syntax.
73 # egrep '^#include[ ]*".*"' /dev/null $* |
74 # sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
76 # XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
89 if (length(rec $2) > 78) {
103 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
106 # copy to preserve permissions
108 rm -f ${MAKE}.bak
$TMP