# Edit MOSMLHOME to suit your installation; it should specify the
# absolute path to the directory in which Moscow ML is installed:
MOSMLHOME=/usr/mosml


# ---------- You shouldn't need to edit below this line ------------
# -------------- But let's go ahead and do it anyway ---------------

ifeq ($(OSTYPE), "NetBSD")
MOSMLTOOLS=/usr/pkg/libexec/moscow_ml
else
MOSMLTOOLS=$(MOSMLHOME)/tools
endif

MOSMLRUN=camlrunm
#MOSMLTOOLS=/usr/pkg/libexec/moscow_ml
MOSMLCUT=$(MOSMLRUN) $(MOSMLTOOLS)/cutdeps 
MOSMLDEP=$(MOSMLRUN) $(MOSMLTOOLS)/mosmldep
MOSMLC=mosmlc -c
SHELL=/bin/sh

asdlfiles = Camelot_absyn_ASDL.sml Camelot_absyn_ASDLUtil.sml Assertions_ASDL.sml Assertions_ASDLUtil.sml
# Other files in asdl may have been hand-modified,  and should NOT be copied

uos=$(subst .sml,.uo,$(wildcard *.sml)) $(asdlfiles)
# Might be safer to write them down explicitly

.PHONY :  all depend clean

all : runasdl $(uos)

runasdl:
	cd src; $(MAKE) 

$(asdlfiles): %: src/%
	cp $< $@


%.ui :  %.sig
	$(MOSMLC) $(COMPFLAGS) $<

%.uo :  %.sml
	$(MOSMLC) $(COMPFLAGS) $<

depend:
	/bin/rm -f Makefile.bak
	mv Makefile Makefile.bak
	$(MOSMLCUT) < Makefile.bak > Makefile
	$(MOSMLDEP) >> Makefile

clean:
	/bin/rm -f Makefile.bak $(wildcard *.ui *.uo)

update:
	echo "Not yet"

StdPkl.uo: PklInteger.uo   # mosmldep doesn't spot dependencies for local structures

### DO NOT DELETE THIS LINE
Assertions_ASDLUtil.uo: Assertions_ASDL.uo SexpPkl.uo StdPkl.uo \
    StdPrimsUtil.uo 
StdTypesUtil.uo: StdTypes.uo SexpPkl.uo PklWord8.uo StdPkl.uo SexpLex.uo 
StdPrimsUtil.uo: SexpPkl.uo Identifier.uo StdPkl.uo SexpLex.uo 
StdPrims.uo: Identifier.uo 
StdPkl.uo: Share.uo 
SexpPkl.uo: StdPkl.uo SexpLex.uo 
Assertions_ASDL.uo: StdPrims.uo 
Camelot_absyn_ASDLUtil.uo: Camelot_absyn_ASDL.uo SexpPkl.uo StdPkl.uo \
    StdPrimsUtil.uo Assertions_ASDLUtil.uo 
Camelot_absyn_ASDL.uo: Assertions_ASDL.uo StdPrims.uo 
