File: makedepend.SH

package info (click to toggle)
trn 3.6-13
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 1,620 kB
  • ctags: 1,535
  • sloc: ansic: 25,214; sh: 4,637; makefile: 1,032; yacc: 660
file content (81 lines) | stat: -rw-r--r-- 2,655 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting makedepend (with variable substitutions)"
case "$srcdir" in
'') srcdir='.';;
esac
$spitshell >makedepend <<!GROK!THIS!
$startsh
# $Id: makedepend.SH,v 3.0 1991/09/09 20:23:31 davison Trn $
# 
# This software is Copyright 1991 by Stan Barber. 
#
# Permission is hereby granted to copy, reproduce, redistribute or otherwise
# use this software as long as: there is no monetary profit gained
# specifically from the use or reproduction of this software, it is not
# sold, rented, traded or otherwise marketed, and this copyright notice is
# included prominently in any copy made. 
#
# The author make no claims as to the fitness or correctness of this software
# for any use whatsoever, and it is provided as is. Any use of this software
# is at the user's own risk. 
export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)

srcdir=$srcdir
objdir=`pwd`
deptmp=\$objdir/.deptmp
$cat /dev/null >\$deptmp
$echo "(Note: this is going to take a while.)"
cd \$srcdir
for file in *.[cy]; do
    case "\$file" in
    *.c) filebase=\`basename \$file .c\`;;
    *.y) filebase=\`basename \$file .y\`;;
    esac
    $echo "Finding dependencies for \$filebase.o."
    $sed -n <\$file \\
	-e "/^\${filebase}_init(/q" \\
	-e '/^#/{' \\
	-e 's|/\*.*$||' \\
	-e 's/\\\\[ 	]*$//' \\
	-e p \\
	-e '}' | $cppstdin -I\$objdir -I$usrinc $cppminus | $sed \\
	-e '/^# *line/s/line//' \
	-e '/^# *[0-9]/!d' \\
	-e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
	-e 's|: \./|: |' \\
	-e "s|\$objdir/||" \\
	-e 's/: .*\.c/: '\$file'/' | \\
	$uniq | $sort | $uniq >>\$deptmp
done

for file in *.SH; do
    $echo \`basename \$file .SH\`: \$file config.sh \; /bin/sh "\\\$(srcdir)/\$file" >>\$deptmp
done

cd \$objdir

$sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'

if $test -s \$deptmp; then
    echo "Updating Makefile..."
    $sed -e 's/\\\$[^(]/\$\$/g' \$deptmp | $egrep -v $usrinc >dependencies
else
    $echo "You don't seem to have a proper C preprocessor.  Using grep instead."
    cd \$srcdir
    $egrep '^#include ' *.[cyh] ?.[cyh] >\$deptmp
    cd \$objdir
    echo "Updating Makefile..."
    <\$deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' > dependencies
    <\$deptmp $sed -n 's|y:#include "\(.*\)".*\$\$|o: \1|p' >> dependencies
    <\$deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> dependencies
fi
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> dependencies
$mv Makefile Makefile.old
$mv Makefile.new Makefile
$cat dependencies >>Makefile
rm \$deptmp
!GROK!THIS!
$eunicefix makedepend
chmod 755 makedepend