summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/halloweenmath/Makefile
blob: 14862e19a65b6a4acf98047998442d41f4e77a6f (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# makefile
#
# 2017 Apr 25
#
# Macro definitions
#
# - parameters:
ROOT_NAME	= halloweenmath
#   (the following need not be redefined, although it can be)
BUNDLE_NAME	= $(ROOT_NAME) package
#
# - all the rest:
DTX_NAME	= $(ROOT_NAME).dtx
INS_NAME	= $(ROOT_NAME).ins
LOG_FILE	= $(ROOT_NAME).log
DOC_AUX_FIL	= $(LOG_FILE) $(ROOT_NAME).aux \
				$(ROOT_NAME).glo $(ROOT_NAME).gls \
				$(ROOT_NAME).idx $(ROOT_NAME).ind \
				$(ROOT_NAME).ilg $(ROOT_NAME).glg \
				$(ROOT_NAME).toc $(ROOT_NAME).lof \
				$(ROOT_NAME).hd  $(ROOT_NAME).out
DOCUM_FILE	= $(ROOT_NAME).pdf
CODE_FILES	= $(ROOT_NAME).sty
#
LATEX		= pdflatex
MAKEINDEX	= makeindex
REMOVE		= -rm

#
define GEN_FAKE_INDEX
	@echo '\\begin{theindex}' > $(ROOT_NAME).ind
	@echo '\\end{theindex}'  >> $(ROOT_NAME).ind
	@echo "Generating fake .ind file."
endef
#
define GEN_FAKE_GLOSSARY
	@echo '\\begin{theglossary}' > $(ROOT_NAME).gls
	@echo '\\end{theglossary}'  >> $(ROOT_NAME).gls
	@echo "Generating fake .gls file."
endef



.PHONY: default
.PHONY: code doc
.PHONY: clean cleandoc cleanaux cleancode cleanlog cleanall
.PHONY: help

# Default target
default: doc code

# Generating the code
################################################################
#                                                              #
#   PLEASE NOTE THAT THE INSTALLER SCRIPT IS EXECUTED WITH     #
#       openout_any=r                                          #
#                                                              #
################################################################
code:
	openout_any=r tex $(INS_NAME)

# Generating the documentation
doc: $(DOCUM_FILE)

$(DOCUM_FILE): $(DTX_NAME)
# Hack for getting index and glossary in the toc since first run:
	$(GEN_FAKE_INDEX)
	$(GEN_FAKE_GLOSSARY)
# We know how many runs are needed:
	$(LATEX) $(DTX_NAME)
	$(LATEX) $(DTX_NAME)
	$(MAKEINDEX) -s gind.ist -t $(ROOT_NAME).ilg -o $(ROOT_NAME).ind \
			$(ROOT_NAME).idx
	$(MAKEINDEX) -s gglo.ist -t $(ROOT_NAME).glg -o $(ROOT_NAME).gls \
			$(ROOT_NAME).glo
	$(LATEX) $(DTX_NAME)
	$(LATEX) $(DTX_NAME)
# Hyperlinks in the indexes seem not to work properly without the
# following additional run:
	$(MAKEINDEX) -s gind.ist -t $(ROOT_NAME).ilg -o $(ROOT_NAME).ind \
			$(ROOT_NAME).idx
	$(MAKEINDEX) -s gglo.ist -t $(ROOT_NAME).glg -o $(ROOT_NAME).gls \
			$(ROOT_NAME).glo
	$(LATEX) $(DTX_NAME)

# Cleaning up: command "make clean" defaults to "make cleanall"
clean: cleanall

# Cleaning the code files
cleancode:
	$(REMOVE) $(CODE_FILES)

# Cleaning the documentation files
cleandoc: cleanaux
	$(REMOVE) $(DOCUM_FILE)

# Cleaning just the auxiliary files used in producing the documentation
cleanaux:
	$(REMOVE) $(DOC_AUX_FIL)

# Cleaning only the transcript file (e.g., after "make code")
cleanlog:
	$(REMOVE) $(LOG_FILE)

# Cleaning up all the generated files
cleanall: cleancode cleandoc

# Giving help
help:
	@echo "Here is a list of the available commands:"
	@echo
	@echo "  make"
	@echo "    Generate both the code and the documentation (see below)."
	@echo
	@echo "  make code"
	@echo "    Generate all the LaTeX \"executables\" (e.g., \`.sty' files)"
	@echo "    of the $(BUNDLE_NAME);"
	@echo "    these files go into the LaTeX input directories."
	@echo
	@echo "  make doc"
	@echo "    Generate the documentation (in PDF); the resulting PDF file"
	@echo "    goes into the LaTeX documentation directories (the auxiliary"
	@echo "    files may be discarded)."
	@echo
	@echo "  make clean"
	@echo "  make cleanall"
	@echo "    These two commands are synonyms; they remove all of the"
	@echo "    generated files (both code and documentation)."
	@echo
	@echo "  make cleancode"
	@echo "    Remove the LaTeX source files (the \"code files\")."
	@echo
	@echo "  make cleandoc"
	@echo "    Remove the documentation, together with all the auxiliary"
	@echo "    files used to generate it."
	@echo
	@echo "  make cleanaux"
	@echo "    Remove only the auxiliary files used to generate the"
	@echo "    documentation."
	@echo
	@echo "  make cleanlog"
	@echo "    Remove just the transcript file (e.g., after \"make doc\")."
	@echo
	@echo "  make help"
	@echo "    Print this help message."
	@echo