# (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. 
# Makefile
# Author: Andy Lowry
# SCCS Info: @(#)Makefile	1.4 3/13/90

# This make file generates assembler sources (.li files) for various
# core modules needed to bootstrap the Hermes system.

# Set the default target here at the top so there's no confusion...
all:	initial
initial::

# Get standard definitions and suffix rules
include ../../make/includefile

# Where to load .po files from...
LOADPATH =	$(PROCDIR)
# Where to load .do files from
DEFPATH =	$(GENHROOT)/bin:$(HROOT)/hermes/defs:$(DEFDIR)
# Normally we're just working with a single system
GENHROOT =	$(HROOT)
# Additional cpp flags we need
EXTRACPPFLAGS =	-DCGBOOT -undef

# Suffix rules for generating .li files
.p.li:	$<
	$*

# Files needed from source directory
PPFILES =	pcom.pp root.pp getpaths.pp
SRCPFILES =	findfile.p pathload.p pathreadobj.p loadprog.p
SOURCES =	$(PPFILES) $(SRCPFILES)
# Where they come from
SRCDIR =	..
# Generated Hermes source files
GENPFILES =	root.p pcom.p
# LI source files to be built
LIFILES =	root.li pcom.li findfile.li pathload.li pathreadobj.li \
		loadprog.li

# Assemble the LI files
all:	$(SOURCES) $(GENPFILES)
	@lilist=`$(MAKE) -n lilist HROOT=$(HROOT) GENHROOT=$(GENHROOT)` ; \
		if [ "$$lilist" ] ; then \
		  echo "$(LIGENCMD) " $$lilist ; $(LIGENCMD) $$lilist ; fi
	@- rm -f *.po
lilist:	$(LIFILES)

install: all
	cp $(LIFILES) ../liboot

# Command to produce LI sources
LIGENCMD =	env $(HERMENV) $(HERMI) $(CACHE) $(PCOM) \
			-notcheck -notscheck -ligen

# Dependencies for all modules
root.li:	root.p
root.p:		root.pp getpaths.pp

pcom.li:	pcom.p
pcom.p:		pcom.pp

findfile.li:	findfile.p

pathload.li:	pathload.p

pathreadobj.li:	pathreadobj.p

# Get symbolic links to sources as needed

$(SOURCES):
	@ if [ -h $@ ] ; then rm $@ ; fi
	ln -s $(SRCDIR)/$@
	
# Clean up the directory
clean::
	@- rm -f *.li *.po $(GENPFILES)
