Debian Codegraph @

texmf-dist/doc/latex/phfquotetext/pkg.mk

raw
1
2 #
3 # Common useful definitions
4 #
5 LATEX = latex
6
7 PDFLATEX = TEXINPUTS="$$TEXINPUTS:../phfnote" pdflatex
8 PDFLATEXOPTS = -interaction=batchmode
9 PDFLATEXOPTSLAST = -interaction=batchmode --synctex=1
10
11 MAKEINDEX = makeindex
12
13
14 #
15 # Set default PREFIX. This can be overridden with 'make install PREFIX=/installation/directory'
16 #
17 DEFAULT_PREFIX := $(shell kpsewhich -var-value TEXMFHOME)
18 PREFIX ?= $(DEFAULT_PREFIX)
19
20
21 #
22 # package should be set in variable PKG
23 #
24 PKGREADME = README.md
25
26 #
27 # packages may specify additional files in the distribution with this variable
28 # (by default empty)
29 #
30 DIST_ADDITIONAL_FILES ?=
31
32
33 PKGDTX = $(PKG).dtx
34 PKGINS = $(PKG).ins
35 PKGSTY = $(PKG).sty
36 PKGPDF = $(PKG).pdf
37 PKGTDSZIP = $(PKG).tds.zip
38 PKGZIP = $(PKG).zip
39
40
41
42 .PHONY: help sty pdf install install_sty install_doc tdszip dist clean cleanall cleansty cleanaux cleanpdf cleantdszip cleandist
43
44
45 help:
46 @echo "Targets for $(PKG):"
47 @echo "make sty -- generate LaTeX package file $(PKG).sty"
48 @echo "make pdf -- generate pdf documentation"
49 @echo "make install -- install style and documentation files to TEXMF tree"
50 @echo "make install PREFIX=[specify texmf directory]"
51 @echo "make $(PKG).tds.zip -- create TDS.ZIP to include in CTAN upload"
52 @echo "make dist -- create distribution ZIP, ready for upload to CTAN"
53 @echo "make clean -- remove LaTeX auxiliary files"
54 @echo "make cleansty -- remove generated style file"
55 @echo "make cleanpdf -- remove generated pdf documentation"
56 @echo "make cleanall -- remove all generated files, incl. distribution zip"
57
58
59 clean: cleanaux
60
61 cleanall: cleansty cleanaux cleanpdf cleantdszip cleandist
62
63 # ------------------------------------------------
64 # make sty
65 # ------------------------------------------------
66
67 sty: $(PKGSTY)
68
69 $(PKGSTY): $(PKGINS) $(PKGDTX)
70 $(LATEX) $<
71
72 cleansty:
73 @rm -f $(PKGSTY)
74
75 # ------------------------------------------------
76 # make pdf
77 # ------------------------------------------------
78
79 pdf: $(PKG).pdf
80
81 #
82 # fake index & glossary so they get a TOC entry from the beginning, and so the page
83 # numbers in the index are correct.
84 #
85 $(PKG).aux $(PKG).idx $(PKG).glo: $(PKGDTX) $(PKGSTY)
86 DTX=$< ; echo '\\begin{theindex}\\item index here \\end{theindex}' >$${DTX%.dtx}.ind
87 DTX=$< ; echo '\\begin{theglossary}\\item changes here\\end{theglossary}' >$${DTX%.dtx}.gls
88 $(PDFLATEX) $(PDFLATEXOPTS) $<
89 $(PDFLATEX) $(PDFLATEXOPTS) $<
90 $(PDFLATEX) $(PDFLATEXOPTS) $<
91
92 $(PKG).ind: $(PKG).idx
93 $(MAKEINDEX) -s gind.ist -o $@ $<
94
95 $(PKG).gls: $(PKG).glo
96 $(MAKEINDEX) -s gglo.ist -o $@ $<
97
98 # final steps of making the PKG.pdf doc file. At the end, touch the ind and gls files so
99 # that they don't look out-of-date (because the idx and glo files were overwritten again)
100 $(PKGPDF): $(PKGDTX) $(PKG).aux $(PKG).ind $(PKG).gls
101 $(PDFLATEX) $(PDFLATEXOPTS) $<
102 $(PDFLATEX) $(PDFLATEXOPTS) $<
103 $(PDFLATEX) $(PDFLATEXOPTSLAST) $<
104 touch $(PKG).ind $(PKG).gls $(PKG).pdf
105
106
107 cleanaux:
108 @rm -f *.aux *.log *.toc *.glo *.gls *.ind *.idx *.ilg *.out *.bbl *.blg *.synctex.gz *.hd
109
110 cleanpdf:
111 @rm -f $(PKGPDF)
112
113 # ------------------------------------------------
114 # 'make install' partial installation targets
115 # ------------------------------------------------
116
117 #
118 # The install target itself is defined per-package, in case packages want to install more
119 # files (such as bibtex styles)
120 #
121
122 install_sty: $(PKGSTY)
123 mkdir -p $(DESTDIR)$(PREFIX)/tex/latex/$(PKG)
124 cp $(PKGSTY) $(DESTDIR)$(PREFIX)/tex/latex/$(PKG)
125
126 install_doc: $(PKGPDF)
127 mkdir -p $(DESTDIR)$(PREFIX)/doc/latex/$(PKG)
128 cp $(PKGPDF) $(PKGREADME) $(DESTDIR)$(PREFIX)/doc/latex/$(PKG)
129
130
131
132 # ------------------------------------------------
133 # make tdszip
134 # ------------------------------------------------
135
136 TDSTMPDIR = $(CURDIR)/_install_tds_zip.make.tmp
137
138 tdszip: $(PKGTDSZIP)
139
140 $(PKGTDSZIP): $(PKGSTY) $(PKGPDF)
141 mkdir $(TDSTMPDIR)
142 $(MAKE) install PREFIX=$(TDSTMPDIR)
143 cd $(TDSTMPDIR) && zip -r $(CURDIR)/$(PKGTDSZIP) *
144 rm -rf $(TDSTMPDIR)
145
146 cleantdszip:
147 @rm -f $(PKGTDSZIP)
148
149
150 # ------------------------------------------------
151 # make dist
152 # ------------------------------------------------
153
154 DISTTMPDIR = $(CURDIR)/_install_dist_zip.make.tmp
155
156 dist: $(PKGZIP)
157
158 $(PKGZIP): $(PKGTDSZIP)
159 rm -rf $(DISTTMPDIR)
160 mkdir -p $(DISTTMPDIR)/$(PKG)
161 cp $(PKGTDSZIP) $(DISTTMPDIR)
162 cp $(PKGDTX) $(PKGINS) $(PKGPDF) $(PKGREADME) Makefile pkg.mk $(DIST_ADDITIONAL_FILES) $(DISTTMPDIR)/$(PKG)
163 cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKGTDSZIP) $(PKG)
164 rm -rf $(DISTTMPDIR)
165
166 cleandist:
167 @rm -f $(PKGZIP)