#! /bin/sh ### ########################################################################## ### PUNC = < Portable Understructure for Numerical Computing > ### Copyright (C) 1994-- Michael Holst ### ### This library is free software; you can redistribute it and/or ### modify it under the terms of the GNU Lesser General Public ### License as published by the Free Software Foundation; either ### version 2.1 of the License, or (at your option) any later version. ### ### This library is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ### Lesser General Public License for more details. ### ### You should have received a copy of the GNU Lesser General Public ### License along with this library; if not, write to the Free Software ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ### ### rcsid="$Id: buildCsrc,v 1.8 2010/08/12 05:52:20 fetk Exp $" ### ########################################################################## ## ########################################################################### ## File: buildCsrc ## ## Purpose: Generate C sources from F77 sources. ## ## Notes: This is two-step: ## (1) Use "f2c -P source.f" to generate source.c and prototype.P ## (2) Replace "#include " with "#include " ## ## Author: Michael Holst ## ########################################################################### LIBNAME="blas" ## ########################################################################### ## Should not have to edit below this line... ## ########################################################################### SH="sh" SED="sed" AWK="awk" LS="/bin/ls -1" MV="mv -f" RM="rm -f" CAT="cat" CP="cp" F2C="f2c" ${RM} v${LIBNAME}.h SRC_DIRS="src_f77 util_f77" for src_dir in ${SRC_DIRS}; do cd ${src_dir} SOURCES=`${LS} *.f | ${SED} -e "s/\.f//g"`; cd ../ for file in ${SOURCES}; do echo "${F2C} -P ./${src_dir}/${file}.f" ${F2C} -P ./${src_dir}/${file}.f echo "${CAT} ${file}.c | ${SED} -e 's/\#include \"f2c.h\"/\#include /g' > ${file}.new;" ${CAT} ${file}.c | ${SED} -e 's/\#include \"f2c.h\"/\#include /g' > ${file}.new; echo "${MV} ${file}.new ${file}.c" ${MV} ${file}.new ${file}.c echo "${CAT} ${file}.P >> v${LIBNAME}.h" ${CAT} ${file}.P >> v${LIBNAME}.h echo "${RM} ${file}.P" ${RM} ${file}.P done done