3 # Generate dependencies from a list of source files
5 # Check to make sure our environment variables are set
6 if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$objects" = x -o x"$output" = x; then
7 echo "SOURCES, INCLUDE, objects, and output needs to be set"
14 echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
19 base=`echo $1 | sed 's|/[^/]*$||'`
20 grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
22 do cache=${cache_prefix}_`generate_var $file`
23 if test -f $cache; then
24 : # We already ahve this cached
27 for path in $base `echo $INCLUDE | sed 's|-I||g'`
29 if test -f "$dep"; then
30 echo " $dep \\" >>$cache
31 search_deps $dep >>$cache
42 do echo "Generating dependencies for $src"
43 ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
44 obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"`
45 echo "$obj: $src \\" >>${output}.new
46 search_deps $src | sort | uniq >>${output}.new
48 c) cat >>${output}.new <<__EOF__
50 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src -o \$@
54 cc) cat >>${output}.new <<__EOF__
56 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src -o \$@
60 m) cat >>${output}.new <<__EOF__
62 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src -o \$@
66 asm) cat >>${output}.new <<__EOF__
68 \$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@
72 *) echo "Unknown file extension: $ext";;
74 echo "" >>${output}.new
76 mv ${output}.new ${output}