fix: manual latex build with proper build dir
This commit is contained in:
8
Makefile
8
Makefile
@@ -1,6 +1,10 @@
|
||||
PROJDIR := src
|
||||
LEKTOR := lektor --project $(PROJDIR)
|
||||
BUILD_DIR := $$($(LEKTOR) project-info --output-path)
|
||||
RESOLVED_BUILD_DIR := $$( \
|
||||
if [ $$(readlink 'src/content/recipes') == "../../data/distribution/" ]; \
|
||||
then echo "$(PWD)/bin"; \
|
||||
else echo "$(BUILD_DIR)"; fi)
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@@ -73,8 +77,10 @@ deploy:
|
||||
# technically this isnt needed anymore but it simplyfies latex development
|
||||
.PHONY: pdf
|
||||
pdf:
|
||||
@echo
|
||||
@echo 'Generating PDF from tex source ...'
|
||||
@SECONDS=0; \
|
||||
"$(PROJDIR)/_tex-to-pdf/build_manually.sh" \
|
||||
"$(PROJDIR)/_tex-to-pdf/build_manually.sh" "$(RESOLVED_BUILD_DIR)" \
|
||||
&& echo "done. finished after $${SECONDS}s."
|
||||
|
||||
# Helper methods on all recipes
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
BUILD_DIR=$1
|
||||
|
||||
if [ $# != 1 ] || [ ! -d "$BUILD_DIR" ]; then
|
||||
echo "Usage: ${0##*/} path/to/build-dir/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${0%/*}" || exit 1
|
||||
rm -rf out
|
||||
mkdir -p out
|
||||
|
||||
build_dir=$(lektor project-info --output-path)
|
||||
echo "\\\\def\\\\buildDir{$build_dir}" > out/builddir.tex
|
||||
echo "\\\\def\\\\buildDir{$BUILD_DIR}" > out/builddir.tex
|
||||
|
||||
find "$build_dir" -name "*.tex" | while read -r x; do
|
||||
find "$BUILD_DIR" -name "*.tex" | while read -r x; do
|
||||
bname=$(basename "${x%.tex}") # remove extension and parent dir
|
||||
shortname=${x#"$build_dir"}
|
||||
shortname=${x#"$BUILD_DIR"}
|
||||
for i in 1 2; do
|
||||
echo lualatex "$shortname [$i/2]"
|
||||
lualatex --halt-on-error --output-directory out "$x" > /dev/null || exit 13
|
||||
|
||||
Reference in New Issue
Block a user