summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/listings/Makefile
blob: 49750393d343d331be2c1c2ee798154a1ae772ab (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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
### Makefile ---
#
# This file generates files required to use the listings package.
#
# $Id$
#
# (c) 2007 Brooks Moses
# (c) 2013-2018 Jobst Hoffmann
#
# This file is distributed under the terms of the LaTeX Project Public
# License from CTAN archives in directory  macros/latex/base/lppl.txt.
# Either version 1.3c or, at your option, any later version.

# remember:
# $<: first element of list of dependees
# $^: list of (all) dependees
# $@: target

# formatting tools
LATEX = pdflatex
MAKEINDEX = makeindex
TEX = tex
# tarring options
ifneq "$(wildcard listings.version)" ""
include listings.version        # version and date of the package
endif
TAR_SRC = $(PACKAGE)-$(VERSION)_source.tgz
EXsvn = --exclude .svn --exclude auto --exclude contrib --exclude requests \
	--exclude support --exclude testing \
	--exclude *.tgz --exclude *.txt

DISTRIBUTION_FILES = ../$(PACKAGE)/$(PACKAGE).pdf \
	../$(PACKAGE)/$(PACKAGE)-devel.pdf \
	../$(PACKAGE)/$(PACKAGE).dtx \
	../$(PACKAGE)/$(PACKAGE).ins \
	../$(PACKAGE)/README \
	../$(PACKAGE)/Makefile \
	../$(PACKAGE)/lstdrvrs.dtx \
	../$(PACKAGE)/lstdrvrs.pdf 
PACKAGE_FILES = $(subst ../$(PACKAGE)/,,$(DISTRIBUTION_FILES))
STY_FILES = listings.cfg listings.sty lstmisc.sty \
	lstlang0.sty lstlang1.sty lstlang2.sty

.SUFFIXES:                              # Delete the default suffixes
.SUFFIXES: .dtx .ins .pdf .sty          # Define our own suffix list

.PHONY: listings pdf pdf-devel tests all

listings: listings.sty

pdf: listings.pdf lstdrvrs.pdf

pdf-devel: listings-devel.pdf

all: listings pdf pdf-devel


listings.sty: listings.ins listings.dtx lstdrvrs.dtx
	$(TEX) $<

listings.pdf: listings.sty
	echo "\PassOptionsToClass{a4paper}{article}" > ltxdoc.cfg
	$(LATEX) ${<:.sty=.dtx}
	$(MAKEINDEX) -s gind.ist ${@:.pdf=}
	$(LATEX) ${<:.sty=.dtx}
	$(LATEX) ${<:.sty=.dtx}
	rm -f ltxdoc.cfg

listings-devel.pdf: listings.sty
	echo "\PassOptionsToClass{a4paper}{article}" > ltxdoc.cfg
	echo "\AtBeginDocument{\AlsoImplementation}" >> ltxdoc.cfg
	$(LATEX) -jobname=${@:.pdf=} ${<:.sty=.dtx}
	$(MAKEINDEX) -s gind.ist ${@:.pdf=}
	$(LATEX) -jobname=${@:.pdf=} ${<:.sty=.dtx}
	$(LATEX) -jobname=${@:.pdf=} ${<:.sty=.dtx}
	rm -f ltxdoc.cfg

lstdrvrs.pdf: lstdrvrs.dtx
	echo "\PassOptionsToClass{a4paper}{article}" > ltxdoc.cfg
	$(LATEX) ${<:.sty=.dtx}
	$(MAKEINDEX) -s gind.ist lstdrvrs
	$(LATEX) ${<:.sty=.dtx}
	$(LATEX) ${<:.sty=.dtx}
	rm -f ltxdoc.cfg

## Testing targets
acm-tests:
	cd testing; make acm

algol-tests:
	cd testing; make algol

bash-tests:
	cd testing; make bash

c++11-tests:
	cd testing; make c++11

cobol-tests:
	cd testing; make cobol

fortran-tests:
	cd testing; make fortran

elisp-tests:
	cd testing; make elisp

gap-tests:
	cd testing; make gap

go-tests:
	cd testing; make go

hansl-tests:
	cd testing; make hansl

llvm-tests:
	cd testing; make llvm

lua-tests:
	cd testing; make lua

mathematica-tests:
	cd testing; make mathematica

python-tests:
	cd testing; make python

scala-tests:
	cd testing; make scala

swift-tests:
	cd testing; make swift

vbscript-tests:
	cd testing; make vbscript

xml-tests:
	cd testing; make xml

tests:
	cd testing; make all

## Clean targets
clean:
	-rm -f  *~ *.aux *.lof *.log *.lot *.tmp *.toc
	-rm -f *.idx *.ind *.glg *.glo *.gls *.ilg *.out
	-rm -f *.bbl *.blg *.brf

clean-results:
	-rm -f *.cfg *.pdf *.prf *.sty

realclean:  clean clean-results

### create packed files
tar-src:
	@$(MAKE) realclean; \
	sed -i -e "s+fileversion{[a-z0-9\.\-]*}+fileversion{$(VERSION)}+g" \
	    -e "s+filedate{[0-9/]*}+filedate{$(DATE)}+g" \
	    -e "s+date{[0-9/]*\\\\enspace+date{$(DATE)\\\\enspace+g" \
	    -e "s+Version [a-z0-9\.\-]*\\\\+Version $(VERSION)\\\\+g" \
		listings.dtx; \
	sed -i -e "s+date{[0-9/]*\\\\enspace+date{$(DATE)\\\\enspace+g" \
	    -e "s+Version [a-z0-9\.\-]*\\\\+Version $(VERSION)\\\\+g" \
	    -e "s+\[[0-9/]* [a-z0-9\.\-]* listings+[$(DATE) $(VERSION) listings+g" \
		lstdrvrs.dtx; \
	cd ..; tar $(EXsvn) -czvf $(PACKAGE)/$(TAR_SRC) $(PACKAGE)

tar-dist: $(PACKAGE_FILES)
	@$(MAKE) realclean; \
	sed -i -e "s+fileversion{[a-z0-9\.\-]*}+fileversion{$(VERSION)}+g" \
	    -e "s+filedate{[0-9/]*}+filedate{$(DATE)}+g" \
	    -e "s+date{[0-9/]*\\\\enspace+date{$(DATE)\\\\enspace+g" \
	    -e "s+Version [a-z0-9\.\-]*\\\\+Version $(VERSION)\\\\+g" \
		listings.dtx; \
	sed -i -e "s+date{[0-9/]*\\\\enspace+date{$(DATE)\\\\enspace+g" \
	    -e "s+Version [a-z0-9\.\-]*\\\\+Version $(VERSION)\\\\+g" \
	    -e "s+\[[0-9/]* [a-z0-9\.\-]* listings+[$(DATE) $(VERSION) listings+g" \
		lstdrvrs.dtx; \
	$(MAKE) listings.pdf; \
	$(MAKE) listings-devel.pdf; \
	$(MAKE) lstdrvrs.pdf; \
	tar cfvz $(PACKAGE)-$(VERSION).tgz $(DISTRIBUTION_FILES);

tagged-release:
	sed -n -e "/Version $(VERSION)/,$$$$w announcement_text.log" \
	    announcement_text.txt
	svn copy --file ./announcement_text.log \
		svn+ssh://j_hoffmann@svn.gnu.org.ua/listings/trunk \
		svn+ssh://j_hoffmann@svn.gnu.org.ua/listings/tags/$(VERSION)
	rm announcement_text.log


## Documentation target
help::
	$(info Usage:)
	$(info )
	$(info make [all]	generates listings.sty and [all] the .pdf versions)
	$(info $(empty)		(user/developer) of the documentation)
	$(info )
	$(info make <file name>)
	$(info $(empty)		creates the corresponding file denoted by <file name>)
	$(info )
	$(info make help	shows this help)
	$(info )
	$(info make tests	performs a little test suite)
	$(info )
	$(info make clean	removes all intermediate files created by a LaTeX run)
	$(info )
	$(info make clean-results)
	$(info $(empty)		removes .cfg, .sty, and .pdf files)
	$(info )
	$(info make realclean)
	$(info $(empty)		performs clean and clean-results)
	$(info )
	$(info make tar-src)
	$(info $(empty)		generates a tarred version of the current directory)
	$(info )
	$(info make tar-dist)
	$(info $(empty)		generates a distributable version of the listings)
	$(info $(empty)		package)
	$(info )
	$(info make tagged-release)
	$(info $(empty)		creates a new tagged version of the package based on)
	$(info $(empty)		the contents of listings.version and announcement_text.txt)
	@echo ""					# prevents message "nothing to do ..."

### Makefile ends here ---