aboutsummaryrefslogtreecommitdiff
path: root/Makefile.bookup
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.bookup')
-rw-r--r--Makefile.bookup32
1 files changed, 18 insertions, 14 deletions
diff --git a/Makefile.bookup b/Makefile.bookup
index 7eb93e8..327558a 100644
--- a/Makefile.bookup
+++ b/Makefile.bookup
@@ -17,6 +17,9 @@ PROJECT ?= bookup
# Output file names (prefix)
OUTPUT ?= book
+# Output folder
+OUTPUT_FOLDER ?= $(OUTPUT)
+
# Destination website hostname (for rsync+ssh)
WEBSITE ?= $(PROJECT)
@@ -101,8 +104,9 @@ compile_book: metadata
@/bin/bash -c 'cat _biblio.yml >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md'
@/bin/bash -c 'for file in $(BOOKUP)/structure/00*.yml; do cat $$file >> $(OUTPUT).md ; echo "---" >> $(OUTPUT).md; done'
@/bin/bash -c 'for file in $(BOOKUP)/structure/00*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
- @/bin/bash -c 'for file in content/published/*/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
- @/bin/bash -c 'for file in content/published/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @#/bin/bash -c 'for file in content/sections/*/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @#/bin/bash -c 'for file in content/sections/*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
+ @/bin/bash -c 'find content/sections -type f | sort | while read file; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md ; cat $(BOOKUP)/templates/references.md >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
@/bin/bash -c 'for file in $(BOOKUP)/structure/99*.md; do cat $$file >> $(OUTPUT).md ; echo "" >> $(OUTPUT).md; done'
@sed -i -e "s|%%revision%%|$(REVISION)|g" -e "s|%%date%%|$(DATE)|g" $(OUTPUT).md
@test -e snippets/terminology.sed && sed -i -f snippets/terminology.sed $(OUTPUT).md || true
@@ -131,7 +135,7 @@ bookdown_html:
# Cleanup
@#rm -rf $(OUTPUT)/html $(OUTPUT)/$(OUTPUT).html
- @rm -rf compiled
+ @rm -rf $(OUTPUT_FOLDER)
# Fix references
# Use sed to fix a weird reference issue on fig.cap inside knitr blocks that are not properly converted.
@@ -151,23 +155,23 @@ bookdown_html:
#@cd _book && ln -s "inĂ­cio.html" index.html
@#mv _book $(OUTPUT)/html
@#mv index.html.old index.html
- @mv _book compiled
+ @mv _book $(OUTPUT_FOLDER)
# Replace fuse.js from CDN to local
# This ensures the HTML output can be browsed offline
#@find $(OUTPUT)/html -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|../../vendor/Fuse.js/dist/fuse.min.js|' {} \;
- @mkdir compiled/js
- @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js compiled/js
- @find compiled -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \;
+ @mkdir $(OUTPUT_FOLDER)/js
+ @cp vendor/bookup/vendor/Fuse.js/dist/fuse.min.js $(OUTPUT_FOLDER)/js
+ @find $(OUTPUT_FOLDER) -name *.html -exec sed -i -e 's|https://cdn.jsdelivr.net/npm/fuse.js@[^"]*|js/fuse.min.js|' {} \;
# Add revision information
- @echo $(REVISION) > compiled/revision
+ @echo $(REVISION) > $(OUTPUT_FOLDER)/revision
# Add symlink to the archive and to the slides
# This symlink is useful for checking things in localhost
# But it tends to be replaced during remote deployment
- @cd compiled > /dev/null && ln -s ../archive
- @cd compiled > /dev/null && ln -s ../slides
+ @cd $(OUTPUT_FOLDER) > /dev/null && ln -s ../archive
+ @cd $(OUTPUT_FOLDER) > /dev/null && ln -s ../slides
bookdown_pdf:
# Cleanup old builds
@@ -179,7 +183,7 @@ bookdown_pdf:
# Move
@#mv _main.pdf $(OUTPUT).pdf
@#mv _book/_main.pdf $(OUTPUT)/$(OUTPUT).pdf
- @mv _book/_main.pdf compiled/$(OUTPUT).pdf
+ @mv _book/_main.pdf $(OUTPUT_FOLDER)/$(OUTPUT).pdf
# Use sed to convert tufte::margin_note to marginfigure
# Also, "sed -i" yields a permission denied error when running inside a guest VM.
@@ -195,7 +199,7 @@ bookdown_epub:
# Move
@##mv _book/_main.epub $(OUTPUT)/$(OUTPUT).epub
- @#mv _book/_main.epub compiled/$(OUTPUT)s.epub
+ @#mv _book/_main.epub $(OUTPUT_FOLDER)/$(OUTPUT)s.epub
# Cleanup
@#rm _book/reference-keys.txt
@@ -208,7 +212,7 @@ bookdown: bookdown_clean bookdown_html bookdown_pdf bookdown_epub
#
move_book:
- @mv $(OUTPUT).* compiled/
+ @mv $(OUTPUT).* $(OUTPUT_FOLDER)/
assemble:
@$(BOOKUP)/bin/assemble
@@ -260,7 +264,7 @@ site:
#
web_deploy:
- @rsync -avz --delete $(EXCLUDES) ./public/ $(WEBSITE):/
+ @rsync -avz --delete $(EXCLUDES) ./build/ $(WEBSITE):/
@rsync -avz --delete ./archive/ $(WEBSITE):/archive/
@rsync -avz --delete ./slides/ $(WEBSITE):/slides/