summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cdpbundl/Makefile
blob: ac43bf40943a9832c493abf54768b278f125b262 (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
# makefile
#
# 2018 Feb 08
#
# Macro definitions
ROOT_NAME	= cdpbundl
DTX_NAME	= $(ROOT_NAME).dtx
INS_NAME	= $(ROOT_NAME).ins
DOC_AUX_FIL	= $(ROOT_NAME).aux $(ROOT_NAME).log \
				$(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	= letteracdp.cls \
				articoletteracdp.cls \
				cdpaddon.sty \
				cdpbabel.sty \
				*.ldf \
				*.def \
				cdpshues.cfg
#
LATEX		= pdflatex
MAKEINDEX	= makeindex

#
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 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)

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

# Cleaning the code files
cleancode:
	-rm $(CODE_FILES)

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

# Cleanng just the auxiliary files used in producing the documentation
cleanaux:
	-rm $(DOC_AUX_FIL)

# 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 the LaTeX sources for all the classes, packages,"
	@echo "    definition files, etc. of the C.D.P. Bundle; these files go"
	@echo "    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 help"
	@echo "    Print this help message."
	@echo