prepare for tultemplategen bundling

This commit is contained in:
2025-10-07 21:54:18 +02:00
parent 6850224e84
commit f7737687db
7 changed files with 67 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
.PHONY: view_example
view_example: documentation.pdf
.PHONY: view_documentation
view_documentation: documentation.pdf
xdg-open $<
.PHONY: watch_documentation
@@ -7,12 +7,12 @@ watch_documentation:
typst watch --font-path template/fonts documentation.typ & xdg-open documentation.pdf
.PHONY: watch_bp_cs
watch_bp_cs:
typst watch --root . --font-path template/fonts theses/bp_cs/bp.typ bp.pdf & xdg-open bp.pdf
watch_bp_cs: bp.pdf
xdg-open bp.pdf & typst watch --root . --font-path template/fonts theses/bp.typ bp.pdf
.PHONY: watch_dp_cs
watch_dp_cs:
typst watch --root . --font-path template/fonts theses/dp_cs/dp.typ dp.pdf & xdg-open dp.pdf
watch_dp_cs: dp.pdf
xdg-open dp.pdf & typst watch --root . --font-path template/fonts theses/dp.typ dp.pdf
.PHONY: documentation
documentation: documentation.pdf
@@ -21,7 +21,8 @@ PACKDIR := pack/tultemplate2
BUNDLEDIR := pack/bundle
TO_PACK := $(shell find template -type f) template/LICENSE
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/Makefile
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp.typ \
$(BUNDLEDIR)/dp.typ $(BUNDLEDIR)/Makefile
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib
@@ -30,11 +31,12 @@ pack: pack/tultemplate2.zip
.PHONY: bundle
bundle: $(BUNDLE_TARGETS)
@echo "!! Bundles are made for tultemplategen and not for direct use !!"
.PHONY: clean
clean:
rm -rf pack
rm -f documentation.pdf
rm -f documentation.pdf bp.pdf dp.pdf
pack/tultemplate2.zip: $(PACK_TARGETS)
@mkdir -p $(@D)
@@ -49,6 +51,14 @@ $(BUNDLEDIR)/citations.bib:
@mkdir -p $(@D)
touch $@
$(BUNDLEDIR)/bp.typ: theses/bp.typ
@mkdir -p $(@D)
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< | sed 's/\.\.\/template\//template\//' > $@
$(BUNDLEDIR)/dp.typ: theses/dp.typ
@mkdir -p $(@D)
awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' $< | sed 's/\.\.\/template\//template\//' > $@
$(BUNDLEDIR)/Makefile: templategen.mk
@mkdir -p $(@D)
ln -f $< $@
@@ -61,7 +71,11 @@ $(BUNDLEDIR)/template/LICENSE: LICENSE
@mkdir -p $(@D)
ln -f $< $@
$(PACKDIR)/template/tul_citace.csl $(BUNDLEDIR)/template/tul_citace.csl: template/tul_citace.csl
$(PACKDIR)/template/tul_citace.csl: template/tul_citace.csl
@mkdir -p $(@D)
cat $< | sed 's/^\s*\(.*\)$$/\1/' | tr -d '\n' > $@
$(BUNDLEDIR)/template/tul_citace.csl: template/tul_citace.csl
@mkdir -p $(@D)
cat $< | sed 's/^\s*\(.*\)$$/\1/' | tr -d '\n' > $@
@@ -83,6 +97,12 @@ $(BUNDLEDIR)/template/%: template/%
TEMPLATE_SRCS := $(shell find template -type f)
bp.pdf: theses/bp.typ
typst compile --font-path template/fonts --root . $< $@
dp.pdf: theses/dp.typ
typst compile --font-path template/fonts --root . $< $@
documentation.pdf: documentation.typ $(TEMPLATE_SRCS)
typst compile --font-path template/fonts $<