summaryrefslogtreecommitdiff
path: root/ipl/cfuncs/mklib.sh
blob: 4caeca4fcea961810cad718e7e4751fd7b87eaa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
#  mklib libname.so obj.o ...

CC=${CC-cc}
BIN=${BIN-../../bin}

LIBNAME=${1?"usage: $0 libname obj..."}
shift

SYS=`uname -s`
set -x
case "$SYS" in
   Linux*|*BSD*|GNU*)
      $CC -shared -o $LIBNAME -fPIC "$@";;
   CYGWIN*)
      # move the win32 import library for iconx.exe callbacks
      # created when iconx.exe was built
      if [ -e $BIN/../src/runtime/iconx.a ]; then
         mv $BIN/../src/runtime/iconx.a $BIN
      fi
      $CC -shared -Wl,--enable-auto-import -o $LIBNAME "$@" $BIN/iconx.a;;
   Darwin*)
      $CC -bundle -undefined suppress -flat_namespace -o $LIBNAME "$@";;
   SunOS*)
      $CC $CFLAGS -G -o $LIBNAME "$@" -lc -lsocket;;
   HP-UX*)
      ld -b -o $LIBNAME "$@";;
   IRIX*)
      ld -shared -o $LIBNAME "$@";;
   OSF*)
      ld -shared -expect_unresolved '*' -o $LIBNAME "$@" -lc;;
   AIX*)
      # this may not be quite right; it doesn't seem to work yet...
      ld -bM:SRE -berok -bexpall -bnoentry -bnox -bnogc -brtl -o $LIBNAME "$@";;
   *)
      set -
      echo 1>&2 "don't know how to make libraries under $SYS"
      exit 1;;
esac