diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/hu-berlin-bundle/makefile')
-rw-r--r-- | Master/texmf-dist/doc/latex/hu-berlin-bundle/makefile | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/hu-berlin-bundle/makefile b/Master/texmf-dist/doc/latex/hu-berlin-bundle/makefile new file mode 100644 index 00000000000..9b1f7675bb0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/hu-berlin-bundle/makefile @@ -0,0 +1,121 @@ +PROJECT:=hu-berlin-bundle +SHELL = bash +MAKE = make +CTANBIB = $(PROJECT)-ctan.bib +PKG = $(shell cat $(PROJECT).pkglist) +CTAN = ctanbib $$pkg >> $(CTANBIB) && echo "... $$pkg" +# install +LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL) +# zip +PWD = $(shell pwd) +TEMP := $(shell mktemp -d -t tmp.XXXXXXXXXX) +TDIR = $(TEMP)/$(PROJECT) +VERS = $(shell /bin/date "+%Y-%m-%d---%H-%M-%S") +DATE = $(shell /bin/date "+%Y-%m-%d") +# Colors +RED = \033[0;31m +CYAN = \033[0;36m +NC = \033[0m +echoPROJECT = @echo -e "$(CYAN) <$(PROJECT)>$(RED)" + + + +.PHONY: test + +all: doc + + + +examples: files + $(MAKE) letter + $(MAKE) md2pdf-letter + +md2pdf-letter: files + pandoc --pdf-engine=lualatex --template hu-berlin-letter-template.latex -o hu-berlin-letter-markdown.pdf hu-berlin-letter.md + +letter: files + latexmk -lualatex -interaction=nonstopmode hu-berlin-letter.tex + +# How to get information from CTAN +CTAN: $(PROJECT).pkglist + @for pkg in $(PKG);\ + do \ + $(CTAN); \ + done + +# before we retrieve infos from CTAN +# we clean and sort the list with packages +getCTAN: $(PROJECT).pkglist + $(echoPROJECT) "$(RED)Retrieving$(NC) information from CTAN." + $(echoPROJECT) "Fetching information from CTAN about package...$(NC)" + @-rm $(CTANBIB) + $(shell sort -u $(PROJECT).pkglist > $(TEMP)/pkg1.lst) + mv $(TEMP)/pkg1.lst $(PROJECT).pkglist + $(MAKE) CTAN + +$(PROJECT).pkglist: + lualatex $(PROJECT).dtx + +files: $(PROJECT).ins + latex $(PROJECT).ins + $(echoPROJECT) "* source files created * $(NC)" + +$(PROJECT).ins: + latex $(PROJECT).dtx + +doc: files + $(MAKE) $(PROJECT).pdf + # $(MAKE) install + $(MAKE) examples + latexmk -lualatex -f --shell-escape $(PROJECT).dtx + $(echoPROJECT) "* $(PROJECT).pdf created * $(NC)" + @exit 0 + +$(PROJECT).pdf: getCTAN files + $(echoPROJECT) "* creating $(PROJECT).pdf * $(NC)" + latexmk -lualatex -f --shell-escape $(PROJECT).dtx + open $(PROJECT).pdf + $(echoPROJECT) "* $(PROJECT).pdf created * $(NC)" + +# clean all temporary files +clean: + rm -f $(PROJECT).{sectionbibs.aux,fls,pkglist,thm,bibexample,biographies.aux,xdv,aux,mw,bbl,bcf,blg,doc,fdb_latexmk,fls,glo,gls,hd,idx,ilg,ind,listing,log,nav,out,run.xml,snm,synctex.gz,toc,vrb} + rm -f $(PROJECT).markdown.{in,lua,out} + rm -f *.{log,aux,latexmk} + rm -rf _markdown_* + $(echoPROJECT) "* cleaned temp files * $(NC)" + +ctan: $(PROJECT).dtx + $(echoPROJECT) "* start zipping files * $(NC)" + @-mkdir archive + @rm -f archive/$(PROJECT)-$(DATE)*.zip + @mkdir $(TDIR) + @cp $(PROJECT).{dtx,pdf} README.md makefile $(TDIR) + @cp -R img $(TDIR) + @cd $(TEMP); \ + zip -Drq $(PWD)/archive/$(PROJECT)-$(VERS).zip $(PROJECT) + $(echoPROJECT) "* files zipped * $(NC)" + + +# clean all files +cleanbundle: clean + rm -f *.{{b,c,d,l}bx,ins,pdf,zip,bib,sty,cls} + rm -f hu-berlin-letter*.{tex,md,lco,latex} + $(echoPROJECT) "* cleaned all files * $(NC)" + + +install: uninstall + @mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(PROJECT) + @cp $(PROJECT).{dtx,ins} $(LOCAL)/source/latex/$(PROJECT) + @cp hu-berlin-*.cls $(LOCAL)/tex/latex/$(PROJECT) + @cp img/* $(LOCAL)/tex/latex/$(PROJECT) + @cp $(PROJECT).pdf $(LOCAL)/doc/latex/$(PROJECT) + mktexlsr + @cp hu-berlin-*-template.* ~/.pandoc/templates/ + $(echoPROJECT) "* all files installed * $(NC)" + + +uninstall: + @rm -rf $(LOCAL)/{tex,source,doc}/latex/$(PROJECT) + @rm -rf $(LOCAL)/{tex/latex,bibtex/bib}/$(PROJECT) + $(echoPROJECT) "* all files uninstalled * $(NC)" |