comparison ibmscripts/shldcc @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children a4899cdfc2d6
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 #!/bin/sh
2 # shldcc - wrap the IBM compiler to look sort of like a unix compiler
3 # (for linking shared libraries)
4 # usage: shldcc [opts] objectfiles -o output
5 # options:
6 # -v verbose
7 #
8
9 QUIET=1
10
11 while [ x"$1" != x ]; do
12 case "$1" in
13 -o) OUTPUT="$2"; shift;;
14 -o*) OUTPUT=`echo "$1" | sed 's/^-o//'`;;
15 -v) QUIET=0;;
16 -*)
17 echo "$0: unknown option $1" 1>&2
18 exit 1
19 ;;
20 *) FILES="$FILES $1";;
21 esac
22 shift
23 done
24
25 LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
26 export LIB
27
28 case x"$OUTPUT" in
29 x*.dll) ;;
30 x) echo "$0: Usage: $0 [options] files -o output" 1>&2; exit 1;;
31 *) echo "$0: output file must be a DLL" 1>&2; exti 1;;
32 esac
33
34 MAPFILE=`echo "$OUTPUT" | sed 's/\.dll$/.map/'`
35 LOGFILE=`echo "$OUTPUT" | sed 's/\.dll$/.log/'`
36
37 WINEPATH='I:\\ibmcppw\\bin'
38 export WINEPATH
39
40 # note: you must have ilink354 as ilink.exe, not the latest
41 # patchlevel, as the latest one apparently doesn't work right in wine.
42
43
44 # /Q+ suppresses the copyright notice
45
46 echo '/B"/dll /optf /noe"' > .tmp
47
48 if [ $QUIET = 0 ]; then
49 echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
50 /Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
51 fi
52
53 (
54 wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
55 /Fm$MAPFILE /Fe$OUTPUT $FILES
56 echo "@@@Exit $?"
57 ) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
58 if [ $QUIET = 1 ]; then
59 sed '
60 /^IBM Librarian for Windows (TM) Version 0.00.04 cc_WTC357f $/d
61 /^(C) Copyright IBM Corporation, 1991, 1996\.$/d
62 /^(C) Copyright Microsoft Corp\., 1988, 1989\.$/d
63 /^Licensed Materials - Property of IBM - All Rights Reserved\.$/d
64
65 /^IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3\.5$/d
66 /^- Licensed Materials - Program-Property of IBM$/d
67 /^(C) Copyright IBM Corp. 1991, 1996 - All Rights Reserved.$/d
68
69 /^BM(R) Linker for Windows(R), %0$/d
70 /^ersion 02.01.r2a_WTC354e *$/d
71 /^opyright (C) IBM Corporation 1988, 1998\.$/d
72 /^Copyright (C) Microsoft Corp\. 1988, 1989\.$/d
73 /^All rights reserved\.$/d
74 '
75 else
76 cat
77 fi
78 ) | awk '
79 /^@@@Exit [0-9][0-9]*$/ { exit($2); }
80
81 /^%0$/ { next; }
82 /^$/ { next; }
83 /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
84 { print; needeol=0; }
85 END { if (needeol) printf "\n"; }
86
87 ' "q=$QUIET"
88
89