3 # Temporary hack until building dlls is easier with gcc -mno-cygwin
6 # This is usable with cygwin b20.1 and gcc-2.95.2 as distributed by
7 # Mumit Khan. For other combinations, no idea.
19 [ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
22 [ $version != '-' ] && libname=$library-$version
27 *.[ao]) objs="$objs $F";;
31 # Check if we have a resource file for this DLL.
33 if [ -f $library.rc ]; then
34 # Kludge to get the path to the win32 headers. Should work for both
35 # gcc running on cygwin, and bare mingw gcc, even if the make is
36 # running on cygwin (whew).
37 WIN32APIHEADERS=`echo "\#include <winver.h>" | $GCC -M -E - | tail -1 | sed -e 's![\\/]winver.h!!' | tr -d '\015'`
39 resfile=$library-win32res.o
42 # Check if we have a build number stamp file.
43 if [ -f $library-build.stamp ]; then
44 read number <$library-build.stamp
45 buildnumber=$[number+1]
46 echo Build number is $buildnumber
47 echo $buildnumber >$library-build.stamp
49 echo Using zero as build number
53 m4 -DBUILDNUMBER=$buildnumber <$library.rc >$library-win32res.rc
54 windres --include-dir $WIN32APIHEADERS $library-win32res.rc $library-win32res.o
55 rm $library-win32res.rc
60 $GCC -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
61 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
62 $GCC -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
63 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
64 $GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
65 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
67 # Finally, also build import libraries for the Microsoft linker. You
68 # will either need to have some decent version of MSVC, or get lib.exe
69 # (and link.exe) from the (freely downloadable) Microsoft Platform SDK.
71 if type -p lib.exe && [ -n "$def" -a "$def" != '-' ]; then
72 lib -name:$libname.dll -def:$def -out:$libname.lib
75 rm $library.base $library.exp 2>/dev/null