Correct rules for making the win32-related files that are made from
[platform/upstream/glib.git] / build-dll
1 #!/bin/sh
2
3 # Temporary hack until building dlls or executables with exported
4 # entry points is easier with gcc -mno-cygwin.
5
6 #LD=ld
7 GCC=gcc
8 DLLTOOL=dlltool
9 AS=as
10
11 library=$1; shift
12 version=$1; shift;
13 def=$1; shift
14 ldargs="$*"
15
16 defswitch=""
17 [ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
18
19 libname=$library
20 [ $version != '-' ] && libname=$library-$version
21 dllfile=$libname.dll
22
23 for F in $ldargs; do
24     case $F in
25         *.o)    objs="$objs $F";;
26     esac
27 done
28
29 $GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs
30 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
31 $GCC -s -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs
32 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
33 $GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs
34 $DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
35
36 rm $library.base $library.exp 2>/dev/null