comparison ibmscripts/ldcc @ 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 # ldcc - wrap the IBM compiler to look sort of like a unix compiler
3 # (for linking programs)
4 # usage: ldcc [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 *.dll) FILES="$FILES `echo $1 | sed 's/\.dll$/.lib/'`";;
21 *) FILES="$FILES $1";;
22 esac
23 shift
24 done
25
26 LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
27 export LIB
28
29 case x"$OUTPUT" in
30 x*.exe) ;;
31 x) echo "$0: Usage: $0 [options] files -o output" 1>&2; exit 1;;
32 *) echo "$0: output file must be an EXE" 1>&2; exti 1;;
33 esac
34
35 MAPFILE=`echo "$OUTPUT" | sed 's/\.exe$/.map/'`
36 LOGFILE=`echo "$OUTPUT" | sed 's/\.exe$/.log/'`
37
38 WINEPATH='I:\\ibmcppw\\bin'
39 export WINEPATH
40
41 # note: this must be ilink354, not the latest patchlevel, as the latest
42 # one apparently doesn't work right in wine.
43
44 # In the older makefiles, ag.exe is linked with /B"PM:PM", and agcl.exe
45 # isn't. According to documentation I just found on the web (1/1/06) this
46 # means "PMTYPE" and sets the type of application with respect to the OS/2
47 # Presentation Manager. Apparently PM means it *is* a Presentation Manager
48 # application. You can also set it to "VIO" or "NOVIO" for whether it's
49 # visually compatible (or something like that) with the Presentation Manager.
50 # I strongly suspect that under Windows this has no effect and it's a
51 # leftover from when we were using the OS/2 version of this compiler.
52 # So I'm leaving it out.
53
54 # 4/1/06 I'm putting /B"PM:PM" in, unconditionally, for now, just in case.
55
56 # /Gm is like -thread.
57 # /Q+ suppresses the copyright notice.
58
59 if [ $QUIET = 0 ]; then
60 echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
61 /Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
62 fi
63
64 (
65 wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
66 /Fm$MAPFILE /Fe$OUTPUT $FILES
67 echo "@@@Exit $?"
68 ) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
69 if [ $QUIET = 1 ]; then
70 sed '
71 /^IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3\.5$/d
72 /^- Licensed Materials - Program-Property of IBM$/d
73 /^(C) Copyright IBM Corp. 1991, 1996 - All Rights Reserved.$/d
74 /^BM(R) Linker for Windows(R), %0$/d
75 /^ersion 02.01.r2a_WTC354e *$/d
76 /^opyright (C) IBM Corporation 1988, 1998\.$/d
77 /^Copyright (C) Microsoft Corp\. 1988, 1989\.$/d
78 /^All rights reserved\.$/d
79 '
80 else
81 cat
82 fi
83 ) | awk '
84 /^@@@Exit [0-9][0-9]*$/ { exit($2); }
85
86 /^%0$/ { next; }
87 /^$/ { next; }
88 /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
89 { print; needeol=0; }
90 END { if (needeol) printf "\n"; }
91
92 ' "q=$QUIET"