#
#	This is the Makefile for some little unrealistic benchmark
#
#	NOTE : Since every source file has the name bench,
#		the file name bench.o is reused for each language.
#

#
#	WARNING: This Makefile is derived from the corresponding Metafile.
#	Don't even try to edit this file.  Instead, edit the Metafile, then
#	do a ``make Makefile''.
#
#	If you alter Metafile.defines in the top-level Modula-2 directory,
#	then you should do a ``make Makefiles'' to rederive all Makefiles
#	in all directories.


########################## Common Definitions ###############################

# Defines for conditional processing

VAX         = FALSE
MIPS        = TRUE
ARCH        = mips


# Top-level directory for installation.  Define as /tmp/ to test installation.
# Note that if you define DESTDIR, it must have a trailing /.
DESTDIR     = 
# Directory for installing libmod.a
LIBDIR      = /usr/local/lib
# Directory for installing the passes of the compiler
PASSESDIR   = /usr/local/lib/mod
# Directory for installing the .def files we provide
DEFSDIR     = /usr/local/defs
# Directory for installing the man pages for mod and p2m2
MANDIR      = /usr/man/manl
# Directory for installing the binaries mod and p2m2
BINDIR      = /usr/local/bin

# Name of Modula-2 driver program
MODBINNAME  = mod
# Name of Pascal driver program
PCBINNAME   = wrlpc
# Name of Pascal to Modula-2 converter program
P2M2BINNAME = p2m2
# Name of Modula-2 statement-level profiler
MODPROFBINNAME = modprof
# Name of Modula-2 preprocessor
PREPBINNAME = prep

# Name of directory in which Modula-2 library, compiler passes reside
TESTLIBDIR  = /pandora_a1/m2/m2-$(ARCH)/lib

# Defines for VMS
REMOTENODE = ophion::


# Defines for various utilities.  You may not have all these flags if you
# aren't running a recent release.  So set them according to your system's
# capabilities before trying to install anything.


# rm -f forces removal without asking question or reporting file not found
RM          = rm -f

# cp -p preserves modification data, etc.
CP          = cp -p

# mkdir -p creates intermediate directories as needed
MKDIR       = mkdir -p

RDIST       = rdist -c -h
LOCALHOST        = localhost:

########################## End of Definitions ###############################


REMOTEDIR = '[.m2.bench]'

PROGS = benchc benchm

all: $(PROGS)

Makefile: Metafile ../Metafile.defines
	mv Makefile Makefile.bak
	../prep/prep -Dvax=$(VAX) -Dmips=$(MIPS) <Metafile > Makefile

benchb: bench.b32
	@echo A Bliss-32 compiler is only available on VMS, not on ULTRIX.

benchc: bench.c
	cc -O -o benchc bench.c

benchm: bench.mod
	../mod/mod -B../lib -O -o benchm bench.mod

benchp: bench.p
	-pc -w -O -o benchp bench.p

benchwp: bench.p
	../mod/wrlpc -B../lib -O -o benchwp bench.p

benchv: bench.c
	-vcc -O -o benchv bench.c

benchg: bench.c
	-gcc -O -o benchg bench.c

vmscopy:
	dcp -v bench.wirth bench.c bench.mod bench.p descrip.mms \
	bench.b32 $(REMOTENODE)$(REMOTEDIR)

clean:
	-$(RM) $(PROGS) *.o
