TOP=../..
CAMLC=camlc
COMPFLAGS=-stdlib $(TOP)/lib -W

CAMLLINK=$(TOP)/linker/camllink
LINKFLAGS=-stdlib $(TOP)/lib stdlib.zo
CPP=/lib/cpp -P

all: asl.prc

OBJS= minio.zo asl.zo token.zo parser.zo semant.zo typing.zo main.zo \
      freemem.zo edit.zo run.zo 
#OBJS=minio.zo echo.zo

asl.prc: $(OBJS) asl.rcp $(TOP)/lib/stdlib.zo
	rm -f *.bin 
	ln -sf $(TOP)/runtime/*.camlruns.grc .
	ln -sf $(TOP)/shared/*.bin .
	pilrc asl.rcp
	$(CAMLLINK) $(LINKFLAGS) -exec camlcode $(OBJS)
	$(TOP)/runtime/pfix camlcode
# Do we put GC messages
	echo "yes" > CLmm0000.bin
	build-prc $@ "ASL (Caml)" ASLI *.grc *.bin

clean:
	rm -f *.z* run.ml edit.ml
	rm -f *.bin *.grc
	rm -f camlcode asl.prc


.SUFFIXES: .mli .zi .ml .zo .mlp

.mli.zi:
	$(CAMLC) $(COMPFLAGS) -c $<

.ml.zo:
	$(CAMLC) $(COMPFLAGS) -c $<

.mlp.ml:
	@rm -f $@
	$(CPP) $< > $@
	@chmod a-w $@

# Generated dependencies below

parser.zi: token.zi 
asl.zo: asl.zi 
main.zo: main.zi token.zi typing.zo parser.zi semant.zo asl.zi 
parser.zo: parser.zi token.zi asl.zi 
run.zo: main.zi 
semant.zo: parser.zi 
token.zo: token.zi 
typing.zo: parser.zi 
