SHELL := /bin/bash DOCS = $(wildcard */) OUTPUT_FOLDER = target TEMPLATE_HTML_FOLDER = html-template TEMPLATE_JEKYLL = _templates/jekyll-gazelle-documentation DOCS := $(filter-out _templates/,$(DOCS)) DOCS := $(filter-out target/,$(DOCS)) all: clean jekyll $(DOCS) $(DOCS): force | $(OUTPUT_FOLDER) @echo "Generte doc for" $@ "folder" -cd $@ && $(MAKE) && cp target/*.pdf ../$(OUTPUT_FOLDER)/; force: ; $(OUTPUT_FOLDER): mkdir -p $(OUTPUT_FOLDER) # launch jekyll serve to preview website with jekyll server view: jekyll cp $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/index-default.html $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/index.html cd $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/ && bundle exec jekyll serve # Create documentation website with jekyll # Website will be in $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/_site jekyll: | $(OUTPUT_FOLDER) init_jekyll_folder copy_source_to_jekyll cd $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/ && bundle exec jekyll build prepare_jekyll: | $(OUTPUT_FOLDER) init_jekyll_folder copy_source_to_jekyll generate_site: cd $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/ && bundle exec jekyll build init_jekyll_folder: cp -r $(TEMPLATE_JEKYLL) $(OUTPUT_FOLDER) cd $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/ && bundle setup: sudo apt-get install make git git-svn texlive-xetex pandoc ruby-dev sudo gem install bundler # copy markdown sources to jekyll foler copy_docs_to_target: @for a in $(DOCS); do \ if [ -d $$a ]; then \ echo "copy pdf documents from $$a folder to $(OUTPUT_FOLDER)/"; \ cp -r $$a/target/*.pdf $(OUTPUT_FOLDER)/; \ fi; \ done; @echo "Done!" # copy markdown sources to jekyll foler copy_source_to_jekyll: @for a in $(DOCS); do \ if [ -d $$a ]; then \ echo "copy folder $$a to $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/"; \ cp -r $$a $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/; \ rm -rf $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/$$a/test-reports;\ rm -rf $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/$$a/production-reports;\ # mkdir $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/$$a ; \ # cp -r $$a $(OUTPUT_FOLDER)/jekyll-gazelle-documentation/$$a; \ fi; \ done; @echo "Done!" .PHONY: clean clean: -rm -rf $(OUTPUT_FOLDER) @for a in $(DOCS); do \ if [ -d $$a ]; then \ echo "clean folder $$a"; \ $(MAKE) clean -C $$a; \ fi; \ done; @echo "All clear!"