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

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

all: ftrs.prc

OBJS= freemem.zo ftrs.zo

ftrs.prc: $(OBJS) ftrs.rcp $(TOP)/lib/stdlib.zo
	rm -f *.bin 
	ln -sf $(TOP)/runtime/*.camlruns.grc .
	ln -sf $(TOP)/shared/*.bin .
	pilrc ftrs.rcp
	$(CAMLLINK) $(LINKFLAGS) -exec camlcode $(OBJS)
	$(TOP)/runtime/pfix camlcode
# Do we put GC messages
#	echo "yes" > CLmm0000.bin
	build-prc $@ "Features (Caml)" FTRS *.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 $@

