| 1 |
#! /bin/sh |
| 2 |
### ########################################################################## |
| 3 |
### PUNC = < Portable Understructure for Numerical Computing > |
| 4 |
### Copyright (C) 1994-- Michael Holst |
| 5 |
### |
| 6 |
### This program is free software; you can redistribute it and/or modify it |
| 7 |
### under the terms of the GNU General Public License as published by the |
| 8 |
### Free Software Foundation; either version 2 of the License, or (at your |
| 9 |
### option) any later version. |
| 10 |
### |
| 11 |
### This program is distributed in the hope that it will be useful, |
| 12 |
### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 14 |
### See the GNU General Public License for more details. |
| 15 |
### |
| 16 |
### You should have received a copy of the GNU General Public License along |
| 17 |
### with this program; if not, write to the Free Software Foundation, Inc., |
| 18 |
### 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 |
### |
| 20 |
### rcsid="$Id: buildCsrc,v 1.6 2010/08/12 05:52:15 fetk Exp $" |
| 21 |
### ########################################################################## |
| 22 |
|
| 23 |
## ########################################################################### |
| 24 |
## File: buildCsrc |
| 25 |
## |
| 26 |
## Purpose: Generate C sources from F77 sources. |
| 27 |
## |
| 28 |
## Notes: This is two-step: |
| 29 |
## (1) Use "f2c -P source.f" to generate source.c and prototype.P |
| 30 |
## (2) Replace "#include <f2c.h>" with "#include <vf2c.h>" |
| 31 |
## |
| 32 |
## Author: Michael Holst |
| 33 |
## ########################################################################### |
| 34 |
|
| 35 |
LIBNAME="arpack" |
| 36 |
|
| 37 |
## ########################################################################### |
| 38 |
## Should not have to edit below this line... |
| 39 |
## ########################################################################### |
| 40 |
|
| 41 |
SH="sh" |
| 42 |
SED="sed" |
| 43 |
AWK="awk" |
| 44 |
LS="/bin/ls -1" |
| 45 |
MV="mv -f" |
| 46 |
RM="rm -f" |
| 47 |
CAT="cat" |
| 48 |
CP="cp" |
| 49 |
F2C="f2c" |
| 50 |
|
| 51 |
${RM} v${LIBNAME}.h |
| 52 |
|
| 53 |
SRC_DIRS="src_f77 util_f77" |
| 54 |
for src_dir in ${SRC_DIRS}; do |
| 55 |
|
| 56 |
cd ${src_dir} |
| 57 |
SOURCES=`${LS} *.f | ${SED} -e "s/\.f//g"`; |
| 58 |
cd ../ |
| 59 |
|
| 60 |
for file in ${SOURCES}; do |
| 61 |
|
| 62 |
echo "${F2C} -P ./${src_dir}/${file}.f" |
| 63 |
${F2C} -P ./${src_dir}/${file}.f |
| 64 |
|
| 65 |
echo "${CAT} ${file}.c | ${SED} -e 's/\#include \"f2c.h\"/\#include <punc\/vf2c.h>/g' > ${file}.new;" |
| 66 |
${CAT} ${file}.c | ${SED} -e 's/\#include \"f2c.h\"/\#include <punc\/vf2c.h>/g' > ${file}.new; |
| 67 |
|
| 68 |
echo "${MV} ${file}.new ${file}.c" |
| 69 |
${MV} ${file}.new ${file}.c |
| 70 |
|
| 71 |
echo "${CAT} ${file}.P >> v${LIBNAME}.h" |
| 72 |
${CAT} ${file}.P >> v${LIBNAME}.h |
| 73 |
|
| 74 |
echo "${RM} ${file}.P" |
| 75 |
${RM} ${file}.P |
| 76 |
|
| 77 |
done |
| 78 |
done |
| 79 |
|