##############################################################################
#
#                           occam8.lib makefile
#
#                      occam2 toolset; 16-Nov-90 SRH
#
#                    This makefile is set up for UNIX.
#
##############################################################################


# UNIX specific macros
SWITCH=-
DELETE=rm
RENAME=mv


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

# tools and global options
PREPROCESSOR=preocc
PREOPT=$(SWITCH)d OCCAM $(SWITCH)d T8
LIBRARIAN=ilibr
LIBOPT=
OCCAM=oc
OCCOPT=$(SWITCH)d $(SWITCH)v $(SWITCH)t8 $(OCCEXTRAS)




#T8 integer files
INTT8H= 	i16add.t8h   i16plus.t8h  i16sub.t8h   i16minus.t8h \
		i16mul.t8h   i16times.t8h i16div.t8h   i16rem.t8h   \
		i16eq.t8h    i16gt.t8h    i16lshft.t8h i16rshft.t8h \
		i16band.t8h  i16bor.t8h   i16xor.t8h   i16bnot.t8h  \
		i64mul.t8h   i64divrm.t8h

INTT8X= 	i16add.t8x   i16plus.t8x  i16sub.t8x   i16minus.t8x \
		i16mul.t8x   i16times.t8x i16div.t8x   i16rem.t8x   \
		i16eq.t8x    i16gt.t8x    i16lshft.t8x i16rshft.t8x \
		i16band.t8x  i16bor.t8x   i16xor.t8x   i16bnot.t8x  \
		i64mul.t8x   i64divrm.t8x

#T8 REAL functions
REALT8H=	r32op.t8h    ie32op.t8h   r32rem.t8h                \
		ie32rem.t8h  r32eq.t8h    r32gt.t8h                 \
		r64op.t8h    ie64op.t8h   r64rem.t8h                \
		ie64rem.t8h  r64eq.t8h    r64gt.t8h                 \
		rscaleb.t8h  rfunpack.t8h rargred.t8h  ie32comp.t8h \
		rlogb.t8h    rcpysign.t8h rnxtaftr.t8h              \
		dscaleb.t8h  dfunpack.t8h dargred.t8h  ie64comp.t8h \
		dlogb.t8h    dcpysign.t8h dnxtaftr.t8h              \
		unpacksn.t8h roundsn.t8h

REALT8X=	r32op.t8x    ie32op.t8x   r32rem.t8x                \
		ie32rem.t8x  r32eq.t8x    r32gt.t8x                 \
		r64op.t8x    ie64op.t8x   r64rem.t8x                \
		ie64rem.t8x  r64eq.t8x    r64gt.t8x                 \
		rscaleb.t8x  rfunpack.t8x rargred.t8x  ie32comp.t8x \
		rlogb.t8x    rcpysign.t8x rnxtaftr.t8x              \
		dscaleb.t8x  dfunpack.t8x dargred.t8x  ie64comp.t8x \
		dlogb.t8x    dcpysign.t8x dnxtaftr.t8x              \
		unpacksn.t8x roundsn.t8x


#----------------------------------------------------------------------------

# Force the whole library to be made
all: occam8.lib

occam8.lib: occam8.lbb $(INTT8H) $(REALT8H) $(INTT8X) $(REALT8X)
	$(LIBRARIAN) $(LIBOPT) $(SWITCH)f occam8.lbb $(SWITCH)o occam8.lib

# pattern matching rules for those files without dependencies
# $< is a dynamic macro meaning the name of the dependency file;
# $* is a dynamic macro meaning the base name of the current target
%.t8h: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)d HALT $(SWITCH)o $*.p8h
	$(OCCAM) $*.p8h $(SWITCH)h $(OCCOPT) $(SWITCH)o $*.t8h
	$(DELETE) $*.p8h

%.t8x: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)d UNISTOP $(SWITCH)o $*.p8x
	$(OCCAM) $*.p8x $(SWITCH)x $(OCCOPT) $(SWITCH)o $*.t8x
	$(DELETE) $*.p8x
