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

CAMLLINK=$(TOP)/linker/camllink
# LINKFLAGS=-stdlib $(TOP)/lib exc.zo fvect.zo vect.zo int.zo random.zo fstring.zo string.zo eq.zo hashtbl.zo  palm.zo events.zo
LINKFLAGS=-stdlib $(TOP)/lib stdlib.zo
CPP=/lib/cpp -P

all: same.prc

OBJS= freemem.zo same.zo

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

