#*********************************************************************#
#                                                                     #
#                           Caml Light                                #
#                                                                     #
#            Pierre Weis, projet Cristal, INRIA Rocquencourt          #
#                                                                     #
#  Copyright 2000 Institut National de Recherche en Informatique et   #
#  en Automatique.  Distributed only by permission.                   #
#                                                                     #
#*********************************************************************#

LIBDIR=/usr/local/lib/caml-light/
SOURCES= color.ml grimage.ml bmp.ml ppm.ml pixmap.ml
OBJS=$(SOURCES:.ml=.zo)

CAMLDEP=camldep
CAMLC=camlc

all: depend lib

lib: $(OBJS)
	camllibr -I . -o libgrimage.zo \
 color.zo grimage.zo pixmap.zo ppm.zo bmp.zo

install:
	cp -p *.mli $(LIBDIR)
	cp -p *.z* $(LIBDIR)

# 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=grimage
VERSION=1.0
WEBSITEDIR=/net/pauillac/infosystems/www/bazar-cl/$(PACKAGE)
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)/eng.htm $(WEBSITEDIR)/index.html
	- chgrp -R caml $(WEBSITEDIR)
	- chmod -R g+w $(WEBSITEDIR)
	cd release; mv bazar-cl/$(PACKAGE) $(PACKAGE)-$(VERSION); \
	tar cvf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION); \
	gzip $(PACKAGE)-$(VERSION).tar; \
	mv -f $(PACKAGE)-$(VERSION).tar.gz $(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:
	/bin/rm -f *.z[xio] *~ *.a

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

include .depend
