summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hitszthesis/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/hitszthesis/Makefile')
-rw-r--r--macros/latex/contrib/hitszthesis/Makefile83
1 files changed, 83 insertions, 0 deletions
diff --git a/macros/latex/contrib/hitszthesis/Makefile b/macros/latex/contrib/hitszthesis/Makefile
new file mode 100644
index 0000000000..ce3df42ab9
--- /dev/null
+++ b/macros/latex/contrib/hitszthesis/Makefile
@@ -0,0 +1,83 @@
+# Makefile for HITSZThesis
+
+PACKAGE = hitszthesis
+THESIS = main
+SPINE = spine
+
+SOURCES = $(PACKAGE).ins $(PACKAGE).dtx
+CLSFILE = dtx-style.sty $(PACKAGE).cls
+
+LATEXMK = latexmk
+
+# make deletion work on Windows
+ifdef SystemRoot
+ RM = del /Q
+else
+ RM = rm -f
+endif
+
+.PHONY: all all-dev clean distclean dist thesis viewthesis spine viewspine doc viewdoc cls check save savepdf test FORCE_MAKE
+
+thesis: $(THESIS).pdf
+
+all: thesis spine
+
+all-dev: doc all
+
+cls: $(CLSFILE)
+
+$(CLSFILE): $(SOURCES)
+ xetex $(PACKAGE).ins
+
+doc: $(PACKAGE).pdf
+
+spine: $(SPINE).pdf
+
+$(PACKAGE).pdf: cls FORCE_MAKE
+ $(LATEXMK) $(PACKAGE).dtx
+
+$(THESIS).pdf: cls FORCE_MAKE
+ $(LATEXMK) $(THESIS)
+
+$(SPINE).pdf: cls FORCE_MAKE
+ $(LATEXMK) $(SPINE)
+
+viewdoc: doc
+ $(LATEXMK) -pv $(PACKAGE).dtx
+
+viewthesis: thesis
+ $(LATEXMK) -pv $(THESIS)
+
+viewspine: spine
+ $(LATEXMK) -pv $(SPINE)
+
+save:
+ bash testfiles/save.sh
+
+savepdf:
+ bash testfiles/save-pdf.sh
+
+test:
+ l3build check
+
+clean:
+ $(LATEXMK) -c $(PACKAGE).dtx $(THESIS) $(SPINE)
+ -@$(RM) *~ main-survey.*
+
+cleanall: clean
+ -@$(RM) $(PACKAGE).pdf $(THESIS).pdf $(SPINE).pdf
+
+distclean: cleanall
+ -@$(RM) $(CLSFILE)
+ -@$(RM) -r dist
+
+check: FORCE_MAKE
+ifeq ($(version),)
+ @echo "Error: version missing: \"make [check|dist] version=X.Y\""; exit 1
+else
+ @[[ $(shell grep -E -c '$(version) A Bachelor Thesis Template for Harbin Institute of Technology, ShenZhen|\\def\\version\{$(version)\}' hitszthesis.dtx) -eq 3 ]] || (echo "update version in hitszthesis.dtx before release"; exit 1)
+ @[[ $(shell grep -E -c '"version": "$(version)"' package.json) -eq 1 ]] || (echo "update version in package.json before release"; exit 1)
+endif
+
+dist: check all-dev
+ npm run build -- --version=$(version) \ No newline at end of file