VPATH		= @srcdir@
srcdir		= @srcdir@
top_srcdir	= @top_srcdir@

default: all

include ../Makefile.conf

ifeq (@USE_SGML_DOC@, true)
all: internals.html/index.html
else
all: 
endif

clean: 
	$(RM) $(srcdir)/manuals-version
	$(RM) -rf internals.html/

distclean: clean 
	$(RM) Makefile

install: install-doc

manuals-version: $(top_srcdir)/version-nr
	set -e ; v=`sed -ne '1s/.*(\(.*\)).*/\1/' $(srcdir)/ChangeLog` ; \
	echo "<!entity manuals-version \"$$v\">" > $@
	echo "<!entity dpkg-version \"$(VERSION)\">" >> $@

internals.html/index.html: internals.sgml manuals-version
	debiandoc2html -n -D. $<

install-doc: 
ifeq (@USE_SGML_DOC@, true)
	$(mkinstalldirs) $(DESTDIR)$(docdir)/internals/
	set -e ; for i in internals.html/* ; do \
		bn=`basename $$i` ; \
		$(INSTALL_DATA) $$i $(DESTDIR)$(docdir)/internals/$$bn ; \
	done
endif
	$(mkinstalldirs) $(DESTDIR)$(docdir)/
	$(INSTALL_DATA) $(srcdir)/ChangeLog $(DESTDIR)$(docdir)/ChangeLog.manuals
	set -e ; for i in ChangeLog THANKS TODO ; do \
		$(INSTALL_DATA) $(top_srcdir)/$$i $(DESTDIR)$(docdir) ; \
	done
	$(INSTALL_DATA) $(top_srcdir)/COPYING $(DESTDIR)$(copyingfile)


.PHONY: all clean distclean install install-doc
.PHONY: install-doc-recursive
