### ==========================================================================
###  $Id: Makefile,v 1.9 2004/02/17 02:27:13 stephmo Exp $
###  FILE: doc/Makefile - build HTML documentation from SGML source
###  brickOS - the independent LEGO Mindstorms OS
### --------------------------------------------------------------------------

DOCBASE = INSTALL-cygwin
DOCSRC = $(DOCBASE).sgml

TEXT_DOCS = AvailableDocs.txt \
            Notes_on_intterupts \
            Pros_and_Cons \
            RCXmessageAPI.txt \
            Sensors


include ../Makefile.common

#  out default target when doing make in this directory
docs-build: $(DOCBASE).html

# nothing to do for these (documents not built when running top-level build)
all install uninstall depend tag::
	@# nothing to do here, but do this nothing silently

docs-install: ${pkghtmldir} chkbuild
	-@cp -f ../[CLNRV]* ${pkgdocdir} 2>/dev/null
	cp -f ${TEXT_DOCS} ${pkgdocdir} 
	cp -r images ${pkghtmldir}
	cp -f *.html ${pkghtmldir}
	mkdir -p ${pkghtmldir}/HOWTO
	cp HOWTO/*.html ${pkghtmldir}/HOWTO
	cp HOWTO.html ${pkghtmldir}/HOWTO
	@# oops copied extra files, remove them
	@rm -f $(pkghtmldir)/HOWTO/t1.html
	@rm -f $(pkghtmldir)/HOWTO.html

chkbuild:
	@if [ ! -f $(DOCBASE).html ] ;then \
		echo ""; \
		echo "---------------------------------------------------------"; \
		echo "  Documents are not built. Please run 'make doc' then "; \
		echo "    rerun 'make doc-install' as root"; \
		echo "---------------------------------------------------------"; \
		echo ""; \
		exit 2; \
	fi

${pkghtmldir}:
	mkdir -p $@

#  generate html and correct image path in top page
$(DOCBASE).html: $(DOCSRC)
	sgmltools -b html $(DOCBASE)
	sed -e 's/\/docbook-dsssl/images/' $(DOCBASE)/top.html >$@

realclean::
	rm -rf $(DOCBASE)
	rm -f $(DOCBASE).html

clean:
	@# nothing to do here, but do this nothing silently

realclean:: clean

### --------------------------------------------------------------------------
###                            End of FILE: doc/Makefile
### ==========================================================================
