#############################################################################################
#############################################################################################
##
## DOCMAN-TARGETS
##
#############################################################################################
#############################################################################################

ifeq ($(DOCMAN_BIN),) 
  $(error "$(DOCMAN_BIN) is not installed. Please check your makefile and include the docman.mk")
endif

$(DOCMAN_BIN):
	$(QUIET) $(MKDIR) -p $(VENDOR_PATH)
	$(QUIET) $(WGET) -O $(DOCMAN_BIN) http://download.schukai.com/tools/docman/docman-$(shell uname -s | tr [:upper:] [:lower:])-$(shell echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`)
	$(QUIET) $(CHMOD) u+x $(DOCMAN_BIN)

$(PROJECT_ROOT)deployment/build/manual.html: $(DOCMAN_BIN)
	$(DOCMAN_BIN) document html --config $(PROJECT_ROOT)documentation/config.yaml

$(PROJECT_ROOT)deployment/build/manual.pdf: $(DOCMAN_BIN)
	$(DOCMAN_BIN) document pdf --config $(PROJECT_ROOT)documentation/config.yaml

.PHONY: build-doc-pdf
## creating the documentation in pdf format
build-doc-pdf: $(PROJECT_ROOT)deployment/build/manual.pdf

.PHONY: build-doc-html
## creating the documentation in html format
build-doc-html: $(PROJECT_ROOT)deployment/build/manual.html


.PHONY: build-doc
## creating the documentation in pdf and html format
build-doc: build-doc-pdf build-doc-html