# Makefile for MkDocs documentation
#

INCLUDE_ITEM= IT Checklist Divers Cuisine

# You can set these variables from the command line.
BUILDDIR        ?= _build/html
DOCFOLDER		= _docs
MKDOCS          = mkdocs
MKDOCSBUILDOPTS = --clean --strict --verbose
MKDOCSBUILD     = $(MKDOCS) build $(MKDOCSBUILDOPTS)
MKDOCSSERVE     = $(MKDOCS) serve -a 0.0.0.0:8000


BUILD_CMD := $(MKDOCSBUILD) --site-dir $(BUILDDIR) && \
	echo && \
	echo "Build finished. The HTML pages are in $(BUILDDIR)."

TEST_CMD := grep -q "<title>Notebook</title>" $(BUILDDIR)/index.html && \
	echo && \
	echo "Test finished. The HTML pages are in $(BUILDDIR)."

filter:
	rm -rf $(DOCFOLDER)
	mkdir $(DOCFOLDER)
	cp README.md $(DOCFOLDER)/index.md
	for item in $(INCLUDE_ITEM);  do \
		cp -r $${item} $(DOCFOLDER) ;\
	done;\

build: deps
	$(BUILD_CMD)

serve: deps
	$(MKDOCSSERVE)

clean:
	rm -rf $(DOCFOLDER)/*
	rm -rf $(BUILDDIR)/*

deps:
	pip install -r requirements.txt

test: build
	$(TEST_CMD)

install: filter test

run: filter serve