# Makefile for ThuThesis # Compiling method: latexmk/xelatex/pdflatex METHOD = xelatex # Set opts for latexmk if you use it LATEXMKOPTS = -xelatex # Basename of thesis THESISMAIN = main PACKAGE=hithesis SOURCES=$(PACKAGE).ins $(PACKAGE).dtx THESISCONTENTS=$(THESISMAIN).tex front/*.tex body/*.tex back/*.tex $(FIGURES) *.bst # NOTE: update this to reflect your local file types. FIGURES=$(wildcard figures/*.eps figures/*.pdf) BIBFILE=*.bib CLSFILES=dtx-style.sty $(PACKAGE).cls $(PACKAGE).ist h$(PACKAGE).cfg # make deletion work on Windows ifdef SystemRoot RM = del /Q OPEN = start else RM = rm -f OPEN = open endif .PHONY: all clean distclean dist thesis viewthesis doc viewdoc cls check FORCE_MAKE all: doc thesis cls: $(CLSFILES) $(CLSFILES): $(SOURCES) latex $(PACKAGE).ins viewdoc: doc $(OPEN) $(PACKAGE).pdf doc: $(PACKAGE).pdf viewthesis: thesis $(OPEN) $(THESISMAIN).pdf thesis: $(THESISMAIN).pdf ifeq ($(METHOD),latexmk) $(PACKAGE).pdf: $(CLSFILES) FORCE_MAKE $(METHOD) $(LATEXMKOPTS) $(PACKAGE).dtx $(THESISMAIN).pdf: $(CLSFILES) FORCE_MAKE $(METHOD) $(LATEXMKOPTS) $(THESISMAIN) else ifneq (,$(filter $(METHOD),xelatex pdflatex)) $(PACKAGE).pdf: $(CLSFILES) $(METHOD) $(PACKAGE).dtx makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo $(METHOD) $(PACKAGE).dtx $(METHOD) $(PACKAGE).dtx $(THESISMAIN).idx: $(THESISMAIN).bbl $(METHOD) $(THESISMAIN) $(METHOD) $(THESISMAIN) $(THESISMAIN)_china.idx : $(CLSFILES) $(THESISMAIN).bbl $(THESISMAIN).idx splitindex $(THESISMAIN) -- -s $(PACKAGE).ist # 自动生成索引 $(THESISMAIN)_english.ind $(THESISMAIN)_china.ind $(THESISMAIN)_english.idx : $(THESISMAIN)_china.idx $(THESISMAIN).pdf: $(CLSFILES) $(THESISCONTENTS) $(THESISMAIN)_china.ind $(THESISMAIN)_china.idx $(THESISMAIN)_english.ind $(THESISMAIN)_english.idx $(THESISMAIN).bbl $(METHOD) $(THESISMAIN) $(THESISMAIN).bbl: $(BIBFILE) $(METHOD) $(THESISMAIN) -bibtex $(THESISMAIN) $(RM) $(THESISMAIN).pdf else $(error Unknown METHOD: $(METHOD)) endif clean: latexmk -c $(PACKAGE).dtx $(THESISMAIN) -@$(RM) *~ *.idx *.ind *.ilg *.thm *.toe *.bbl latexmkrc cleanall: clean -@$(RM) $(PACKAGE).pdf $(THESISMAIN).pdf distclean: cleanall -@$(RM) $(CLSFILES) -@$(RM) -r dist check: FORCE_MAKE ag 'Harbin Institute of Technology Template|\\def\\version|"version":' hithesis.dtx package.json dist: all @if [ -z "$(version)" ]; then \ echo "Usage: make dist version=[x.y.z | ctan]"; \ else \ npm run build -- --version=$(version); \ fi