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

# $Id: MakeHTML,v 1.2 2004/07/15 08:34:39 weis Exp $

# MakeHTML: a Makefile for HTML files generation.

# This file (MakeHTML) should reside in the directory where the HTML
# files of the WEB site have to be generated (the HTML files of the WEB
# site are generated from their source files that reside in another
# directory, namely the value of the variable $(SRC) below).
#
# Note: if you change the name of this file you should rename it
# accordingly in the rules below.

# Usage:
#
# Initialization:
#  You must
#  1- create an empty file named .Makefile.auto in the same directory,
#  2- fill in the SRC and FILES variables below,
#  2- fill in the PACKAGE variable so that you can use a prefix for
#     the source files. (E.g. if PACKAGE is advi, then the file
#     advi-index.html in $(SRC) will be compiled to $(SRC)/advi-index.htm
#     and copied here as index.htm).
#  3- type make to initialize the Makefile included rules.

# Site maintenance (or first creation):
#  make (or make all) will rebuild the whole thing
#  make clean will remove all the generated files

# Sources files directory
SRC=../doc_src

# Prefix before regular names
PACKAGE=advi

# The list of files for this part of the Web site
FILES=index.htm fra.htm eng.htm faq-fra.htm faq-eng.htm

######## This part of the Makefile should automatically handle the
######## generation of object files for the list $(FILES)

# Automatic generation of rules to handle $(FILES)
# Rules are written into auxiliary file $(AUTO) that is included at
# the end of this Makefile.
AUTO=.Makefile.auto

all: $(AUTO) expand $(FILES)

expand:
	cd $(SRC); $(MAKE)

clean: $(AUTO)
	cd $(SRC); $(MAKE) clean
	/bin/rm -f $(FILES)

#  Note: make regenerates the rules into file .Makefile.auto.
# (handled automatically). .Makefile.auto depends upon this Makefile,
# since any addition to the Makefile may leads to the recompilation of
# the rules. Hence,
# make clean all
# will recompute the rules and recompile the set of files again.

$(AUTO): MakeHTML

$(AUTO):
	/bin/rm -f $(AUTO)
	for i in $(FILES); do \
	/bin/rm -f $(FILES); \
	j=`basename $$i .htm`; \
	echo $$i: $(SRC)/$(PACKAGE)-$$j.htm >> $(AUTO); \
	echo >> $(AUTO); \
	echo $(SRC)/$(PACKAGE)-$$j.htm: >> $(AUTO); \
	echo -n "	chmod +w $$j.htm; " >> $(AUTO); \
	echo "cp -p $(SRC)/$(PACKAGE)-$$j.htm $$j.htm" >> $(AUTO); \
	done

include $(AUTO)
