source: trunk/compile_f2c/compile_f2c @ 330

Last change on this file since 330 was 330, checked in by andreasw, 14 years ago

added Id keyword

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1#!/bin/sh
2
3# Copyright (C) 2007  International Business Machines.
4# All Rights Reserved.
5# This file is distributed under the Common Public License.
6# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
7#
8## $Id: compile_f2c 330 2007-06-09 07:27:38Z andreasw $
9#
10# Author: Andreas Waechter     IBM      2007-06-09
11
12
13########################################################################
14# Replace the following to the location of your vcf2c.lib library
15# Note that there must be no space before and after "="
16
17f2clibdir=/usr/local/lib/libf2c
18
19#You should not have to change anything below this line
20########################################################################
21
22
23f2clib=`cygpath -w $f2clibdir/vcf2c.lib`
24mainobj=`cygpath -w $f2clibdir/main.obj`
25
26# Get rid of the \
27f2clib=`echo $f2clib | sed -e s'!\\\\!/!g'`
28mainobj=`echo $mainobj | sed -e s'!\\\\!/!g'`
29
30if test "$CC" = ""; then
31  CC=cl
32fi
33
34if test "$#" -eq 1 && test "$1" = "-FLIBS"; then
35  echo $f2clib
36  exit 0
37fi
38
39cincs=-I`cygpath -w $f2clibdir`
40
41options=
42incs=
43fsrc=
44objs=
45outfile=
46while test "$#" -gt 0
47do
48  arg="$1"
49  shift
50  if test "$outfile" = next; then
51    outfile="$arg"
52  else
53
54    case "$arg" in
55      -I*)
56        incs="$incs $arg"
57        ;;
58      -o)
59        if test "$outfile" != ""; then
60          echo "There are more than two -o options"
61          exit 1
62        fi
63        outfile=next
64        ;;
65      -c)
66        options="$options $arg"
67        f2clib=
68        mainobj=
69        ;;
70      -*)
71        options="$options $arg"
72        ;;
73      *.[fF])
74        fsrc="$fsrc $arg"
75        ;;
76      *)
77        objs="$objs $arg"
78        ;;
79    esac
80  fi
81done
82
83if test "$fsrc" = "" && test "$objs" = "" ; then
84  echo "No source or object files given"
85  exit 1
86fi
87
88csrc=
89if test "$fsrc" != ""; then
90  for f in $fsrc; do
91    cf=`echo $f | sed -e 's|.[fF]$|.c|'`
92    csrc="$csrc $cf"
93  done
94
95  f2c $incs $fsrc
96  f2c_status=$?
97  if test $f2c_status != 0; then
98    rm -f $csrc
99    exit $f2c_status
100  fi
101fi
102
103if test "$outfile"; then
104  cout="-o `cygpath -w $outfile`"
105fi
106
107echo $CC $options $cincs $csrc $objs $cout $mainobj $f2clib
108
109$CC $options $cincs $csrc $objs $cout $mainobj $f2clib
110cl_status=$?
111
112rm -f $csrc
113
114exit $cl_status
Note: See TracBrowser for help on using the repository browser.