File: makedepend.sh

package info (click to toggle)
tcm 2.20+TSQD-6
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 22,768 kB
  • sloc: ansic: 78,527; sh: 3,618; makefile: 1,345; perl: 753; yacc: 558; lex: 257
file content (45 lines) | stat: -rwxr-xr-x 902 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
#
# makedepend_sh
# copyright (c) 2000 J. Alan Eldridge
# $Id: makedepend.sh,v 1.2 2002/05/29 08:27:34 henkz Exp $
#

makefile=
makedepend="gcc -MM"

[ -f makefile ] && makefile=makefile
[ -f Makefile ] && makefile=Makefile
[ -f GNUMakefile ] && makefile=GNUMakefile
[ ${makefile} ] || {
     echo cannot find a makefile ... bailing out
     exit 1
}

marker='# DO NOT DELETE THIS LINE -- make depend depends on it.'


grep "${marker}" ${makefile} >/dev/null 2>&1
[ $? -eq 0 ] && foundit=y || foundit=
if [ ${foundit} ] ; then
     rm -f ${makefile}.or
     mv ${makefile} ${makefile}.or
     sed -e "/${marker}/q" < ${makefile}.or > ${makefile} || {
       echo sed command failed ... bailing out
       exit 1
     }
     rm -f ${makefile}.or
 else
     echo "${marker}" >> ${makefile}; echo >> ${makefile}
 fi # [ ${foundit} ]

 ${makedepend} ${1:+"$@"} >> ${makefile}

 #
 # EOF
 ##