#     Makefile for the occam compiler T8 routines for the C library
#
#
# This file assumes that it is being run within the directory of the sources
# and output files.
#
# The macro OUTNAME must be supplied from the command line.
#
#                         4-Dec-90 SRH
#
#                This file is set up for UNIX.


SWITCH=-

# this name must be supplied from the command line
OUTNAME=

# for the flexibility to pass something in from the command line.
OCCEXTRAS=

PREPROCESSOR=preocc
PREOPT=$(SWITCH)d C $(SWITCH)d T8 $(SWITCH)d UNISTOP
LIBRARIAN=ilibr
LIBOPT=
OCCAM=oc
OCCOPT=$(SWITCH)d $(SWITCH)v $(SWITCH)x $(SWITCH)u $(SWITCH)t8 $(SWITCH)zlcp %c $(SWITCH)zlcs % $(OCCEXTRAS)

INTO=>
COPY=cp
DELETE=rm
CONCATENATE=cat


# Pattern matching rules.
#
# $< is a dynamic macro meaning the name of the dependency file;
# $* is a dynamic macro meaning the base name of the current target
%.t8x: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)o $*.p8x
	$(OCCAM) $*.p8x $(OCCOPT) $(SWITCH)o $*.t8x
	$(DELETE) $*.p8x

REALT8X=	r32op.t8x    \
		r64op.t8x    \
		ie32comp.t8x rscaleb.t8x  rfunpack.t8x \
		ie64comp.t8x dscaleb.t8x  dfunpack.t8x dargred.t8x

#--------------------------------- Main rule ----------------------------------

# force build of OUTNAME
all:	 $(OUTNAME)

$(OUTNAME):	$(REALT8X)
	$(CONCATENATE) $(REALT8X)  $(INTO)  $(OUTNAME)
	$(COPY) $(OUTNAME) occam8.lib
