#*********************************************************************#
#                                                                     #
#                           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 = graphics.ml

CAMLC = camlc
CAMLDEP = camldep
CAMLLEX = camllex
CAMLYACC = camlyacc

WITHPSGRAPHICS =graphics.zo

all: depend
	${MAKE} $(OBJS)

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

install:
	- mkdir $(LIBDIR)/graphps
	cp -p $(SOURCES:.ml=.mli) $(LIBDIR)/graphps/
	cp -p $(OBJS) $(LIBDIR)/graphps/

# Just for $(PACKAGE) maintainers, distribution of the software.
# Need an INSTALL file in the main directory.
# Need a doc directory where the documentation has been written,
# presumably in HTML with an index.html file. This directory is copied
# onto the WEB site of the package, as mentioned in $(WEBSITEDIR)
PACKAGE=graphps
VERSION=1.0
WEBSITEDIR=/net/pauillac/infosystems/www/$(PACKAGE)/cl
FTPDIR=/net/pauillac/infosystems/ftp/cristal/caml-light/bazar-cl/$(PACKAGE)

distribute:
	rm -rf release
	rm -rf $(WEBSITEDIR)/*
	mkdir release
	cd release; cvs co bazar-cl/$(PACKAGE); \
	find . -name '.cvsignore' -print | xargs rm; \
	find . -name 'CVS' -print | xargs rm -rf; \
	cp -p bazar-cl/$(PACKAGE)/README bazar-cl/$(PACKAGE)/doc/; \
	cp -p bazar-cl/$(PACKAGE)/INSTALL bazar-cl/$(PACKAGE)/doc/; \
	mkdirhier $(WEBSITEDIR); \
	cp -pr bazar-cl/$(PACKAGE)/doc/* $(WEBSITEDIR)/; \
	ln -s $(WEBSITEDIR)/index.html $(WEBSITEDIR)/eng.htm
	- chgrp -R caml $(WEBSITEDIR)
	- chmod -R g+w $(WEBSITEDIR)
	cd release; mv bazar-cl/$(PACKAGE) $(PACKAGE)-$(VERSION); \
	tar zcvf $(PACKAGE)-$(VERSION).tgz $(PACKAGE)-$(VERSION); \
	mv -f $(PACKAGE)-$(VERSION).tgz $(FTPDIR)
	rm -rf release

.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[iox] *.o *~ .*~ #*#
	rm -f .depend; touch .depend
	cd test; make clean

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

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

include .depend
include Makefile.config
