# Makefile for ASPcomplete documentation
#
# (C) 2000 SWSoft Pte Ltd.
#

SGML2HTML = sgml2html
SGML2TXT = sgml2txt -f
LYNX = lynx -raw -dump -nolist -hiddenlinks=ignore -force_html
GLUE = ./glue
GLUE1 = ./glue1
CP = cp
MV = mv
MAKESHTML = ./make-shtml

TEMPLATE_RU = shtml_ru.template
TEMPLATE_EN = shtml_en.template

DOCS =	VE-HOWTO		\
	INSTALL			\
	INSTALL_RU		\
	RELEASE-NOTES-0.4	\
	RELEASE-NOTES-0.4_RU	\
	RELEASE-NOTES-0.4.2	\
	RELEASE-NOTES-0.4.2_RU \
	ASP_DQ			\
	ASP_CH

SHTML_TARGETS = $(DOCS:=.shtml)
 HTML_TARGETS = $(DOCS:=.html)
  TXT_TARGETS = $(DOCS:=.txt)

TARGETS = $(SHTML_TARGETS) $(HTML_TARGETS) $(TXT_TARGETS)

all: $(TARGETS) \
	instr2.shtml instr2_ru.shtml \
	notes2.shtml notes2_ru.shtml \
	asp_dq.shtml asp_ch.shtml

instr2.shtml:INSTALL.shtml
	$(CP) $< $@
instr2_ru.shtml:INSTALL_RU.shtml
	$(CP) $< $@
notes2.shtml:RELEASE-NOTES-0.4.2.shtml
	$(CP) $< $@
notes2_ru.shtml:RELEASE-NOTES-0.4.2_RU.shtml
	$(CP) $< $@
asp_dq.shtml: ASP_DQ.shtml
	$(CP) $< $@
asp_ch.shtml: ASP_CH.shtml
	$(CP) $< $@

clean:
	$(RM) $(TARGETS)
	$(RM) *[~\#]

%.html: %.sgml
	$(SGML2HTML) $<
	$(GLUE) $*
	$(RM) $**.html
	$(MV) a.html $@

%_RU.shtml: %_RU.html
	$(MAKESHTML) $(TEMPLATE_RU) $< $@

%_ru.shtml: %_ru.html
	$(MAKESHTML) $(TEMPLATE_RU) $< $@

%.shtml: %.html
	$(MAKESHTML) $(TEMPLATE_EN) $< $@

$(HTML_TARGETS): $(GLUE) $(GLUE1)
$(SHTML_TARGETS): $(MAKESHTML)

%.html: %.ssgml
	$(SGML2HTML) --split=0 $<
	$(MV) $*..html $@

%.txt: %.html
	$(LYNX) $< > $@

%.txt: %.sgml
	$(SGML2TXT) $<
