# 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.9 FIRST-SCRIPT IPV6 IRCv3 LEGAL PARTYLINE PATCH-HOWTO \
PBKDF2 TLS TRICKS USERS Versions tcl-commands.doc twitch-tcl-commands.doc

MAN1 = man1/eggdrop.1

WEB_ROOT = $(srcdir)/html/*.html
WEB_ABOUT = $(srcdir)/html/about/*.html
WEB_INSTALL = $(srcdir)/html/install/*.html
WEB_MOD = $(srcdir)/html/modules/*.html
WEB_MOD2 = $(srcdir)/html/modules/mod/*.html
WEB_TUT = $(srcdir)/html/tutorials/*.html
WEB_USE = $(srcdir)/html/using/*.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/about; then \
		echo "Creating 'doc/html/about' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/about >/dev/null; \
	fi
	@if test ! -d $(DEST)/doc/html/install; then \
                echo "Creating 'doc/html/install' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/install >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/modules; then \
                echo "Creating 'doc/html/modules' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/modules >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/modules/mod; then \
                echo "Creating 'doc/html/modules/mod' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/modules/mod >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/tutorials; then \
                echo "Creating 'doc/html/tutorials' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/tutorials >/dev/null; \
        fi
	@if test ! -d $(DEST)/doc/html/using; then \
                echo "Creating 'doc/html/using' subdirectory."; \
                $(top_srcdir)/misc/mkinstalldirs $(DEST)/doc/html/using >/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_ABOUT)`" != "x$(WEB_ABOUT)"; then \
		for i in `echo $(WEB_ABOUT)`; do \
			$(INSTALL_DATA) $$i $(DEST)/doc/html/appendices; \
		done; \
	fi
	@if test "x`echo $(WEB_INSTALL)`" != "x$(WEB_INSTALL)"; then \
                for i in `echo $(WEB_INSTALL)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/install; \
                done; \
        fi
	@if test "x`echo $(WEB_MOD)`" != "x$(WEB_MOD)"; then \
                for i in `echo $(WEB_MOD)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/modules; \
                done; \
        fi
	@if test "x`echo $(WEB_MOD2)`" != "x$(WEB_MOD2)"; then \
                for i in `echo $(WEB_MOD2)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/modules/mod; \
                done; \
        fi
	@if test "x`echo $(WEB_TUT)`" != "x$(WEB_TUT)"; then \
                for i in `echo $(WEB_TUT)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/tutorials; \
                done; \
        fi
	@if test "x`echo $(WEB_USE)`" != "x$(WEB_USE)"; then \
                for i in `echo $(WEB_USE)`; do \
                        $(INSTALL_DATA) $$i $(DEST)/doc/html/using; \
                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
