summaryrefslogtreecommitdiffstats
path: root/usr.bin/f2c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-09-30 06:25:06 +0000
committerpst <pst@FreeBSD.org>1994-09-30 06:25:06 +0000
commit73f0e01abae3e00510867e1be557ca8b72c43a9b (patch)
treefe7477ca65b9ea0a0b27991a79077222a184d81d /usr.bin/f2c
parent0ffafd8bfec2ec85fc5d5a8b5daee983ab77490a (diff)
downloadFreeBSD-src-73f0e01abae3e00510867e1be557ca8b72c43a9b.zip
FreeBSD-src-73f0e01abae3e00510867e1be557ca8b72c43a9b.tar.gz
Add f77 shell script frontend for f2c/gcc
Diffstat (limited to 'usr.bin/f2c')
-rw-r--r--usr.bin/f2c/Makefile4
-rw-r--r--usr.bin/f2c/f77.script114
2 files changed, 118 insertions, 0 deletions
diff --git a/usr.bin/f2c/Makefile b/usr.bin/f2c/Makefile
index eea5cf4..7fd85a7 100644
--- a/usr.bin/f2c/Makefile
+++ b/usr.bin/f2c/Makefile
@@ -29,4 +29,8 @@ tokdefs.h: ${.CURDIR}/tokens
CLEANFILES+=\
gram.c tokdefs.h y.tab.h
+afterinstall:
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ ${INSTALLFLAGS} f77.script ${DESTDIR}${BINDIR}/f77
+
.include <bsd.prog.mk>
diff --git a/usr.bin/f2c/f77.script b/usr.bin/f2c/f77.script
new file mode 100644
index 0000000..d98bd75
--- /dev/null
+++ b/usr.bin/f2c/f77.script
@@ -0,0 +1,114 @@
+#!/bin/sh
+# Compile Fortran code, adding -lf2c.
+# This is a slightly modified g++ script.
+
+: || exec /bin/sh -f $0 $argv:q
+
+# The compiler name might be different when doing cross-compilation
+# (this should be configured)
+gcc_name=cc
+speclang=-xnone
+
+# replace the command name by the name of the new command
+progname=`basename $0`
+case "$0" in
+ */*)
+ gcc=`echo $0 | sed -e "s;/[^/]*$;;"`/$gcc_name
+ ;;
+ *)
+ gcc=$gcc_name
+ ;;
+esac
+
+# $first is yes for first arg, no afterwards.
+first=yes
+# If next arg is the argument of an option, $quote is non-empty.
+# More precisely, it is the option that wants an argument.
+quote=
+# $library is made empty to disable use of libf2c.
+#library=-lF77 -lI77 -lm
+library="-lf2c -lm"
+numargs=$#
+
+# ash requires the newline before `do'.
+for arg
+do
+ if [ $first = yes ]
+ then
+ # Need some 1st arg to `set' which does not begin with `-'.
+ # We get rid of it after the loop ends.
+ set gcc
+ first=no
+ fi
+ # If you have to ask what this does, you should not edit this file. :-)
+ # The ``S'' at the start is so that echo -nostdinc does not eat the
+ # -nostdinc.
+ arg=`echo "S$arg" | sed "s/^S//; s/'/'\\\\\\\\''/g"`
+ if [ x$quote != x ]
+ then
+ quote=
+ else
+ quote=
+ case $arg in
+ -nostdlib)
+ # Inhibit linking with -lf2c.
+ library=
+ ;;
+ -lm | -lmath)
+ # Because libf2c uses things from the math library, make sure it
+ # always comes before the math library. We recognize both -lm
+ # and -lmath, since on some systems (e.g. m88k SVR3), it
+ # doesn't call it libm.a for some reason.
+ #set "$@" $library
+ #library=""
+ ;;
+ -[bBVDUoeTuIYmLiA] | -Tdata)
+ # these switches take following word as argument,
+ # so don't treat it as a file name.
+ quote=$arg
+ ;;
+ -[cSEM] | -MM)
+ # Don't specify libraries if we won't link,
+ # since that would cause a warning.
+ library=
+ ;;
+ -x*)
+ speclang=$arg
+ ;;
+ -v)
+ # catch `f77 -v'
+ if [ $numargs = 1 ] ; then library="" ; fi
+ ;;
+ -*)
+ # Pass other options through; they don't need -x and aren't inputs.
+ ;;
+ *)
+ # If file ends in .i, put options around it.
+ # But not if a specified -x option is currently active.
+ case "$speclang $arg" in -xnone\ *.i)
+ set "$@" -xf2c "'$arg'" -xnone
+ continue
+ esac
+ ;;
+ esac
+ fi
+ set "$@" "'$arg'"
+done
+
+# Get rid of that initial 1st arg
+if [ $first = no ]; then
+ shift
+else
+ echo "$0: No input files specified."
+ exit 1
+fi
+
+if [ x$quote != x ]
+then
+ echo "$0: argument to \`$quote' missing"
+ exit 1
+fi
+
+eval $gcc "$@" $library
+
+
OpenPOWER on IntegriCloud