Changeset View
Changeset View
Standalone View
Standalone View
documentation/Makefile
Show All 16 Lines | ||||||||||||||||||||||
MAINTAINER=carlavilla@FreeBSD.org | MAINTAINER=carlavilla@FreeBSD.org | |||||||||||||||||||||
LOCALBASE?= /usr/local | LOCALBASE?= /usr/local | |||||||||||||||||||||
PYTHON_CMD = ${LOCALBASE}/bin/python3 | PYTHON_CMD = ${LOCALBASE}/bin/python3 | |||||||||||||||||||||
RUBY_CMD = ${LOCALBASE}/bin/ruby | RUBY_CMD = ${LOCALBASE}/bin/ruby | |||||||||||||||||||||
HUGO_CMD = ${LOCALBASE}/bin/hugo | HUGO_CMD = ${LOCALBASE}/bin/hugo | |||||||||||||||||||||
HUGO_ARGS?= --verbose --minify | HUGO_ARGS?= --verbose --minify | |||||||||||||||||||||
ASCIIDOCTOR_CMD= ${LOCALBASE}/bin/asciidoctor | ||||||||||||||||||||||
ASCIIDOCTORPDF_CMD= ${LOCALBASE}/bin/asciidoctor-pdf | ASCIIDOCTORPDF_CMD= ${LOCALBASE}/bin/asciidoctor-pdf | |||||||||||||||||||||
SED_CMD = /usr/bin/sed | ||||||||||||||||||||||
.if defined(DOC_LANG) && !empty(DOC_LANG) | .if defined(DOC_LANG) && !empty(DOC_LANG) | |||||||||||||||||||||
LANGUAGES = ${DOC_LANG} | LANGUAGES = ${DOC_LANG} | |||||||||||||||||||||
.else | .else | |||||||||||||||||||||
LANGUAGES = en,es,pt-br,de,ja,zh-cn,zh-tw,ru,el,hu,it,mn,nl,pl,fr | LANGUAGES = en,es,pt-br,de,ja,zh-cn,zh-tw,ru,el,hu,it,mn,nl,pl,fr | |||||||||||||||||||||
.endif | .endif | |||||||||||||||||||||
RUBYLIB = ../shared/lib | RUBYLIB = ../shared/lib | |||||||||||||||||||||
.export RUBYLIB | .export RUBYLIB | |||||||||||||||||||||
RUN_DEPENDS= ${PYTHON_CMD} \ | RUN_DEPENDS= ${PYTHON_CMD} \ | |||||||||||||||||||||
${HUGO_CMD} \ | ${HUGO_CMD} \ | |||||||||||||||||||||
${LOCALBASE}/bin/asciidoctor \ | ${LOCALBASE}/bin/asciidoctor \ | |||||||||||||||||||||
${LOCALBASE}/bin/asciidoctor-pdf \ | ${LOCALBASE}/bin/asciidoctor-pdf \ | |||||||||||||||||||||
${LOCALBASE}/bin/rougify | ${LOCALBASE}/bin/rougify | |||||||||||||||||||||
.ifndef HOSTNAME | .ifndef HOSTNAME | |||||||||||||||||||||
. ifdef BIND | . ifdef BIND | |||||||||||||||||||||
.HOST=$(BIND) | .HOST=$(BIND) | |||||||||||||||||||||
. else | . else | |||||||||||||||||||||
.HOST=localhost | .HOST=localhost | |||||||||||||||||||||
. endif | . endif | |||||||||||||||||||||
.else | .else | |||||||||||||||||||||
.HOST=$(HOSTNAME) | .HOST=$(HOSTNAME) | |||||||||||||||||||||
.endif | .endif | |||||||||||||||||||||
.ORDER: all run | .ORDER: all run | |||||||||||||||||||||
ceri: Apologies - this is my bug but this should read "with only articles" rather than "without… | ||||||||||||||||||||||
Done Inline Actions
Same here. ceri: Same here. | ||||||||||||||||||||||
.ORDER: requirements | .ORDER: requirements | |||||||||||||||||||||
.ORDER: starting-message generate-books-toc | .ORDER: starting-message generate-books-toc | |||||||||||||||||||||
.ORDER: starting-message build | .ORDER: starting-message build | |||||||||||||||||||||
.ORDER: generate-books-toc build | .ORDER: generate-books-toc build | |||||||||||||||||||||
all: requirements starting-message generate-books-toc generate-pgpkeys-txt build | all: requirements starting-message generate-books-toc generate-pgpkeys-txt build | |||||||||||||||||||||
run: requirements starting-message generate-books-toc generate-pgpkeys-txt run-local | run: requirements starting-message generate-books-toc generate-pgpkeys-txt run-local | |||||||||||||||||||||
requirements: | requirements: | |||||||||||||||||||||
.for dep in ${RUN_DEPENDS} | .for dep in ${RUN_DEPENDS} | |||||||||||||||||||||
.if !exists(${dep}) | .if !exists(${dep}) | |||||||||||||||||||||
@(echo ${dep} not found, please run 'pkg install docproj'; exit 1) | @(echo ${dep} not found, please run 'pkg install docproj'; exit 1) | |||||||||||||||||||||
.endif | .endif | |||||||||||||||||||||
.endfor | .endfor | |||||||||||||||||||||
starting-message: .PHONY | starting-message: .PHONY | |||||||||||||||||||||
@echo --------------------------------------------------------------- | @echo --------------------------------------------------------------- | |||||||||||||||||||||
@echo Building the documentation | @echo Building the documentation | |||||||||||||||||||||
@echo --------------------------------------------------------------- | @echo --------------------------------------------------------------- | |||||||||||||||||||||
generate-books-toc: .PHONY | generate-books-toc: .PHONY | |||||||||||||||||||||
${PYTHON_CMD} ./tools/books-toc-parts-creator.py -l ${LANGUAGES} | ${PYTHON_CMD} ./tools/books-toc-parts-creator.py -l ${LANGUAGES} | |||||||||||||||||||||
${PYTHON_CMD} ./tools/books-toc-creator.py -l ${LANGUAGES} | ${PYTHON_CMD} ./tools/books-toc-creator.py -l ${LANGUAGES} | |||||||||||||||||||||
${PYTHON_CMD} ./tools/books-toc-figures-creator.py -l ${LANGUAGES} | ${PYTHON_CMD} ./tools/books-toc-figures-creator.py -l ${LANGUAGES} | |||||||||||||||||||||
${PYTHON_CMD} ./tools/books-toc-tables-creator.py -l ${LANGUAGES} | ${PYTHON_CMD} ./tools/books-toc-tables-creator.py -l ${LANGUAGES} | |||||||||||||||||||||
${PYTHON_CMD} ./tools/books-toc-examples-creator.py -l ${LANGUAGES} | ${PYTHON_CMD} ./tools/books-toc-examples-creator.py -l ${LANGUAGES} | |||||||||||||||||||||
Done Inline Actions
We need to wrap this in a check that BOOK_LANGS is not empty, otherwise we get a failure with DOC_LANG=tr, for example. ceri: We need to wrap this in a check that BOOK_LANGS is not empty, otherwise we get a failure with… | ||||||||||||||||||||||
generate-pgpkeys-txt: static/pgpkeys/pgpkeys.txt | generate-pgpkeys-txt: static/pgpkeys/pgpkeys.txt | |||||||||||||||||||||
static/pgpkeys/pgpkeys.txt: static/pgpkeys/*key | static/pgpkeys/pgpkeys.txt: static/pgpkeys/*key | |||||||||||||||||||||
${RUBY_CMD} ./tools/global-pgpkeys-creator.rb | ${RUBY_CMD} ./tools/global-pgpkeys-creator.rb | |||||||||||||||||||||
run-local: .PHONY | run-local: .PHONY | |||||||||||||||||||||
${HUGO_CMD} server ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" | ${HUGO_CMD} server ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" | |||||||||||||||||||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | ||||||||||||||||||||||
pdf-articles-clean: pdf-articles-target | pdf-articles-clean: pdf-articles-target | |||||||||||||||||||||
.for _curpdf in ${ARTICLESDIR} | .for _curpdf in ${ARTICLESDIR} | |||||||||||||||||||||
rm -f ${.CURDIR}/public${_curpdf:S|^${.CURDIR}/content||}article.pdf | rm -f ${.CURDIR}/public${_curpdf:S|^${.CURDIR}/content||}article.pdf | |||||||||||||||||||||
rm -fr ${.CURDIR}/public${_curpdf:S|^${.CURDIR}/content||} | rm -fr ${.CURDIR}/public${_curpdf:S|^${.CURDIR}/content||} | |||||||||||||||||||||
.endfor | .endfor | |||||||||||||||||||||
.for _lang in ${LANGUAGES:S|,| |g} | .for _lang in ${LANGUAGES:S|,| |g} | |||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang}/articles | rm -fr ${.CURDIR}/public/${_lang}/articles | |||||||||||||||||||||
.if !exists(${.CURDIR}/public/${_lang}/books) | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang} | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
@if [ -d ${.CURDIR}/public/ ]; then \ | ||||||||||||||||||||||
if [ -z "`ls -A ${.CURDIR}/public/`" ]; then \ | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public; \ | ||||||||||||||||||||||
fi; \ | ||||||||||||||||||||||
fi | ||||||||||||||||||||||
# | ||||||||||||||||||||||
# HTML targets | ||||||||||||||||||||||
# Use DOC_LANG to choose the language, e.g., make DOC_LANG="en,fr" html-books | ||||||||||||||||||||||
# | ||||||||||||||||||||||
html: html-articles html-books | ||||||||||||||||||||||
html-books-target: | ||||||||||||||||||||||
.for _lang in ${LANGUAGES:S|,| |g} | ||||||||||||||||||||||
.if exists(${.CURDIR}/content/${_lang}/books/) | ||||||||||||||||||||||
TMPH += ${.CURDIR}/content/${_lang}/books/*/ | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
BOOKSDIR != echo ${TMPH} | ||||||||||||||||||||||
html-articles-target: | ||||||||||||||||||||||
.for _lang in ${LANGUAGES:S|,| |g} | ||||||||||||||||||||||
.if exists(${.CURDIR}/content/${_lang}/articles/) | ||||||||||||||||||||||
TTMPH += ${.CURDIR}/content/${_lang}/articles/*/ | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
ARTICLESDIR != echo ${TTMPH} | ||||||||||||||||||||||
html-books: html-books-target generate-books-toc | ||||||||||||||||||||||
# Books build | ||||||||||||||||||||||
# | ||||||||||||||||||||||
.for _curhtml in ${BOOKSDIR} | ||||||||||||||||||||||
@mkdir -p ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||} | ||||||||||||||||||||||
.if exists(${_curhtml}book.adoc) | ||||||||||||||||||||||
${ASCIIDOCTOR_CMD} \ | ||||||||||||||||||||||
-B ${.CURDIR}/ \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/git-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/packages-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/inter-document-references-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/sectnumoffset-treeprocessor.rb \ | ||||||||||||||||||||||
--doctype=book \ | ||||||||||||||||||||||
-a skip-front-matter \ | ||||||||||||||||||||||
-o ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}book.html \ | ||||||||||||||||||||||
${_curhtml}book.adoc | ||||||||||||||||||||||
.if exists(${.CURDIR}/static/images/books/${_curhtml:H:T}) | ||||||||||||||||||||||
@mkdir -p ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/books/ | ||||||||||||||||||||||
cp -R ${.CURDIR}/static/images/books/${_curhtml:H:T}/ \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/books/${_curhtml:H:T}/ | ||||||||||||||||||||||
${SED_CMD} -i '' -e "s|../../../../images|../../images|g" \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}book.html | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.else | ||||||||||||||||||||||
# some books use _index.adoc as main document | ||||||||||||||||||||||
${ASCIIDOCTOR_CMD} \ | ||||||||||||||||||||||
-B ${.CURDIR}/ \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/git-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/packages-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/inter-document-references-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/sectnumoffset-treeprocessor.rb \ | ||||||||||||||||||||||
--doctype=book \ | ||||||||||||||||||||||
-a skip-front-matter \ | ||||||||||||||||||||||
-o ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}book.html \ | ||||||||||||||||||||||
${_curhtml}_index.adoc | ||||||||||||||||||||||
.if exists(${.CURDIR}/static/images/books/${_curhtml:H:T}) | ||||||||||||||||||||||
@mkdir -p ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/books/ | ||||||||||||||||||||||
cp -R ${.CURDIR}/static/images/books/${_curhtml:H:T}/ \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/books/${_curhtml:H:T}/ | ||||||||||||||||||||||
${SED_CMD} -i '' -e "s|../../../../images|../../images|g" \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}book.html | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
html-articles: html-articles-target | ||||||||||||||||||||||
# Articles build | ||||||||||||||||||||||
.for _curhtml in ${ARTICLESDIR} | ||||||||||||||||||||||
@mkdir -p ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||} | ||||||||||||||||||||||
${ASCIIDOCTOR_CMD} \ | ||||||||||||||||||||||
-B ${.CURDIR}/ \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/man-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/git-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/packages-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/inter-document-references-macro.rb \ | ||||||||||||||||||||||
-r ./shared/lib/sectnumoffset-treeprocessor.rb \ | ||||||||||||||||||||||
--doctype=article \ | ||||||||||||||||||||||
-a skip-front-matter \ | ||||||||||||||||||||||
-o ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}article.html \ | ||||||||||||||||||||||
${_curhtml}_index.adoc | ||||||||||||||||||||||
.if exists(${.CURDIR}/static/source/articles/${_curhtml:H:T}) | ||||||||||||||||||||||
cp -R ${.CURDIR}/static/source/articles/${_curhtml:H:T}/ \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||} | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.if exists(${.CURDIR}/static/images/articles/${_curhtml:H:T}) | ||||||||||||||||||||||
@mkdir -p ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/articles/ | ||||||||||||||||||||||
cp -R ${.CURDIR}/static/images/articles/${_curhtml:H:T}/ \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||:H:H:H}/images/articles/${_curhtml:H:T}/ | ||||||||||||||||||||||
${SED_CMD} -i '' -e "s|../../../images|../../images|g" \ | ||||||||||||||||||||||
${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}article.html | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
html-clean: html-articles-clean html-books-clean | ||||||||||||||||||||||
html-books-clean: html-books-target | ||||||||||||||||||||||
.for _curhtml in ${BOOKSDIR} | ||||||||||||||||||||||
rm -f ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}book.html ${_curhtml}toc*.adoc | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||} | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
.for _lang in ${LANGUAGES:S|,| |g} | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang}/books | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang}/images/books | ||||||||||||||||||||||
.if !exists(${.CURDIR}/public/${_lang}/articles) | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang} | ||||||||||||||||||||||
.endif | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
@if [ -d ${.CURDIR}/public/ ]; then \ | ||||||||||||||||||||||
if [ -z "`ls -A ${.CURDIR}/public/`" ]; then \ | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public; \ | ||||||||||||||||||||||
fi; \ | ||||||||||||||||||||||
fi | ||||||||||||||||||||||
html-articles-clean: html-articles-target | ||||||||||||||||||||||
.for _curhtml in ${ARTICLESDIR} | ||||||||||||||||||||||
rm -f ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||}article.html | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public${_curhtml:S|^${.CURDIR}/content||} | ||||||||||||||||||||||
.endfor | ||||||||||||||||||||||
.for _lang in ${LANGUAGES:S|,| |g} | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang}/articles | ||||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang}/images/articles | ||||||||||||||||||||||
.if !exists(${.CURDIR}/public/${_lang}/books) | .if !exists(${.CURDIR}/public/${_lang}/books) | |||||||||||||||||||||
rm -fr ${.CURDIR}/public/${_lang} | rm -fr ${.CURDIR}/public/${_lang} | |||||||||||||||||||||
.endif | .endif | |||||||||||||||||||||
.endfor | .endfor | |||||||||||||||||||||
@if [ -d ${.CURDIR}/public/ ]; then \ | @if [ -d ${.CURDIR}/public/ ]; then \ | |||||||||||||||||||||
if [ -z "`ls -A ${.CURDIR}/public/`" ]; then \ | if [ -z "`ls -A ${.CURDIR}/public/`" ]; then \ | |||||||||||||||||||||
rm -fr ${.CURDIR}/public; \ | rm -fr ${.CURDIR}/public; \ | |||||||||||||||||||||
fi; \ | fi; \ | |||||||||||||||||||||
fi | fi |
Apologies - this is my bug but this should read "with only articles" rather than "without articles".