# (C) Copyright International Business Machines Corporation 23 January 
# 1990.  All Rights Reserved. 
#  
# See the file USERAGREEMENT distributed with this software for full 
# terms and conditions of use. 
# SCCS Info: @(#)Makefile	1.8 3/15/90

# Source files
PFILES =	getchar.p putchar.p getstring.p putstring.p putline.p \
		stdio.p stdioblocking.p

# Intermediate absprog objects
AOFILES =	getchar.ao putchar.ao getstring.ao putstring.ao putline.ao \
		stdio.ao stdioblocking.ao

# Object modules
PROCOBJS =	getchar.po putchar.po getstring.po putstring.po putline.po \
		stdio.po stdioblocking.po

include ../../make/includefile

# Load preparsed process modules, rather than parsing them directly
PCOMOPTS =	-noparse

# Suffix rules to create a pre-parsed process module object (we also
# place .ao before .p in suffix rules so .ao files are used)
.SUFFIXES:
.SUFFIXES:	.ao .p .po $(SUFFIXES)
.p.ao:	$<
	env $(HERMENV) $(HERMES) $<
.ao.po:	$<
	$*

# Only take compiled process modules from standard system library
LOADPATH =	$(PROCDIR)
# Definitions come from compiler support definitions directory and
# standard system library, but we also include the current directory
# for loading .ao files
DEFPATH =	$(HROOT)/hermes/defs:$(DEFDIR):$(HROOT)/hermes/io

all: $(AOFILES) compileprocs
install: all
	cp $(PROCOBJS) $(PROCDIR)
	
# following target makes everything but avoids trying to use the
# cache, which is not available during initial boot
boot:
	$(MAKE) all CACHE= HROOT=$(HROOT) MTYPE=$(MTYPE)

# dependencies

getchar.po:	getchar.ao
getchar.ao:	getchar.p

putchar.po:	putchar.ao
putchar.ao:	putchar.p

getstring.po:	getstring.ao
getstring.ao:	getstring.p

putstring.po:	putstring.ao
putstring.ao:	putstring.p

putline.po:	putline.ao
putline.ao:	putline.p

stdio.po:	stdio.ao
stdio.ao:	stdio.p
stdio.p:	stdio.pp
	$(CPP) $(HCPPFLAGS) -Uunix -DPROCNAME=stdio stdio.pp stdio.p

stdioblocking.po: stdioblocking.ao
stdioblocking.ao: stdioblocking.p
stdioblocking.p: stdio.pp
	$(CPP) $(HCPPFLAGS) -Uunix -DBLOCKINGIO -DPROCNAME=stdioblocking \
	stdio.pp stdioblocking.p

# directory cleanup

clean:
	rm -f *.po *.ao *.do core *~ stdio.p stdioblocking.p
