WOOPER_TOP = ..


DOCUTILS_TOP = $(WOOPER_TOP)

DOC_BASE_NAME := wooper

# The current, operational version of WOOPER:
CURRENT_VERSION := 2.0

DOC_NAME := $(DOC_BASE_NAME)-$(CURRENT_VERSION)

OVERALL_DOCUMENT_SOURCE := $(DOC_NAME).rst



CURRENT_WOOPER_PDF := $(DOC_NAME).pdf
CURRENT_WOOPER_HTML := $(DOC_NAME).html

HTML_TARGET = $(CURRENT_WOOPER_HTML)


DOC_GENERATED_FILES := $(CURRENT_WOOPER_PDF) $(CURRENT_WOOPER_HTML)

DOC_FILES := $(DOC_GENERATED_FILES) wooper-example.png



PROJECT_CSS := pygments-default.css,wooper.css

PROJECT_ICON := wooper-icon.png


WEB_CONTENT = *.html *.css *.png tmp-rst/*.pdf

# Read from the user's environment:
GITHUB_PAGES_BASE := $(shell basename "(WOOPER_WEB_MIRROR_BRANCH)")



.PHONY: all doc full-doc track clone-mirror              \
		export-doc export-to-official export-to-mirror   \
		info-web clean clean-doc


# Default do-nothing target:
doc:


all:
	@echo "  Run 'make full-doc' to generate the manual of the WOOPER-$(CURRENT_VERSION) layer."



full-doc: $(CURRENT_WOOPER_HTML)


html: clean-doc $(HTML_TARGET)



# Creates a separate repository for the GitHub pages branch:
# (please then remove all initial content of that branch)
#
clone-mirror:
	@cd ../../ && git clone https://github.com/Olivier-Boudeville/Ceylan-WOOPER.git $(GITHUB_PAGES_BASE) && cd $(GITHUB_PAGES_BASE) && git checkout -b gh-pages


export-doc: clean-doc full-doc export-to-official export-to-mirror


export-to-official:
	@echo "   Exporting WOOPER documentation to official website ($(WEB_SRV))"
	@/bin/scp $(SP) $(WEB_CONTENT) $(WEB_SRV):$(WEB_ROOT)/WOOPER/


export-to-mirror:
	@echo "   Exporting WOOPER documentation to mirror website in $(WOOPER_WEB_MIRROR_BRANCH)"
	@/bin/cp -f $(WEB_CONTENT) $(WOOPER_WEB_MIRROR_BRANCH) && cd $(WOOPER_WEB_MIRROR_BRANCH) && git add . && git merge -s ours && git commit -m "WOOPER doc updated." && git push && git pull --ff-only


clean: clean-doc

clean-doc:
	-@/bin/rm -f *.aux *.log *.maf *.mtc* *.stc* *.tex *.toc \
	$(CURRENT_WOOPER_PDF) $(DOC_GENERATED_FILES)



info: info-doc info-web


info-doc:
	@echo "OVERALL_DOCUMENT_SOURCE = $(OVERALL_DOCUMENT_SOURCE)"
	@echo "DOC_FILES = $(DOC_FILES)"
	@echo "DOC_TRACKER = $(DOC_TRACKER)"


info-web:
	@echo "WEB_CONTENT = $(WEB_CONTENT)"
	@echo "WOOPER_WEB_MIRROR_BRANCH = $(WOOPER_WEB_MIRROR_BRANCH)"
	@echo "GITHUB_PAGES_BASE = $(GITHUB_PAGES_BASE)"


DOCUTILS_TOP = .

# For MYRIAD_TOP:
include $(WOOPER_TOP)/GNUmakesettings.inc
