build-scripts/makedep.sh
changeset 1416 a4c05c115bb7
parent 1391 7dc446173e37
child 1417 24fbbedd2ad6
equal deleted inserted replaced
1415:a30f8553eeb1 1416:a4c05c115bb7
     1 #!/bin/sh
     1 #!/bin/sh
     2 #
     2 #
     3 # Generate dependencies from a list of source files
     3 # Generate dependencies from a list of source files
     4 
       
     5 BUILDC="\\\$\\(LIBTOOL\\) --mode=compile \\\$\\(CC\\) \\\$\\(CFLAGS\\) -c \$src  -o \\\$@"
       
     6 BUILDCC=$BUILDC
       
     7 BUILDM=$BUILDC
       
     8 BUILDASM="\\\$\\(LIBTOOL\\) --tag=CC --mode=compile \\\$\\(auxdir\\)/strip_fPIC.sh \\\$\\(NASM\\) \$src -o \\\$@"
       
     9 
     4 
    10 # Check to make sure our environment variables are set
     5 # Check to make sure our environment variables are set
    11 if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$objects" = x -o x"$output" = x; then
     6 if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$objects" = x -o x"$output" = x; then
    12     echo "SOURCES, INCLUDE, objects, and output needs to be set"
     7     echo "SOURCES, INCLUDE, objects, and output needs to be set"
    13     exit 1
     8     exit 1
    47 do  echo "Generating dependencies for $src"
    42 do  echo "Generating dependencies for $src"
    48     ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
    43     ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
    49     obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"`
    44     obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|$objects/\1.lo|g"`
    50     echo "$obj: $src \\" >>${output}.new
    45     echo "$obj: $src \\" >>${output}.new
    51     search_deps $src | sort | uniq >>${output}.new
    46     search_deps $src | sort | uniq >>${output}.new
    52     echo "" >>${output}.new
       
    53     case $ext in
    47     case $ext in
    54         c)   eval echo \\"	$BUILDC\\" >>${output}.new;;
    48         c) cat >>${output}.new <<__EOF__
    55         cc)  eval echo \\"	$BUILDCC\\" >>${output}.new;;
    49 
    56         m)   eval echo \\"	$BUILDM\\" >>${output}.new;;
    50 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src  -o \$@
    57         asm) eval echo \\"	$BUILDASM\\" >>${output}.new;;
    51 
       
    52 __EOF__
       
    53         ;;
       
    54         cc) cat >>${output}.new <<__EOF__
       
    55 
       
    56 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src  -o \$@
       
    57 
       
    58 __EOF__
       
    59         ;;
       
    60         m) cat >>${output}.new <<__EOF__
       
    61 
       
    62 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) -c $src  -o \$@
       
    63 
       
    64 __EOF__
       
    65         ;;
       
    66         asm) cat >>${output}.new <<__EOF__
       
    67 
       
    68 	\$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@"
       
    69 
       
    70 __EOF__
       
    71         ;;
    58         *)   echo "Unknown file extension: $ext";;
    72         *)   echo "Unknown file extension: $ext";;
    59     esac
    73     esac
    60     echo "" >>${output}.new
    74     echo "" >>${output}.new
    61 done
    75 done
    62 mv ${output}.new ${output}
    76 mv ${output}.new ${output}