| 1 |
# Makefile for thucoursework |
| 2 |
|
| 3 |
# Compiling method: xelatex/pdflatex |
| 4 |
PACKAGE = thucoursework |
| 5 |
INSTALL_PACKAGE = install-tl-unx.tar.gz |
| 6 |
INSTALL_DIR = ./install-texlive |
| 7 |
# automatic configuration of mirror |
| 8 |
REMOTE_INSTALLER_URL = http://mirror.ctan.org/systems/texlive/tlnet |
| 9 |
# Set opts for latexmk if you use it |
| 10 |
LATEXMKOPTS = -xelatex -halt-on-error -interaction=nonstopmode |
| 11 |
|
| 12 |
|
| 13 |
.PHONY: doc all archive pre_install_dep install_dep after_install_dep clean test |
| 14 |
|
| 15 |
all: after_install_dep iihw.pdf ithw.pdf |
| 16 |
|
| 17 |
pre_install_dep: $(INSTALL_PACKAGE) |
| 18 |
|
| 19 |
after_install_dep: install_dep |
| 20 |
# tricky, to make variable assignment in recipe, and to execute shell command and assign the print result to a variable. |
| 21 |
$(eval PLATFORM1=`$(INSTALL_DIR)/install-tl --print-platform`) |
| 22 |
$(eval PLATFORM2=$(shell echo $(PLATFORM1))) |
| 23 |
$(eval PLATFORM3=$(shell pwd)) |
| 24 |
$(eval export PATH :=$(PLATFORM3)/texlive/bin/$(PLATFORM2):$(PATH)) |
| 25 |
echo $$PATH |
| 26 |
# to make tlmgr work, we need perl |
| 27 |
tlmgr install xkeyval matlab-prettifier caption doublestroke xcolor listings l3kernel l3packages ms ulem fontspec environ trimspaces booktabs moreenum mathtools oberdiek enumitem fmtcount etoolbox latex-bin alphalph |
| 28 |
install_dep: pre_install_dep |
| 29 |
mkdir -p $(INSTALL_DIR) |
| 30 |
tar -zxvf $(INSTALL_PACKAGE) -C $(INSTALL_DIR) --strip-components 1 |
| 31 |
$(INSTALL_DIR)/install-tl -profile tl.profile |
| 32 |
|
| 33 |
$(INSTALL_PACKAGE): |
| 34 |
wget $(REMOTE_INSTALLER_URL)/$(INSTALL_PACKAGE) |
| 35 |
|
| 36 |
clean: |
| 37 |
rm -fr $(INSTALL_DIR) |
| 38 |
rm -f *.idx *.ilg *.glo *.gls *.hd *.ind *.log *.out *.synctex.gz *.toc *.aux |
| 39 |
|
| 40 |
iihw.pdf: iihw.tex after_install_dep |
| 41 |
pdflatex iihw.tex |
| 42 |
|
| 43 |
ithw.pdf: ithw.tex after_install_dep |
| 44 |
xelatex ithw.tex |
| 45 |
|
| 46 |
archive: |
| 47 |
# make tar.gz which is submitted to ctan.org |
| 48 |
# first copy the necessary files to the dist dir |
| 49 |
cp README.md iihw.pdf ithw.pdf iihw.tex ithw.tex matlabscript.m pdf_normal.pdf thucoursework.dtx thucoursework.pdf Makefile thucoursework/ |
| 50 |
# then tar it |
| 51 |
COPYFILE_DISABLE=1 tar -zcvf thucoursework.tar.gz thucoursework/ |
| 52 |
doc : $(PACKAGE).pdf |
| 53 |
|
| 54 |
$(PACKAGE).pdf : $(PACKAGE).dtx |
| 55 |
#latexmk $(LATEXXMKOPTS) $(PACKAGE).dtx |
| 56 |
xelatex $(PACKAGE).dtx |
| 57 |
makeindex -s gind.ist -o $(PACKAGE).ind $(PACKAGE).idx |
| 58 |
makeindex -s gglo.ist -o $(PACKAGE).gls $(PACKAGE).glo |
| 59 |
xelatex $(PACKAGE).dtx |
| 60 |
xelatex -synctex=1 $(PACKAGE).dtx |
| 61 |
|
| 62 |
test: |
| 63 |
# first clear out root texlive bin dir |
| 64 |
$(eval export PATH := /bin:/usr/bin) |
| 65 |
echo $$PATH |
| 66 |
$(eval PLATFORM1=`$(INSTALL_DIR)/install-tl --print-platform`) |
| 67 |
$(eval PLATFORM2=$(shell echo $(PLATFORM1))) |
| 68 |
$(eval PLATFORM3=$(shell pwd)) |
| 69 |
$(eval export PATH := $(PLATFORM3)/texlive/bin/$(PLATFORM2):$(PATH)) |
| 70 |
echo $$PATH |
| 71 |
tlmgr --version |