2 # vmgenx. Variation of Gforth's vmgen
3 #Copyright (C) 2001,2002,2003 Free Software Foundation, Inc.
5 #This file is part of Gforth.
7 #Gforth is free software; you can redistribute it and/or
8 #modify it under the terms of the GNU General Public License
9 #as published by the Free Software Foundation; either version 2
10 #of the License, or (at your option) any later version.
12 #This program is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.#See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with this program; if not, write to the Free Software
19 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
22 #test "x$GFORTHDIR" != x || GFORTHDIR=${prefix}/bin
23 #test "x$GFORTHDATADIR" != x || GFORTHDATADIR=$prefix/share/gforth/0.6.2
24 #GFORTH=$GFORTHDIR/gforth-fast
26 # We must get the absolute path of the srcdir, since gforth does not
27 # seem to understand relative paths.
29 relsrcdir=`dirname $0`
30 srcdir=`/bin/sh -c "cd $relsrcdir ; pwd"`
32 PRIMS2X="$srcdir"/prims2x.fs
37 if test $# = 0 || test $1 = --help || test $1 = -h; then
38 echo "usage: `basename $0` <file>.vmg"
40 elif test $1 = --version || test $1 = -v; then
41 echo "vmgen (gforth) 0.6.2"
43 echo 'Copyright (C) 2001,2002,2003 Free Software Foundation, Inc.'
44 echo 'This program is part of Gforth'
45 $GFORTH -e "license bye"
48 true #old shells require this
51 # basename of source file
52 base=`basename $1 .vmg`
54 # absolute source file name
55 af="$srcdir"/`basename $1`
57 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
58 -e "c-flag on s\" $base-vm.i\" out-filename 2! s\" $af\" ' output-c ' output-c-combined process-file bye" > $base-vm.i &&
59 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
60 -e "c-flag on s\" $af\" ' output-disasm dup process-file bye" > $base-disasm.i &&
61 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
62 -e "c-flag on s\" $af\" ' output-gen ' noop process-file bye" > $base-gen.i &&
63 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
64 -e "c-flag on s\" $af\" ' output-label dup process-file bye" > $base-labels.i &&
65 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
66 -e "c-flag on s\" $af\" ' output-profile dup process-file bye" > $base-profile.i &&
67 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
68 -e "c-flag on s\" $af\" ' noop ' output-peephole process-file bye" > $base-peephole.i &&
69 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
70 -e "c-flag on s\" $af\" ' output-superend dup process-file bye" > $base-superend.i &&
71 $GFORTH $FFLAGS -e "create vmgen" "$PRIMS2X" \
72 -e "c-flag on s\" $af\" ' output-forthname dup process-file bye" > $base-names.i &&