summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/skrapport/Makefile
blob: 85553f9331014826ceeca357aa5bd64a7b26b150 (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
76
77
78
79
80
ZIP_NOATTRS :=
ifeq ($(shell uname -s),Darwin)
	ZIP_NOATTRS += -X
endif

TAR_NOATTRS :=
ifeq ($(shell uname -s),Darwin)
	TAR_NOATTRS += --disable-copyfile
endif

TEXMFHOME ?= $(shell kpsewhich -var-value TEXMFHOME)
.PHONY: all clean distclean install dist test clean-test
all: skrapport.tex skrapport.pdf skrapport.cls README
clean: clean-test
	rm -f *.gl? *.id? *.aux # problematic files
	rm -f *.bbl *.bcf *.bib *.blg *.xdy # biblatex
	rm -f *.fls *.log *.out *.run.xml *.toc # junk
distclean: clean
	rm -f *.cls *.sty *.clo *.tar.gz *.tds.zip README
	git reset --hard

%.pdf: %.tex %.cls
	makeglossaries $*
	biber $*
	pdflatex -interaction=nonstopmode -halt-on-error $<
	makeglossaries $*
	pdflatex -interaction=nonstopmode -halt-on-error $<

%.cls: %.tex
	pdflatex -interaction=nonstopmode -halt-on-error $<

%.sty: skrapport.cls

%.clo: skrapport.cls

README: README.md
	sed -e '1,4d;$$d' $< > $@

install: all
	install -m 0644 skrapport-*.sty $(TEXMFHOME)/tex/latex/skrapport/
	install -m 0644 skrapport-*.clo $(TEXMFHOME)/tex/latex/skrapport/
	install -m 0644 skrapport.cls $(TEXMFHOME)/tex/latex/skrapport/skrapport.cls
	install -m 0644 skrapport.pdf $(TEXMFHOME)/doc/latex/skrapport/skrapport.pdf
	install -m 0644 skrapport.tex $(TEXMFHOME)/source/latex/skrapport/skrapport.tex
	install -m 0644 README $(TEXMFHOME)/doc/latex/skrapport/README
	-mktexlsr

skrapport.tds.zip: all
	mkdir -p skrapport/tex/latex/skrapport
	cp skrapport-*.sty skrapport/tex/latex/skrapport/
	cp skrapport-*.clo skrapport/tex/latex/skrapport/
	cp skrapport.cls skrapport/tex/latex/skrapport/skrapport.cls
	mkdir -p skrapport/doc/latex/skrapport
	cp skrapport.pdf skrapport/doc/latex/skrapport/skrapport.pdf
	mkdir -p skrapport/source/latex/skrapport
	cp skrapport.tex skrapport/source/latex/skrapport/skrapport.tex
	cp README skrapport/doc/latex/skrapport/README
	cd skrapport && zip $(ZIP_NOATTRS) -r ../skrapport.tds.zip *
	rm -rf skrapport

skrapport.tar.gz: all skrapport.tds.zip
	mkdir -p skrapport
	cp skrapport.tex skrapport/skrapport.tex
	cp skrapport.pdf skrapport/skrapport.pdf
	cp README skrapport/README
	cp Makefile skrapport/Makefile
	tar $(TAR_NOATTRS) -czf $@ skrapport skrapport.tds.zip
	rm -rf skrapport

dist: skrapport.tar.gz

test:
	cp -f skrapport-*.sty tests/
	cp -f skrapport-*.clo tests/
	$(MAKE) -C tests

clean-test:
	$(MAKE) -C tests clean
	rm -rf tests/skrapport-*.sty
	rm -rf tests/skrapport-*.clo