summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/archaeologie/Makefile
blob: 74ccd0fd0a97bde6c3c17bc2cda777df8ea5cc16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
MAKE  = make
PROJECT = $(PFX)$(NAME)
NAME  = archaeologie
NAMEtypeout = $(CYAN)*** $(NAME) ***$(NC)
BIB   = $(NAME)
PFX   = biblatex-
SHELL = bash
PWD   = $(shell pwd)
TEMP := $(shell mktemp -d -t tmp.XXXXXXXXXX)
TDIR  = $(TEMP)/$(NAME)
VERS  = $(shell /bin/date "+%Y-%m-%d---%H-%M-%S")
LOCAL = $(shell kpsewhich --var-value TEXMFLOCAL)
# Colors
RED   = \033[0;31m
CYAN  = \033[0;36m
NC    = \033[0m
echoPROJECT = @echo -e "$(CYAN) <$(PROJECT)>$(RED)"

.PHONY:  all clean cleanall zip install uninstall files
# Just create the PDF
all: $(NAME).pdf
	@echo -e 	$(echoPROJECT) "* everything is up to date * $(NC)"
	@exit 0

# How to create the PDF
$(NAME).pdf: $(NAME).dtx
	latexmk  -lualatex -f $(NAME).dtx

# just create the files without pdf
files: $(NAME).ins
	latex $(NAME).ins

$(NAME).ins:
	lualatex $(NAME).dtx

# clean all temporary files
clean:
	rm -f {$(NAME),$(BIB)}.{sectionbibs.aux,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 $(NAME).markdown.{in,lua,out}
	rm -f *.{log,aux}
	rm -rf _markdown_*
	$(echoPROJECT) "* cleaned temp files * $(NC)"


# clean all files
cleanbundle: clean
	rm -f *.{{b,c,d,l}bx,ins,pdf,zip,bib}
	$(echoPROJECT) "* cleaned all files * $(NC)"


# zip files up for sending etc.
ctan: all
	rm -f $(NAME)*.zip
	mkdir $(TDIR)
	cp $(NAME).{dtx,pdf} README.md Makefile $(TDIR)
	cd $(TEMP); zip -Drq $(PWD)/$(NAME)-$(VERS).zip $(NAME)
	$(echoPROJECT) "* files zipped * $(NC)"

# install in your local TEX folder
install: all
	sudo mkdir -p $(LOCAL)/{tex,source,doc}/latex/$(PFX)$(NAME)
	sudo mkdir -p $(LOCAL)/bibtex/bib/$(PFX)$(NAME)
	sudo cp $(NAME).{dtx,ins} $(LOCAL)/source/latex/$(PFX)$(NAME)
	sudo cp $(BIB).{b,c,d}bx {english,german,italian,french,spanish}-$(NAME).lbx $(LOCAL)/tex/latex/$(PFX)$(NAME)
	sudo cp $(NAME).pdf $(LOCAL)/doc/latex/$(PFX)$(NAME)
	sudo cp $(NAME)-*.bib $(LOCAL)/bibtex/bib/$(PFX)$(NAME)
	sudo mktexlsr
	$(echoPROJECT) "* all files installed * $(NC)"


uninstall:
	sudo rm -r $(LOCAL)/{tex,source,doc}/latex/$(PFX)$(NAME)
	sudo rm -r $(LOCAL)/bibtex/bib/$(PFX)$(NAME)
	sudo mktexlsr
	$(echoPROJECT) "* all files uninstalled * $(NC)"