add minimal packs to build system
This commit is contained in:
92
Makefile
92
Makefile
@@ -2,23 +2,32 @@ TYPST_PACKAGES ?=
|
|||||||
|
|
||||||
BUILD_DIR := target
|
BUILD_DIR := target
|
||||||
PACKS_ROOT := $(BUILD_DIR)/pack
|
PACKS_ROOT := $(BUILD_DIR)/pack
|
||||||
|
PACKSTAGING := $(PACKS_ROOT)/staging
|
||||||
PACKDIR := $(PACKS_ROOT)/tultemplate2
|
PACKDIR := $(PACKS_ROOT)/tultemplate2
|
||||||
BUNDLEDIR := $(PACKS_ROOT)/bundle
|
BUNDLEDIR := $(PACKS_ROOT)/bundle
|
||||||
|
MINIMALDIR := $(PACKS_ROOT)/minimal
|
||||||
|
|
||||||
LIBDIR := template/lib
|
LIBDIR := template/lib
|
||||||
LIB_MUCHPDFTOOLS := $(LIBDIR)/much_pdf_tools
|
LIB_MUCHPDFTOOLS := $(LIBDIR)/much_pdf_tools
|
||||||
LIB_TARGETS_MUCHPDFTOOLS := lib.typ much_pdf_tools.wasm
|
LIB_TARGETS_MUCHPDFTOOLS := lib.typ much_pdf_tools.wasm
|
||||||
LIB_URL_MUCHPDFTOOLS := https://tulsablona.zumepro.cz/lib/much_pdf_tools
|
LIB_URL_MUCHPDFTOOLS := https://tulsablona.zumepro.cz/lib/much_pdf_tools
|
||||||
|
|
||||||
TEMPLATE_SRCS := $(shell find template -type f) \
|
MINIMAL_ASSET_ROOTS := template/assets template/fonts template/citations
|
||||||
$(LIB_TARGETS_MUCHPDFTOOLS:%=$(LIB_MUCHPDFTOOLS)/%) template/example_appendix.pdf
|
MINIMAL_SRCS := $(shell find template -type f -regex '^.*\.typ$$') \
|
||||||
TO_PACK := $(TEMPLATE_SRCS) template/LICENSE
|
$(shell find $(MINIMAL_ASSET_ROOTS) -type f) \
|
||||||
|
template/lang.json \
|
||||||
|
$(LIB_TARGETS_MUCHPDFTOOLS:%=$(LIB_MUCHPDFTOOLS)/%)
|
||||||
|
TEMPLATE_SRCS := $(MINIMAL_SRCS) template/example_appendix.pdf
|
||||||
|
ADD_TO_PACK := template/LICENSE
|
||||||
|
TO_PACK_MINIMAL := $(MINIMAL_SRCS) $(ADD_TO_PACK)
|
||||||
|
TO_PACK := $(TEMPLATE_SRCS) $(ADD_TO_PACK)
|
||||||
BUNDLE_THESES := bp_cs bp_en dp_cs dp_en prj_cs prj_en sp_cs sp_en presentation_cs presentation_en
|
BUNDLE_THESES := bp_cs bp_en dp_cs dp_en prj_cs prj_en sp_cs sp_en presentation_cs presentation_en
|
||||||
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp_cs.typ \
|
BUNDLE_TARGETS := $(TO_PACK:%=$(BUNDLEDIR)/%) $(BUNDLEDIR)/citations.bib $(BUNDLEDIR)/bp_cs.typ \
|
||||||
$(BUNDLE_THESES:%=$(BUNDLEDIR)/%.typ) $(BUNDLEDIR)/Makefile \
|
$(BUNDLE_THESES:%=$(BUNDLEDIR)/%.typ) $(BUNDLEDIR)/Makefile \
|
||||||
$(BUNDLEDIR)/title-pages.pdf $(BUNDLEDIR)/assignment.pdf
|
$(BUNDLEDIR)/title-pages.pdf $(BUNDLEDIR)/assignment.pdf
|
||||||
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
|
PACK_TARGETS := $(TO_PACK:%=$(PACKDIR)/%) $(PACKDIR)/documentation.typ \
|
||||||
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib $(PACKDIR)/Makefile
|
$(PACKDIR)/documentation.pdf $(PACKDIR)/citations.bib $(PACKDIR)/Makefile
|
||||||
|
MINIMAL_TARGETS := $(TO_PACK_MINIMAL:%=$(MINIMALDIR)/%)
|
||||||
|
|
||||||
# == MAIN TARGETS ==
|
# == MAIN TARGETS ==
|
||||||
|
|
||||||
@@ -35,6 +44,9 @@ pack: $(PACKDIR)/tultemplate2.zip
|
|||||||
bundle: $(BUNDLE_TARGETS)
|
bundle: $(BUNDLE_TARGETS)
|
||||||
@echo "!! Bundles are made for tultemplategen and not for direct use !!"
|
@echo "!! Bundles are made for tultemplategen and not for direct use !!"
|
||||||
|
|
||||||
|
.PHONY: minimal
|
||||||
|
minimal: $(MINIMAL_TARGETS) $(MINIMALDIR)/tultemplate2_minimal.zip
|
||||||
|
|
||||||
.PHONY: watch_documentation
|
.PHONY: watch_documentation
|
||||||
watch_documentation: $(BUILD_DIR)/documentation.pdf
|
watch_documentation: $(BUILD_DIR)/documentation.pdf
|
||||||
xdg-open $< & typst watch --font-path template/fonts documentation.typ $<
|
xdg-open $< & typst watch --font-path template/fonts documentation.typ $<
|
||||||
@@ -59,12 +71,18 @@ $(BUILD_DIR):
|
|||||||
$(PACKS_ROOT): | $(BUILD_DIR)
|
$(PACKS_ROOT): | $(BUILD_DIR)
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
|
$(PACKSTAGING): | $(PACKS_ROOT)
|
||||||
|
mkdir $@
|
||||||
|
|
||||||
$(PACKDIR): | $(PACKS_ROOT)
|
$(PACKDIR): | $(PACKS_ROOT)
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
$(BUNDLEDIR): | $(PACKS_ROOT)
|
$(BUNDLEDIR): | $(PACKS_ROOT)
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
|
$(MINIMALDIR): | $(PACKS_ROOT)
|
||||||
|
mkdir $@
|
||||||
|
|
||||||
# == UTILS ==
|
# == UTILS ==
|
||||||
|
|
||||||
define minify_csl
|
define minify_csl
|
||||||
@@ -136,61 +154,51 @@ $(BUILD_DIR)/%.pdf: $(BUILD_DIR)/%.typ $(TEMPLATE_SRCS) | $(BUILD_DIR)
|
|||||||
template/example_appendix.pdf: theses/example_appendix.typ
|
template/example_appendix.pdf: theses/example_appendix.typ
|
||||||
$(call typst_compile) $< $@
|
$(call typst_compile) $< $@
|
||||||
|
|
||||||
# == PACKS - clean builds for direct use ==
|
# == PACK STAGING - files prepared for packing or bundling ==
|
||||||
|
|
||||||
$(PACKDIR)/%: % | $(PACKDIR)
|
$(PACKSTAGING)/template: | $(PACKSTAGING)
|
||||||
ln -f $< $@
|
|
||||||
|
|
||||||
$(PACKDIR)/template: | $(PACKDIR)
|
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
$(PACKDIR)/template/LICENSE: LICENSE | $(PACKDIR)/template
|
$(PACKSTAGING)/template/citations: | $(PACKSTAGING)/template
|
||||||
|
mkdir $@
|
||||||
|
|
||||||
|
$(PACKSTAGING)/template/LICENSE: LICENSE | $(PACKSTAGING)/template
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
$(PACKDIR)/Makefile: packed.mk | $(PACKDIR)
|
$(PACKSTAGING)/template/citations/%: template/citations/% | $(PACKSTAGING)/template/citations
|
||||||
ln -f $< $@
|
|
||||||
|
|
||||||
$(PACKDIR)/template/tul_citace.csl: template/tul_citace.csl | $(PACKDIR)/template
|
|
||||||
$(call minify_csl,$<,$@)
|
$(call minify_csl,$<,$@)
|
||||||
|
|
||||||
$(PACKDIR)/template/lang.json: template/lang.json | $(PACKDIR)/template
|
$(PACKSTAGING)/template/lang.json: template/lang.json | $(PACKSTAGING)/template
|
||||||
$(call minify_json,$<,$@)
|
$(call minify_json,$<,$@)
|
||||||
|
|
||||||
$(PACKDIR)/template/%: template/% | $(PACKDIR)/template
|
$(PACKSTAGING)/documentation.pdf: $(BUILD_DIR)/documentation.pdf | $(PACKSTAGING)
|
||||||
|
ln -f $< $@
|
||||||
|
|
||||||
|
$(PACKSTAGING)/%.pdf: $(BUILD_DIR)/%.pdf | $(PACKSTAGING)
|
||||||
|
ln -f $< $@
|
||||||
|
|
||||||
|
$(PACKSTAGING)/%: % | $(PACKSTAGING)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
$(PACKDIR)/%.pdf: $(BUILD_DIR)/%.pdf | $(PACKDIR)
|
# == PACKS - clean builds for direct use ==
|
||||||
|
|
||||||
|
$(PACKDIR)/Makefile: packed.mk | $(PACKDIR)
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
$(PACKDIR)/tultemplate2.zip: $(PACK_TARGETS) | $(PACKDIR)
|
$(PACKDIR)/tultemplate2.zip: $(PACK_TARGETS) | $(PACKDIR)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cd $(PACKS_ROOT) && zip -r tultemplate2.zip tultemplate2
|
cd $(PACKS_ROOT) && zip -r tultemplate2.zip tultemplate2
|
||||||
|
|
||||||
|
$(PACKDIR)/%: $(PACKSTAGING)/% | $(PACKDIR)
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
ln -f $< $@
|
||||||
|
|
||||||
# == BUNDLES - packs for tultemplategen ==
|
# == BUNDLES - packs for tultemplategen ==
|
||||||
|
|
||||||
$(BUNDLEDIR)/template: | $(BUNDLEDIR)
|
|
||||||
mkdir $@
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/template/LICENSE: LICENSE | $(BUNDLEDIR)/template
|
|
||||||
ln -f $< $@
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/Makefile: templategen.mk | $(BUNDLEDIR)
|
$(BUNDLEDIR)/Makefile: templategen.mk | $(BUNDLEDIR)
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
$(BUNDLEDIR)/template/tul_citace.csl: template/tul_citace.csl | $(BUNDLEDIR)/template
|
|
||||||
$(call minify_csl,$<,$@)
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/template/lang.json: template/lang.json | $(BUNDLEDIR)/template
|
|
||||||
$(call minify_json,$<,$@)
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/citations.bib: citations.bib | $(BUNDLEDIR)
|
|
||||||
ln -f $< $@
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/template/%: template/% | $(BUNDLEDIR)/template
|
|
||||||
@mkdir -p $(@D)
|
|
||||||
ln -f $< $@
|
|
||||||
|
|
||||||
$(BUNDLEDIR)/presentation_%.typ: theses/presentation_%.typ | $(BUNDLEDIR)
|
$(BUNDLEDIR)/presentation_%.typ: theses/presentation_%.typ | $(BUNDLEDIR)
|
||||||
cat $< | awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' > $@
|
cat $< | awk 'BEGIN{RS=""; ORS="\n\n"} NR>2{print}' > $@
|
||||||
|
|
||||||
@@ -203,6 +211,20 @@ $(BUNDLEDIR)/title-pages.pdf: theses/title_pages.typ | $(BUNDLEDIR)
|
|||||||
$(BUNDLEDIR)/assignment.pdf: theses/assignment.typ | $(BUNDLEDIR)
|
$(BUNDLEDIR)/assignment.pdf: theses/assignment.typ | $(BUNDLEDIR)
|
||||||
$(call typst_compile) $< $@
|
$(call typst_compile) $< $@
|
||||||
|
|
||||||
|
$(BUNDLEDIR)/%: $(PACKSTAGING)/% | $(BUNDLEDIR)
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
ln -f $< $@
|
||||||
|
|
||||||
|
# == MINIMAL - stripped-down template packs ==
|
||||||
|
|
||||||
|
$(MINIMALDIR)/%: $(PACKSTAGING)/% | $(MINIMALDIR)
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
ln -f $< $@
|
||||||
|
|
||||||
|
$(MINIMALDIR)/tultemplate2_minimal.zip: $(MINIMAL_TARGETS) | $(MINIMALDIR)
|
||||||
|
rm -f $@
|
||||||
|
cd $(MINIMALDIR) && zip -r $(notdir $@) template
|
||||||
|
|
||||||
# == TESTS ==
|
# == TESTS ==
|
||||||
|
|
||||||
include tests/make.mk
|
include tests/make.mk
|
||||||
|
|||||||
@@ -109,6 +109,9 @@
|
|||||||
"presentation_cs" "presentation_en"
|
"presentation_cs" "presentation_en"
|
||||||
]) typstPkgs;
|
]) typstPkgs;
|
||||||
packages.pack = build_with_targets "pack" ["pack"] ["target/pack/."] [];
|
packages.pack = build_with_targets "pack" ["pack"] ["target/pack/."] [];
|
||||||
|
packages.minimal = build_with_targets "minimal" ["minimal"] [
|
||||||
|
"target/pack/minimal/."
|
||||||
|
] [];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user