#*********************************************************************#
#                                                                     #
#                           Objective Caml                            #
#                                                                     #
#            Pierre Weis, projet Cristal, INRIA Rocquencourt          #
#                                                                     #
#  Copyright 2000 Institut National de Recherche en Informatique et   #
#  en Automatique.  All rights reserved.  This file is distributed    #
#  under the terms of the GNU Library General Public License.         #
#                                                                     #
#*********************************************************************#

SOURCES = essai1.ml essai2.ml euro.ml graphps_logo.ml
EXECS = essai1 essai2 euro graphps_logo

CAMLC = camlc -I ..
CAMLDEP = camldep
CAMLLEX = camllex
CAMLYACC = camlyacc

LIBS=

CUSTOM=-custom

WITHGRAPHICSPS =graphics.zo

all: depend $(EXECS)

SOURCES1 = $(SOURCES:.mly=.ml)
SOURCES2 = $(SOURCES1:.mll=.ml)
OBJS = $(SOURCES2:.ml=.zo)

$(EXECS): $(OBJS)
	for i in $(EXECS); do \
	$(CAMLC) $(CUSTOM) -o $$i $(WITHGRAPHICSPS) $$i.zo; \
	./$$i > $$i.eps; \
	echo "To visualize the result: ghostview, gs, or gv $$i.eps"; \
	done

.SUFFIXES:
.SUFFIXES: .ml .mli .zo .zi .mll .mly

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

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

.mll.zo:
	$(CAMLLEX) $<
	$(CAMLC) -c $*.ml

.mly.zo:
	$(CAMLYACC) $<
	$(CAMLC) -c $*.mli
	$(CAMLC) -c $*.ml

.mly.zi:
	$(CAMLYACC) $<
	$(CAMLC) -c $*.mli

.mll.ml:
	$(CAMLLEX) $<

.mly.ml:
	$(CAMLYACC) $<

clean:
	rm -f *.z[aiox]* *~ .*~ #*#
	rm -f *.o
	rm -f *.eps *.ps
	rm -f a.out $(EXECS)

.depend: $(SOURCES2)
	$(CAMLDEP) *.mli *.ml > .depend

depend: $(SOURCES2)
	$(CAMLDEP) *.mli *.ml > .depend

include .depend
