Skip to content
Snippets Groups Projects
vars 2.21 KiB
Newer Older
  • Learn to ignore specific revisions
  • VERSION != git tag | tail -1
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    QR_TARGET != grep mailto: README.md | cut -d: -f2,3 | tail -c+2
    QR_CODE=\qrcode[height=.2\textwidth]{$(QR_TARGET)}
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    COMPRESS = gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -dPrinted=false -sOutputFile=$@ $<
    
    CP := ln -f
    
    BOOK != basename "$(shell pwd)"
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    TITLE != head -1 README.md | tail -c+3 | tr ' ' '_'
    LOCAL_DROSS := rubbish
    DROSS = ../$(LOCAL_DROSS)
    DBOOK = $(DROSS)/$(BOOK).pdf
    COMPILER = latexmk -file-line-error -output-directory=$(DROSS) -pdflua -interaction=nonstopmode -halt-on-error -shell-escape -r config/.latexmkrc -jobname=$(BOOK)
    RELEASE = $(TITLE).pdf
    GLOS := makeglossaries -d $(DROSS)
    RUN := lualatex -output-directory $(DROSS) -shell-escape
    CLEAN := $(RM) -r $(DROSS) $(LOCAL_DROSS) qr.tex *.pdf .switch-gls svg-inkscape
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    
    $(RELEASE): $(DBOOK)
    	@$(CP) $< $@
    
    
    .PHONY: LOCTEX
    LOCTEX: $(wildcard *.tex)
    
    .PHONY: HANDOUTS
    HANDOUTS: config/CS.tex config/booklet.tex config/fold_front.tex config/fold_back.tex
    
    .PHONY: STYLE_FILES
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    STYLE_FILES: $(wildcard config/*.sty)
    
    
    .PHONY: EXTERNAL
    EXTERNAL: $(wildcard $(DROSS)/*.glg) | $(DROSS)
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    qr.tex: README.md config/vars
    
    	@printf '%s' '\qrcode[height=.2\textwidth]{$(QR_TARGET)}' > qr.tex
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    .switch-gls:
    	@touch .switch-gls
    
    
    
    images/extracted/:
    	mkdir -p $@
    	echo '*' > $@.gitignore
    images/extracted/inclusion.tex: images/extracted/
    
    	printf '%s\n' '\externaldocument{$(BOOK)}' > $@
    
    	printf '%s\n' '\newcommand\bookTitle{$(TITLE)}' | tr '_' ' ' >> $@
    
    $(DROSS):
    	mkdir $(DROSS)
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    check:
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	@command -v git >/dev/null || ( echo install git && exit 1 )
    	@command -v git-lfs >/dev/null || ( echo install git-lfs && exit 1 )
    	@command -v lualatex >/dev/null || ( echo install lualatex && exit 1 )
    	@command -v latexmk >/dev/null || ( echo install latexmk && exit 1 )
    	@command -v inkscape >/dev/null || ( echo install inkscape && exit 1 )
    
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    help:
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	@echo 'BIND version $(VERSION)'
    	@echo ''
    	@echo 'Check you have the requirements with'
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	@echo '$$ make check'
    
    Malin Freeborn's avatar
    Malin Freeborn committed
    	@echo ''
    	@echo 'Compile with'
    	@echo '$$ make'
    	@echo ''
    	@echo 'Required tlmgr packages are in'
    	@echo 'config/Docker/tlmgrDeps.sh'
    	@echo ''
    
    
    graph:
    	make -Bind $(TARG) | make2graph | graph-easy --boxart
    
    
    print_%.pdf: %.pdf
    
    	pdfjam --landscape --paper a3paper --nup 1x1 --signature 12 $< -o $@