comparison build-scripts/makedep.sh @ 1388:9a9b87172b4b

Fixed build dependencies... ugh
author Sam Lantinga <slouken@libsdl.org>
date Mon, 20 Feb 2006 11:29:36 +0000
parents 19418e4422cb
children 7dc446173e37
comparison
equal deleted inserted replaced
1387:835c1831f903 1388:9a9b87172b4b
20 grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \ 20 grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
21 while read file 21 while read file
22 do cache=${cache_prefix}_`generate_var $file` 22 do cache=${cache_prefix}_`generate_var $file`
23 if test -f $cache; then 23 if test -f $cache; then
24 # We already ahve this cached 24 # We already ahve this cached
25 cat $cache 25 if test x$2 = x; then
26 cat $cache
27 else
28 cat $cache >>$2
29 fi
26 continue; 30 continue;
27 fi 31 fi
28 for path in $base `echo $INCLUDE | sed 's|-I||g'` 32 for path in $base `echo $INCLUDE | sed 's|-I||g'`
29 do dep="$path/$file" 33 do dep="$path/$file"
30 if test -f "$dep"; then 34 if test -f "$dep"; then
31 echo " $dep \\" >$cache 35 echo " $dep \\" >>$cache
32 echo " $dep \\" 36 if test x$2 = x; then
33 generate_dep $dep 37 echo " $dep \\"
38 else
39 echo " $dep \\" >>$2
40 fi
41 search_deps $dep $cache
34 break 42 break
35 fi 43 fi
36 done 44 done
37 done 45 done
38 } 46 }
39 47
40 generate_dep()
41 {
42 cat >>${output}.new <<__EOF__
43 $1: \\
44 `search_deps $1`
45
46 __EOF__
47 }
48
49 :>${output}.new 48 :>${output}.new
50 for src in $SOURCES 49 for src in $SOURCES
51 do echo "Generating dependencies for $src" 50 do echo "Generating dependencies for $src"
52 generate_dep $src
53 ext=`echo $src | sed 's|.*\.\(.*\)|\1|'` 51 ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
54 obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"` 52 obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"`
55 echo "$obj: $src" >>${output}.new 53 echo "$obj: $src \\" >>${output}.new
54 search_deps $src | sort | uniq >>${output}.new
55 echo "" >>${output}.new
56 case $ext in 56 case $ext in
57 asm) echo " \$(BUILDASM)" >>${output}.new;; 57 asm) echo " \$(BUILDASM)" >>${output}.new;;
58 cc) echo " \$(BUILDCC)" >>${output}.new;; 58 cc) echo " \$(BUILDCC)" >>${output}.new;;
59 c) echo " \$(BUILDC)" >>${output}.new;; 59 c) echo " \$(BUILDC)" >>${output}.new;;
60 m) echo " \$(BUILDM)" >>${output}.new;; 60 m) echo " \$(BUILDM)" >>${output}.new;;