# Makefile for doc/

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

@SET_MAKE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

DOCS = ABOUT BANS BOTNET BUG-REPORT COMPILE-GUIDE CONTENTS \
Changes1.8 FIRST-SCRIPT IPV6 KNOWN-PROBLEMS MODULES PARTYLINE PATCH-HOWTO \
TEXT-SUBSTITUTIONS TLS TRICKS USERS Versions WEIRD-MESSAGES tcl-commands.doc \
FAQ

MAN1 = man1/eggdrop.1

WEB_ROOT = $(srcdir)/html/*.html
WEB_APPND = $(srcdir)/html/appendices/*.html
WEB_CORE = $(srcdir)/html/coreDocs/*.html
WEB_INST = $(srcdir)/html/installAndSetup/*.html
WEB_MAIN = $(srcdir)/html/mainDocs/*.html
WEB_STAT = $(srcdir)/html/_static/*

SETTING_DOCS = core.settings CONTENTS
SETTING_MOD_DOCS = $(srcdir)/settings/mod.*

doofus:
	@echo ""
	@echo "Let's try this from the right directory..."
	@echo ""
	@cd .. && $(MAKE)

all: $(DOCS) $(MAN1)

clean:
	@rm -f *~

install:
	@if test ! -d $(DEST)/doc; then \
		echo "Creating 'doc' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc >/dev/null; \
	fi
	@if test ! -d $(DEST)/doc/man1; then \
		echo "Creating 'doc/man1' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/man1 >/dev/null; \
	fi
	@if test ! -d $(DEST)/doc/html; then \
		echo "Creating 'doc/html' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html >/dev/null; \
	fi
	@if test ! -d $(DEST)/doc/html/appendices; then \
		echo "Creating 'doc/html/appendices' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/appendices >/dev/null; \
	fi
	@if test ! -d $(DEST)/doc/html/coreDocs; then \
                echo "Creating 'doc/html/coreDocs' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/coreDocs >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/installAndSetup; then \
                echo "Creating 'doc/html/installAndSetup' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/installAndSetup >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/mainDocs; then \
                echo "Creating 'doc/html/mainDocs' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/mainDocs >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/_static; then \
                echo "Creating 'doc/html/_static' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/_static >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/settings; then \
		echo "Creating 'doc/settings' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/settings >/dev/null; \
	fi
	@echo "Copying docs."
	@for i in $(DOCS); do \
		$(INSTALL_DATA) $(srcdir)/$$i $(DEST)/doc/; \
	done
	@for i in $(MAN1); do \
		$(INSTALL_DATA) $(srcdir)/$$i $(DEST)/doc/man1/; \
	done
	@for i in $(SETTING_DOCS); do \
		$(INSTALL_DATA) $(srcdir)/settings/$$i $(DEST)/doc/settings/; \
	done
	@if test "x`echo $(SETTING_MOD_DOCS)`" != "x$(SETTING_MOD_DOCS)"; then \
		for i in `echo $(SETTING_MOD_DOCS)`; do \
			$(INSTALL_DATA) $$i $(DEST)/doc/settings/; \
		done; \
	fi
	@if test "x`echo $(WEB_ROOT)`" != "x$(WEB_ROOT)"; then \
		for i in `echo $(WEB_ROOT)`; do \
			$(INSTALL_DATA) $$i $(DEST)/doc/html/; \
		done; \
	fi
	@if test "x`echo $(WEB_APPND)`" != "x$(WEB_APPND)"; then \
		for i in `echo $(WEB_APPND)`; do \
			$(INSTALL_DATA) $$i $(DEST)/doc/html/appendices; \
		done; \
	fi
	@if test "x`echo $(WEB_CORE)`" != "x$(WEB_CORE)"; then \
                for i in `echo $(WEB_CORE)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/coreDocs; \
                done; \
        fi
	@if test "x`echo $(WEB_INST)`" != "x$(WEB_INST)"; then \
                for i in `echo $(WEB_INST)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/installAndSetup; \
                done; \
        fi
	@if test "x`echo $(WEB_MAIN)`" != "x$(WEB_MAIN)"; then \
                for i in `echo $(WEB_MAIN)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/mainDocs; \
                done; \
        fi
	@if test "x`echo $(WEB_STAT)`" != "x$(WEB_STAT)"; then \
                for i in `echo $(WEB_STAT)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/_static; \
                done; \
        fi
