source: releases/0.5.16/compile_f2c/compile_f2c @ 587

Last change on this file since 587 was 352, checked in by andreasw, 13 years ago

making trunk (rev 351) the new stable/0.5

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 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 352 2007-06-13 19:49:55Z 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#Find out what the
23if test `which cygpath | wc -l` -eq 0; then
24  CYGPATH_W=echo
25else
26  CYGPATH_W='cygpath -w'
27fi
28
29if test "$F2C_CC" = ""; then
30  F2C_CC=cl
31fi
32
33f2clib=`$CYGPATH_W $f2clibdir/vcf2c.lib`
34mainobj=`$CYGPATH_W $f2clibdir/main.obj`
35
36# Get rid of the \
37f2clib=`echo $f2clib | sed -e s'!\\\\!/!g'`
38mainobj=`echo $mainobj | sed -e s'!\\\\!/!g'`
39
40
41if test "$#" -eq 1 && test "$1" = "-FLIBS"; then
42  echo $f2clib
43  exit 0
44fi
45
46cincs="-I`$CYGPATH_W $f2clibdir`"
47
48options=
49incs=
50fsrc=
51objs=
52outfile=
53while test "$#" -gt 0
54do
55  arg="$1"
56  shift
57  if test "$outfile" = next; then
58    outfile="$arg"
59  else
60
61    case "$arg" in
62      -I*)
63        incs="$incs $arg"
64        ;;
65      -o)
66        if test "$outfile" != ""; then
67          echo "There are more than two -o options"
68          exit 1
69        fi
70        outfile=next
71        ;;
72      -c)
73        options="$options $arg"
74        f2clib=
75        mainobj=
76        ;;
77      -*)
78        options="$options $arg"
79        ;;
80      *.[fF])
81        fsrc="$fsrc $arg"
82        ;;
83      *)
84        objs="$objs $arg"
85        ;;
86    esac
87  fi
88done
89
90if test "$fsrc" = "" && test "$objs" = "" ; then
91  echo "No source or object files given"
92  exit 1
93fi
94
95csrc=
96if test "$fsrc" != ""; then
97  for f in $fsrc; do
98    cf=`echo $f | sed -e 's|.[fF]$|.c|' -e 's|.*/||'`
99    csrc="$csrc $cf"
100  done
101
102  echo f2c $incs $fsrc
103  f2c $incs $fsrc
104  f2c_status=$?
105  if test $f2c_status != 0; then
106    rm -f $csrc
107    exit $f2c_status
108  fi
109fi
110
111
112if test "$outfile"; then
113  cout="-o `$CYGPATH_W $outfile`"
114fi
115
116echo $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
117
118$F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
119cl_status=$?
120
121rm -f $csrc
122
123exit $cl_status
Note: See TracBrowser for help on using the repository browser.