Commit 7345f473 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add Fortran preprocessor wrappers missing from r1074.

Fixes #1505
parent a9596fdc
......@@ -245,3 +245,6 @@ tests/Makefile.am -text
tests/Makefile.in -text
tests/test_grib.c -text
tests/test_grib.sh -text
util/sunf95preproc-wrapper -text
util/sxpreproc-wrapper -text
util/xlfpreproc-wrapper -text
#! /bin/sh
if [ "${DEBUG+set}" = set ]; then
set -x
outputRedir=">&2"
else
outputRedir=">/dev/null 2>&1"
fi
while echo "$1" | grep '^-' >/dev/null 2>&1; do
FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }\"$1\""
shift
done
TRAPCMD=':'
trap 'eval $TRAPCMD' 0
set -e
test "${DEBUG+set}" = set && echo "$FPPFLAGS" >&2
FCFLAGS=${FCFLAGS--EP}
if [ "${FC+set}" != set ]; then
for F90C in sunf95 '' ; do
test -n "$F90C" || exit 1
set +e
F90BIN=`which $F90C 2>/dev/null`
set -e
test ! -x "$F90BIN" || break
done
fi
FC=${FC-$F90C}
# append -fpp if necessary
IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/
H
$x
$s/\n//g
$P'`
if echo "$FCFLAGS" \
| grep -v '\('"[$IFStr]\\|^\\)-[cf]pp\\([$IFStr]\\|\$\\)" >/dev/null
then
FCFLAGS="${FCFLAGS+$FCFLAGS }-fpp"
fi
TMPDIR="${TMPDIR-/tmp}"
{
tmp=`
(umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
` &&
test -n "$tmp" && test -d "$tmp"
} || {
tmp="$TMPDIR/foo$$-$RANDOM"
(umask 077 && mkdir "$tmp")
} || exit $?
TRAPCMD="$TRAPCMD ; rm -rf \"$tmp\""
#echo \"$FCFLAGS\"
for FortranFile in "$@" ; do
fppInput=`echo "$FortranFile" | sed 's:.*/::
s:\.[^./]*:.F90:'`
cp "$FortranFile" "$tmp/$fppInput"
fppOutput=`echo "$fppInput" | sed 's:.*/::
s:\.F90:.f90:'`
for i in fppOutput ; do
if eval test -e \$$i ; then
eval backup$i=true
eval mv \"\$$i\" \"\$$i.bak\"
eval TRAPCMD${i}Save=\"$TRAPCMD\"
TRAPCMD="$TRAPCMD ; "`eval echo mv \"\\$$i.bak\" \"\\$$i\"`
fi
done
set +e
eval \$FC \$FCFLAGS -F $FPPFLAGS \"\$tmp/\$fppInput\" $outputRedir
set -e
grep -v '^#' "$fppOutput"
test "${DEBUG+set}" = set && cat "$fppOutput" >&2
rm "$fppOutput" "$tmp/$fppInput"
for i in fppOutput ; do
if eval test \"\$backup$i\" = true ; then
eval mv \"\$$i.bak\" \"\$$i\"
TRAPCMD=`eval echo \\$TRAPCMD\${i}Save`
fi
done
done
#! /bin/sh
if [ "${DEBUG+set}" = set ]; then
set -x
outputRedir=">&2"
else
outputRedir=">/dev/null 2>&1"
fi
while echo "$1" | grep '^-' >/dev/null 2>&1; do
FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }$1"
shift
done
set -e
test "${DEBUG+set}" = set && echo "$FPPFLAGS" >&2
FCFLAGS=${FCFLAGS--EP}
if [ "${FC+set}" != set ]; then
for F90C in sxf90 f90 '' ; do
test -n "$F90C" || exit 1
set +e
F90BIN=`which $F90C 2>/dev/null`
set -e
test ! -x "$F90BIN" || break
done
fi
FC=${FC-$F90C}
IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/
H
$x
$s/\n//g
$P'`
#translate -Ep to -EP in FCFLAGS
FCFLAGS=`echo "$FCFLAGS" | sed -e 's/\('"[$IFStr]\\|^\\)-Ep\\([$IFStr]\\|\$\\)"'/\1-EP\2/'`
# append -EP if necessary
if echo "$FCFLAGS" \
| grep -v '\('"[$IFStr]\\|^\\)-EP\\([$IFStr]\\|\$\\)" >/dev/null
then
FCFLAGS="${FCFLAGS+$FCFLAGS }-EP"
fi
TMPDIR="${TMPDIR-/tmp}"
{
tmp=`
(umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
` &&
test -n "$tmp" && test -d "$tmp"
} || {
tmp=$TMPDIR/foo$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || exit $?
#echo \"$FCFLAGS\"
for FortranFile in "$@" ; do
fppOutput=`echo "$FortranFile" | sed 's:.*/::
s:^:'"$tmp/"'i.:'`
set +e
eval \$FC \$FCFLAGS -ts \"'$tmp'\" \$FPPFLAGS \"\$FortranFile\" $outputRedir
set -e
cat "$fppOutput" 2>/dev/null
test "${DEBUG+set}" = set && cat "$fppOutput" >&2
rm "$fppOutput"
done
rm -rf "$tmp"
\ No newline at end of file
#! /bin/sh
#
if [ "${DEBUG+set}" = set ]; then
set -x
outputRedir=">&2"
else
outputRedir=">/dev/null 2>&1"
fi
while echo "$1" | grep '^-' >/dev/null 2>&1; do
FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }$1"
shift
done
set -e
for srcfile in "$@" ; do
set +e
eval \$FC \$FCFLAGS \$FPPFLAGS -d -qnoobject \"\$srcfile\" $outputRedir
set -e
FPPOUTNAME=`echo $srcfile | sed -e 's:\(.*/\)*\([^/]*\)\.[^./]*$:F\2.f:'`
cat "$FPPOUTNAME" 2>/dev/null
test "${DEBUG+set}" = set && cat "$FPPOUTNAME" >&2
rm "$FPPOUTNAME"
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment