#! /bin/sh

SRC="SRC	= "
OUTPUT="OUTPUT	= "
HTML="HTML	= "

. files

rm -f Makefile.lang

for file in ${bases} ${containers} ${control} ${buttons} ${dialog} ${menus} ${IO} ${viewports} ${nonvisual} ${aux}
do
  name="`basename ${file} .html`"
# echo "${file} -> \c"
# echo "${name}"
  OUTPUT="${OUTPUT} ${name}.html"
  echo >> Makefile.lang
  echo "${name}.html:	../source/${name}.lang \$(PROG)" >> Makefile.lang
  echo "	\$(PROG) ../source/${name}.lang" >> Makefile.lang
done

for name in overview.html using.html objects.html resources.html events.html translations.html international.html legend.html
do
  HTML="${HTML} ${name}"
  echo >> Makefile.lang
  echo "${name}:	../source/${name}" >> Makefile.lang
  echo "	cp ../source/${name} ${name}" >> Makefile.lang
done

makefile=\
"PROG	= ../source/lang
INCDIR	= ../../../../Cvo
INDEX	= cvo.html cref.html methods.html master.index.html index.html

${HTML}

${OUTPUT}

.SUFFIXES:	.lang .html

all:		\$(OUTPUT) \$(INDEX) \$(HTML) @Includes @Examples

@Includes:
	mkdir @Includes
	mkdir @Includes/Cvo
	(cd @Includes/Cvo; \\
	 for i in \$(INCDIR)/*.h++ ; do \\
	   echo Linking \$\$i... ; \\
	   ln -s \$\$i \`basename \$\$i .h++\`.h ; \\
    	 done)

@Examples:
	cp -r ../examples @Examples

\$(INDEX):	../source/files ../source/genindex \$(OUTPUT)
		../source/genindex ../source/files

\$(OUTPUT):	\$(PROG)"

rm -f ../html/Makefile
echo "${makefile}" > ../html/Makefile
cat Makefile.lang >> ../html/Makefile
rm -f Makefile.lang
