$(eval $(call import.MODULE.rules,DOC))

doc: doc.txt

doc.post: doc.txt
	$(CP.exe) $(DOC.out.articles/)txt/Building.osx.txt $(DOC.in/)BUILD-Mac
	$(CP.exe) $(DOC.out.articles/)txt/Building.linux.txt $(DOC.in/)BUILD-Linux
	$(CP.exe) $(DOC.out.articles/)txt/Building.mingw.txt $(DOC.in/)BUILD-MinGW

doc.txt: $(DOC.texi2txt.out)
doc.xml: $(DOC.texi2xml.out)

doc.clean:
	$(RM.exe) -fr $(DOC.out/)

$(DOC.texi2txt.out): | $(DOC.m4.out)
$(DOC.texi2txt.out): | $(dir $(DOC.texi2txt.out))
$(DOC.texi2txt.out): $(DOC.texi.includes)
$(DOC.texi2txt.out): $(DOC.out.articles/)txt/%.txt: $(DOC.in/)texi/%.texi
	$(call MAKEINFO,txt,$<,$@)
	@echo $^

$(DOC.texi2xml.out): | $(DOC.m4.out)
$(DOC.texi2xml.out): | $(dir $(DOC.texi2xml.out))
$(DOC.texi2xml.out): $(DOC.texi.includes)
$(DOC.texi2xml.out): $(DOC.out.articles/)xml/%.xml: $(DOC.in/)texi/%.texi
	$(call MAKEINFO,xml,$<,$@)
	@echo $^

$(DOC.m4.out): | $(dir $(DOC.m4.out))
$(DOC.m4.out): $(DOC.M4.deps)
$(DOC.m4.out): $(DOC.out/)%: $(DOC.in/)%.m4
	$(call DOC.M4,$@,$<)

clean: doc.clean
