Debian Codegraph @

debian/external_deps/fetk/punc/src/pmg/buildCsrc

raw
1 #! /bin/sh
2 ### ##########################################################################
3 ### PUNC = < Portable Understructure for Numerical Computing >
4 ### Copyright (C) 1994-- Michael Holst
5 ###
6 ### This library is free software; you can redistribute it and/or
7 ### modify it under the terms of the GNU Lesser General Public
8 ### License as published by the Free Software Foundation; either
9 ### version 2.1 of the License, or (at your option) any later version.
10 ###
11 ### This library 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. See the GNU
14 ### Lesser General Public License for more details.
15 ###
16 ### You should have received a copy of the GNU Lesser General Public
17 ### License along with this library; if not, write to the Free Software
18 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ###
20 ### rcsid="$Id: buildCsrc,v 1.4 2010/08/12 05:45:19 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="pmg"
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