# tag: Makefile for forth bootstrap and test code
#
# Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer
#
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.
#

FORTHSRC  = start.fs bootstrap.fs interpreter.fs builtin.fs 

OFSRC     = vocabulary.fs pci.fs # fract.fs test.fs apic.fs 

DICTIONARY = openfirmware.dict

VPATH=$(BUILDDIR):$(TOPDIR)/forth

all: openfirmware.dict

bootstrap.dict: unix $(FORTHSRC)
	echo -en "\nBootstrapping dictionary..."
	cd $(BUILDDIR) && \
	./unix -I$(TOPDIR)/forth start.fs > bootstrap.log
	test -z "`grep 'not dumped' $(BUILDDIR)/bootstrap.log`" && \
		echo -e "\t\tok" || \
		echo -e "\t\tfailed"

openfirmware.fs: $(OFSRC)
	cat $^ > $(BUILDDIR)/$@
	echo -e "\n\\ leave secondary bootstrap\n\nbye\n\n" >> \
		$(BUILDDIR)/$@
	
openfirmware.dict: unix bootstrap.dict openfirmware.fs
	echo -en "Building final dictionary..."
	cd $(BUILDDIR) && \
	./unix -D openfirmware.dict bootstrap.dict \
		< $(BUILDDIR)/openfirmware.fs > openfirmware.log && \
		echo -e "\t\tok" || \
		echo -e "\t\tfailed"


