|
|
1.1 root 1: #!/bin/sh
2: # $Header: makedepend.SH,v 4.3.1.2 85/05/13 15:53:42 lwall Exp $
3: #
4: # $Log: makedepend.SH,v $
5: # Revision 4.3.1.2 85/05/13 15:53:42 lwall
6: # Made cpp look in /usr/local/include too.
7: #
8: # Revision 4.3.1.1 85/05/10 11:35:10 lwall
9: # Branch for patches.
10: #
11: # Revision 4.3 85/05/01 11:42:26 lwall
12: # Baseline for release with 4.3bsd.
13: #
14:
15: export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
16:
17: cat /dev/null >.deptmp
18: echo "(Note: this is going to take a while.)"
19: rm -f X*.c
20: for file in *.c; do
21: filebase=`basename $file .c`
22: echo "Finding dependencies for $filebase.o."
23: sed -n <$file >X$file \
24: -e "/^${filebase}_init(/q" \
25: -e '/^#/{' \
26: -e 's|/\*.*$||' \
27: -e p \
28: -e '}'
29: cc -E -I/usr/local/include X$file | sed \
30: -e '/^# *[0-9]/!d' \
31: -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
32: -e 's|: \./|: |' \
33: -e 's|: X|: |' | \
34: uniq | sort | uniq >> .deptmp
35: done
36:
37: for file in *.SH; do
38: echo `basename $file .SH`: $file config.sh \; /bin/sh $file >> .deptmp
39: done
40:
41: sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
42:
43: if /bin/test -s .deptmp; then
44: echo "Updating Makefile..."
45: echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new
46: cat .deptmp >>Makefile.new
47: else
48: echo "You don't seem to have a proper C preprocessor. Using grep instead."
49: /usr/bin/egrep '^#include ' *.c *.h >.deptmp
50: echo "Updating Makefile..."
51: <.deptmp sed -n 's|c:#include "\(.*\)".*$$|o: \1|p' >> Makefile.new
52: <.deptmp sed -n 's|c:#include <\(.*\)>.*$$|o: /usr/include/\1|p' >> Makefile.new
53: <.deptmp sed -n 's|h:#include "\(.*\)".*$$|h: \1|p' >> Makefile.new
54: <.deptmp sed -n 's|h:#include <\(.*\)>.*$$|h: /usr/include/\1|p' >> Makefile.new
55: fi
56: mv Makefile Makefile.old
57: mv Makefile.new Makefile
58: echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
59: rm .deptmp X*.c
60:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.