diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ibmscripts/ldcc	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,92 @@
+#!/bin/sh
+# ldcc - wrap the IBM compiler to look sort of like a unix compiler
+# (for linking programs)
+# usage: ldcc [opts] objectfiles -o output
+# options:
+#     -v	verbose
+#
+
+QUIET=1
+
+while [ x"$1" != x ]; do
+    case "$1" in
+	-o) OUTPUT="$2"; shift;;
+	-o*) OUTPUT=`echo "$1" | sed 's/^-o//'`;;
+	-v) QUIET=0;;
+	-*)
+	    echo "$0: unknown option $1" 1>&2
+	    exit 1
+	;;
+	*.dll) FILES="$FILES `echo $1 | sed 's/\.dll$/.lib/'`";;
+	*) FILES="$FILES $1";;
+    esac
+shift
+done
+
+LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
+export LIB
+
+case x"$OUTPUT" in
+    x*.exe) ;;
+    x) echo "$0: Usage: $0 [options] files -o output" 1>&2; exit 1;;
+    *) echo "$0: output file must be an EXE" 1>&2; exti 1;;
+esac
+
+MAPFILE=`echo "$OUTPUT" | sed 's/\.exe$/.map/'`
+LOGFILE=`echo "$OUTPUT" | sed 's/\.exe$/.log/'`
+
+WINEPATH='I:\\ibmcppw\\bin'
+export WINEPATH
+
+# note: this must be ilink354, not the latest patchlevel, as the latest
+# one apparently doesn't work right in wine.
+
+# In the older makefiles, ag.exe is linked with /B"PM:PM", and agcl.exe
+# isn't. According to documentation I just found on the web (1/1/06) this
+# means "PMTYPE" and sets the type of application with respect to the OS/2
+# Presentation Manager. Apparently PM means it *is* a Presentation Manager
+# application. You can also set it to "VIO" or "NOVIO" for whether it's
+# visually compatible (or something like that) with the Presentation Manager.
+# I strongly suspect that under Windows this has no effect and it's a 
+# leftover from when we were using the OS/2 version of this compiler.
+# So I'm leaving it out.
+
+# 4/1/06 I'm putting /B"PM:PM" in, unconditionally, for now, just in case.
+
+# /Gm is like -thread.
+# /Q+ suppresses the copyright notice.
+
+if [ $QUIET = 0 ]; then
+    echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
+	/Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
+fi
+
+(
+    wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
+	/Fm$MAPFILE /Fe$OUTPUT $FILES
+    echo "@@@Exit $?"
+) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
+    if [ $QUIET = 1 ]; then
+      sed '
+	/^IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3\.5$/d
+	/^- Licensed Materials - Program-Property of IBM$/d
+	/^(C) Copyright IBM Corp. 1991, 1996 - All Rights Reserved.$/d
+	/^BM(R) Linker for Windows(R), %0$/d
+	/^ersion 02.01.r2a_WTC354e *$/d
+	/^opyright (C) IBM Corporation 1988, 1998\.$/d
+	/^Copyright (C) Microsoft Corp\. 1988, 1989\.$/d
+	/^All rights reserved\.$/d
+      '
+    else
+      cat
+    fi
+) | awk '
+    /^@@@Exit [0-9][0-9]*$/ { exit($2); }
+
+    /^%0$/ { next; }
+    /^$/ { next; }
+    /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
+    { print; needeol=0; }
+    END { if (needeol) printf "\n"; }
+
+' "q=$QUIET"