#*********************************************************************#
#                                                                     #
#                           HTMLC                                     #
#                                                                     #
#            Pierre Weis, projet Cristal, INRIA Rocquencourt          #
#                                                                     #
# Copyright 2003-2004,                                                #
# Institut National de Recherche en Informatique et en Automatique.   #
# Distributed only by permission.                                     #
#                                                                     #
#*********************************************************************#

#(* $Id: Makefile,v 1.9 2004/09/22 12:56:47 weis Exp $ *)

# To debug the compiler
# ledit ocamldebug ../htmlc.byt
# set arguments -I ../../doc_src/Includes/ -env env1.ml -c test0.html
# directory ..
# run

HTMLC=../htmlc
HTMLCFLAGS0=-I ../../doc_src/Includes/ -env env0
HTMLCFLAGS1=-I ../../doc_src/Includes/ -env env1.ml

ENVS=env0 env1.ml
SOURCES0=test00.html test0.html test1.html test2.html test3.html
MSOURCES=test4.man
SOURCES1=example-eng.html included-fra.html
SOURCES2=example-fra.html included-eng.html

HSOURCES=$(SOURCES0) $(SOURCES1) $(SOURCES2)
HTARGETS=$(HSOURCES:.html=.htm)
MTARGETS=$(MSOURCES:.man=.m)

all : $(HTARGETS) $(MTARGETS)
	for i in $(HSOURCES); do \
	echo $$i; \
	j=`basename $$i .html`.htm; \
	cmp $$j results/$$j || exit 2; \
	done
	for i in $(MSOURCES); do \
	echo $$i; \
	j=`basename $$i .man`.m; \
	cmp $$j results/$$j || exit 2; \
	done

$(HTARGETS): $(HSOURCES) $(ENVS) ../../doc_src/Includes/htmlc-version.html
$(MTARGETS): $(MSOURCES) $(ENVS) ../../doc_src/Includes/htmlc-version.html

clean:
	/bin/rm -f *.htm *.m *~

.SUFFIXES:
.SUFFIXES: .shtml .html .htm .man .m

.shtml.htm:
	$(HTMLC) $(HTMLCFLAGS0) -s $<

.html.htm:
	$(HTMLC) $(HTMLCFLAGS1) -c $<

.man.m:
	$(HTMLC) $(HTMLCFLAGS1) -f $< -t $@
