3 # Copyright (c) 1987 Regents of the University of California.
6 # Redistribution and use in source and binary forms are permitted
7 # provided that the above copyright notice and this paragraph are
8 # duplicated in all such forms and that any documentation,
9 # advertising materials, and other materials related to such
10 # distribution and use acknowledge that the software was developed
11 # by the University of California, Berkeley. The name of the
12 # University may not be used to endorse or promote products derived
13 # from this software without specific prior written permission.
14 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 # @(#)mkdep.sh 5.12 (Berkeley) 6/30/88
20 # We now use whatever path is already set by the invoker
21 #PATH=/bin:/usr/bin:/usr/ucb
24 set -e # exit immediately if any errors occur
26 MAKE=Makefile # default makefile name is "Makefile"
27 NOSLASH="no" # by default, / dependencies are included
28 CC=cc # default compiler is cc
32 # -f allows you to select a makefile name
37 # -c allows you to select a compiler to use (default is cc)
42 # the -p flag produces "program: program.c" style dependencies
43 # so .o's don't get produced
48 # the -s flag removes dependencies to files that begin with /
61 echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
65 if [ ! -w $MAKE ]; then
66 echo "mkdep: no writeable file \"$MAKE\""
72 trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
76 sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
79 # DO NOT DELETE THIS LINE -- mkdep uses it.
80 # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
84 # If your compiler doesn't have -M, add it. If you can't, the next two
85 # lines will try and replace the "cc -M". The real problem is that this
86 # hack can't deal with anything that requires a search path, and doesn't
87 # even try for anything using bracket (<>) syntax.
89 # egrep '^#include[ ]*".*"' /dev/null $* |
90 # sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
105 if ( noslash = "yes" && dep ~ /^\// ) next
106 if (filenm != prev) {
109 rec = filenm " " dep;
113 if (length(rec dep) > 78) {
115 rec = filenm " " dep;
123 }' noslash="$NOSLASH" >> $TMP
127 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
130 # copy to preserve permissions
132 rm -f ${MAKE}.bak $TMP