summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/skdoc/Makefile
blob: d2d1103f27e7cfe2d23c9225653f510764aefee2 (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
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: skdoc.dtx skdoc.cls skdoc.pdf 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

%.cls: %.dtx
	tex $<

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

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

install: all
	install -m 0644 skdoc.cls $(TEXMFHOME)/tex/latex/skdoc/skdoc.cls
	install -m 0644 skdoc.pdf $(TEXMFHOME)/doc/latex/skdoc/skdoc.pdf
	install -m 0644 skdoc.tex $(TEXMFHOME)/source/latex/skdoc/skdoc.dtx
	install -m 0644 README $(TEXMFHOME)/doc/latex/skdoc/README
	-mktexlsr

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

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

dist: skdoc.tar.gz

test:
#	$(MAKE) -C tests

clean-test:
#	$(MAKE) -C tests clean