SDL-mirror/build-scripts/makedep.sh

94 lines
2.3 KiB
Bash
Raw Normal View History

#!/bin/sh
#
# Generate dependencies from a list of source files
# Check to make sure our environment variables are set
if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$output" = x; then
echo "SOURCES, INCLUDE, and output needs to be set"
exit 1
fi
cache_prefix=".#$$"
generate_var()
{
echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
}
search_deps()
{
base=`echo $1 | sed 's|/[^/]*$||'`
grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
while read file
do cache=${cache_prefix}_`generate_var $file`
if test -f $cache; then
: # We already ahve this cached
else
: >$cache
for path in $base `echo $INCLUDE | sed 's|-I||g'`
do dep="$path/$file"
if test -f "$dep"; then
echo " $dep \\" >>$cache
search_deps $dep >>$cache
break
fi
done
fi
cat $cache
done
}
:>${output}.new
for src in $SOURCES
do echo "Generating dependencies for $src"
ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
Fixed bug 938 - SDL fails to link in mingw+msys+libtool Carlo Bramini 2010-01-27 10:06:17 PST When building third party software powered by libtool (like xine-lib and several others) under Mingw+MSys, libSDL fails to link. I got this message when building SDL video out component of xine-lib: *** Warning: linker path does not have real file for library -lmingw32. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libmingw32 and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libmingw32.a Apparently there is no need to manually add -lmingw32 for making libSDL working. If this flag is removed, everything is built without troubles. If it has been added for fixing a cross-compiler, perhaps if would be a better idea to adjust its SPECS file in the same manner it has been done in the true one used by mingw on Windows (I'm just guessing why it exists here). There is also another message received on the console: *** Warning: linker path does not have real file for library -lSDLmain. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libSDLmain and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libSDLmain.a This message, like previous one, is caused by -no-undefined flag sent to libtool when building shared libraries. Actually adding an .la file with its dependencies solves the troubles, so I believe it would be better to create it too in the build process of libSDL. --HG-- branch : SDL-1.2
2011-12-30 14:14:45 -05:00
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
echo "\$(objects)/$obj: $src \\" >>${output}.new
Fixed bug 938 - SDL fails to link in mingw+msys+libtool Carlo Bramini 2010-01-27 10:06:17 PST When building third party software powered by libtool (like xine-lib and several others) under Mingw+MSys, libSDL fails to link. I got this message when building SDL video out component of xine-lib: *** Warning: linker path does not have real file for library -lmingw32. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libmingw32 and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libmingw32.a Apparently there is no need to manually add -lmingw32 for making libSDL working. If this flag is removed, everything is built without troubles. If it has been added for fixing a cross-compiler, perhaps if would be a better idea to adjust its SPECS file in the same manner it has been done in the true one used by mingw on Windows (I'm just guessing why it exists here). There is also another message received on the console: *** Warning: linker path does not have real file for library -lSDLmain. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libSDLmain and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libSDLmain.a This message, like previous one, is caused by -no-undefined flag sent to libtool when building shared libraries. Actually adding an .la file with its dependencies solves the troubles, so I believe it would be better to create it too in the build process of libSDL. --HG-- branch : SDL-1.2
2011-12-30 14:14:45 -05:00
# No search to be done with Windows resource files
if test x"$ext" != x"rc"; then
search_deps $src | sort | uniq >>${output}.new
fi
case $ext in
c) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
cc) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
m) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
asm) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) -I\$(srcdir)/src/hermes/ $src -o \$@
__EOF__
;;
S) cat >>${output}.new <<__EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
rc) cat >>${output}.new <<__EOF__
Fixed bug 938 - SDL fails to link in mingw+msys+libtool Carlo Bramini 2010-01-27 10:06:17 PST When building third party software powered by libtool (like xine-lib and several others) under Mingw+MSys, libSDL fails to link. I got this message when building SDL video out component of xine-lib: *** Warning: linker path does not have real file for library -lmingw32. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libmingw32 and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libmingw32.a Apparently there is no need to manually add -lmingw32 for making libSDL working. If this flag is removed, everything is built without troubles. If it has been added for fixing a cross-compiler, perhaps if would be a better idea to adjust its SPECS file in the same manner it has been done in the true one used by mingw on Windows (I'm just guessing why it exists here). There is also another message received on the console: *** Warning: linker path does not have real file for library -lSDLmain. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libSDLmain and none of the candidates passed a file format test *** using a file magic. Last file checked: /mingw/lib/libSDLmain.a This message, like previous one, is caused by -no-undefined flag sent to libtool when building shared libraries. Actually adding an .la file with its dependencies solves the troubles, so I believe it would be better to create it too in the build process of libSDL. --HG-- branch : SDL-1.2
2011-12-30 14:14:45 -05:00
\$(LIBTOOL) --tag=RC --mode=compile \$(WINDRES) $src -o \$@
__EOF__
;;
*) echo "Unknown file extension: $ext";;
esac
echo "" >>${output}.new
done
mv ${output}.new ${output}
rm -f ${cache_prefix}*