/ [latexrefman] / trunk / Makefile.1
To checkout: svn checkout http://svn.gnu.org.ua/sources/latexrefman/trunk/Makefile.1
Puszcza

Contents of /trunk/Makefile.1

Parent Directory Parent Directory | Revision Log Revision Log


Revision 894 - (show annotations)
Wed Dec 30 16:32:56 2020 UTC (4 months, 2 weeks ago) by vincentb1
File size: 13449 byte(s)
Regenerate distro for French (+ change French HTML up URL).


1 # $Id: Makefile 466 2015-10-27 11:31:20Z jhefferon $
2 # Public domain. Originally written 2006, Karl Berry.
3 # Makefile for latexrefman.
4
5 # Adding a new langage xx (for instance xx is ru for Russian) is as
6 # follows:
7 # 1) add xx to the list in other_languages
8 # 2) add definition of xx_longname, for instance if xx is ru,
9 # xx_longname:=russian
10 # 3) add definition of xx_updated_awk, script for formatting @set
11 # UPDATED tag.
12
13 manual=latex2e
14 default_language=en
15 other_languages=fr es
16 languages=$(default_language) $(other_languages)
17
18 #
19 xref_suffixes := ky cp vr fn cp pg tp
20 xref_suffixes := $(xref_suffixes) $(addsuffix s,$(xref_suffixes))
21 xref_suffixes := aux log toc $(xref_suffixes)
22 tex_suffixes = dvi pdf
23 makeinfo_suffixes = dbk html info txt xml
24 suffixes=$(tex_suffixes) $(makeinfo_suffixes) tree
25 en_longname:=english
26 es_longname:=spanish
27 fr_longname:=french
28
29 #
30 # Go somewhere useful from Top.
31 en_texi2html_top = -c TOP_NODE_UP_URL=http://tug.org/texinfohtml/
32 es_texi2html_top = -c TOP_NODE_UP_URL=http://tug.org/texinfohtml/
33 fr_texi2html_top = -c TOP_NODE_UP_URL=http://mirror.ctan.org/info/latex2e-help-texinfo-fr/
34
35 # how to build.
36 #
37 texi2dvi = texi2dvi --batch --tidy --build-dir=$*.t2dvi
38 texi2pdf = texi2pdf --batch --tidy --build-dir=$*.t2pdf
39 #
40 makeinfo = makeinfo
41 texi2docbook = $(makeinfo) --docbook
42 texi2info = $(makeinfo) --no-split
43 texi2txt = $(makeinfo) --plaintext --no-split
44 texi2xml = $(makeinfo) --xml
45
46 define lang_template
47 dist-$(1):=$(manual)-help-texinfo-$(1)
48 $(1)_manual:=$$(subst -$(default_language),,$(manual)-$(1))
49 $(1)_tex_output := $$(addprefix $$($(1)_manual).,$(tex_suffixes))
50 $(1)_makeinfo_output := $$(addprefix $$($(1)_manual).,$(makeinfo_suffixes))
51 $(1)_tree_output := latex2e-help-texinfo-tree/$$($(1)_manual)/index.html
52 $(1)_output := $$($(1)_tex_output) $$($(1)_makeinfo_output) $$($(1)_tree_output)
53 tex_output+= $$($(1)_tex_output)
54 makeinfo_output+= $$($(1)_makeinfo_output)
55 tree_output+= $$($(1)_tree_output)
56
57 .PHONY: $(1)tree
58 $(1)tree: $$($(1)_tree_output)
59
60 $$($(1)_manual).html: $$($(1)_manual).texi
61 $(makeinfo) --html --no-split $$($(1)_texi2html_top) $$<
62
63 latex2e-help-texinfo-tree/$$($(1)_manual)/index.html: $$($(1)_manual).texi
64 $(makeinfo) --html $$($(1)_texi2html_top) $$< -o $$(dir $$@)
65
66 endef
67 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
68
69 #
70 all_suffixes = dvi pdf $(makeinfo_suffixes) tree
71 all_manuals:=$(foreach lang,$(languages),$($(lang)_manual))
72
73 $(addsuffix .pdf,$(all_manuals)):%.pdf: %.texi
74 $(texi2pdf) $<
75 $(addsuffix .dvi,$(all_manuals)):%.dvi: %.texi
76 $(texi2dvi) $<
77 #
78 $(addsuffix .dbk,$(all_manuals)):%.dbk: %.texi
79 $(texi2docbook) -o $@ $<
80
81 $(addsuffix .info,$(all_manuals)):%.info: %.texi
82 $(texi2info) $<
83 $(addsuffix .txt,$(all_manuals)):%.txt: %.texi
84 $(texi2txt) -o $@ $<
85 $(addsuffix .xml,$(all_manuals)):%.xml: %.texi
86 $(texi2xml) $<
87
88
89 # targets follow.
90 #
91 default: check-en
92
93 # to test changes, build a subset: html and info (since these formats
94 # exercise significantly different code paths), and pdf for tex.
95 check_suffixes = html info pdf
96 #
97 .PHONY: check
98 check: $(addprefix check-,$(languages))
99 define lang_template
100 .PHONY:check-$(1)
101 check-$(1): spell-$(lang) $(addprefix $($(1)_manual)., $(check_suffixes)) license-check-$(lang)
102 endef
103 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
104
105
106
107 # Build per language.
108 define lang_template
109 .PHONY: $(1)
110 $(1): license-check-$(1) $($(1)_output)
111 endef
112 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
113
114
115 # Build per language with UPDATED flag refresh setttig LC_TIME to fr
116 # or es does not change the format %B under MSYS, neither with awk
117 # time function, nor with date bash command. This is why we emulate
118 # this.
119 define fr_updated_awk
120 function updated(){\
121 monthes[1]="Janvier";\
122 monthes[2]="Février";\
123 monthes[3]="Mars";\
124 monthes[4]="Avril";\
125 monthes[5]="Mai";\
126 monthes[6]="Juin";\
127 monthes[7]="Juillet";\
128 monthes[8]="Août";\
129 monthes[9]="Septembre";\
130 monthes[10]="Octobre";\
131 monthes[11]="Novembre";\
132 monthes[12]="Décembre";\
133 return monthes[month] " " year;\
134 }
135 endef
136 define en_updated_awk
137 function updated(){\
138 monthes[1]="January";\
139 monthes[2]="February";\
140 monthes[3]="March";\
141 monthes[4]="April";\
142 monthes[5]="May";\
143 monthes[6]="June";\
144 monthes[7]="July";\
145 monthes[8]="August";\
146 monthes[9]="September";\
147 monthes[10]="October";\
148 monthes[11]="November";\
149 monthes[12]="December";\
150 return monthes[month] " " year;\
151 }
152 endef
153 define es_updated_awk
154 function updated(){\
155 monthes[1] = "Enero";\
156 monthes[2] = "Febrero";\
157 monthes[3] = "Marzo";\
158 monthes[4] = "Abril";\
159 monthes[5] = "Mayo";\
160 monthes[6] = "Junio";\
161 monthes[7] = "Julio";\
162 monthes[8] = "Agosto";\
163 monthes[09] = "Septiembre";\
164 monthes[10] = "Octubre";\
165 monthes[11] = "Noviembre";\
166 monthes[12] = "Diciembre";\
167 return monthes[month] " " year;\
168 }
169 endef
170 define set_updated_awk
171 $($(1)_updated_awk);\
172 BEGIN { time_stamp=systime();\
173 year=strftime("%Y",time_stamp);\
174 month=strftime("%m",time_stamp) + 0;\
175 };\
176 /^ *@set +UPDATED/ { the_func="updated_" lang;\
177 $$$$0="@set UPDATED " updated();};\
178 { print}
179 endef
180 define lang_template
181 .PHONY: updated-$(1)
182 updated-date-$(1):
183 LC_TIME=C; \
184 awk -v lang=$(1) '$(call set_updated_awk,$(1))' $($(1)_manual).texi > temp.texi; \
185 if diff $($(1)_manual).texi temp.texi > /dev/null; then \
186 rm temp.texi; \
187 else \
188 mv temp.texi $($(1)_manual).texi; \
189 fi
190
191 updated-$(1): updated-date-$(1)
192 $$(MAKE) $(1)
193 endef
194 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
195
196
197 # To build everything in all languages.
198 .PHONY: all
199 all: $(languages)
200
201 # Check license consistency
202 define get_license_awk
203 BEGIN { print_enb = 0 }; \
204 /^@comment end of License/ { exit(0) }; \
205 print_enb == 1 { print }; \
206 /^@comment start of License/ { print_enb = 1}
207 endef
208
209 define lang_template
210 .PHONY: license-check-$(1)
211 license-check-$(1): license.texi $($(1)_manual).texi
212 awk '$(get_license_awk)' $($(1)_manual).texi > temp.texi; \
213 if diff license.texi temp.texi; then rm temp.texi; else \
214 echo "ERROR: License in manual $($(1)_manual).texi is inconsistent with license.texi" > /dev/stderr; \
215 exit -1;\
216 fi
217 endef
218 $(foreach lang,$(other_languages), $(eval $(call lang_template,$(lang))))
219
220 .PHONY: license-check-$(default_language)
221 license-check-$(default_language): license.texi
222
223 license.texi: $($(default_language)_manual).texi
224 awk '$(get_license_awk)' $< > $@
225 if [ `wc -l $@ | cut -d " " -f 1` -le 2 ]; then \
226 rm $@; \
227 echo "ERROR: Can't find license in $<" > /dev/stderr; \
228 exit -1; \
229 fi
230
231
232
233 # following the GNU sequence of clean targets.
234 .PHONY: distclean clean mostlyclean
235 distclean clean mostlyclean:
236 rm -rf $(manual)*.t2* license.texi
237 rm -f $(patsubst %,node-list-%.txt,$(languages))
238
239 .PHONY: realclean maintainer-clean
240 realclean maintainer-clean: distclean
241 rm -f $(addprefix $(manual)*., $(suffixes) $(xref_suffixes))
242 rm -fr $(foreach lang,$(addprefix dist-,$(languages)),$($(lang)) $($(lang)).zip)
243 rm -fr $(manual)-help-texinfo $(manual)-help-texinfo.zip
244
245
246 # dist for CTAN. Also update NEWS
247 #
248 define txt_files
249 ChangeLog Makefile.1 common.texi \
250 $(addsuffix $(subst -$(default_language),,-$(1)),NEWS README) \
251 ltx-help.el
252 endef
253
254 define dist_output
255 $($(1)_makeinfo_output) $(addprefix $($(1)_manual).,pdf texi) aspell.$(1).pws
256 endef
257
258 # $(1) = to be created & zipped directory name
259 # $(2) = en fr es
260 # $(3) = reverse path for $(1)
261 # $(4) = list of source files and other text files to be distributed.
262 define make_dist_dir
263 mkdir -p $(1); \
264 cd $(1); \
265 $(foreach file,$(call dist_output,$(2)) $(4), \
266 ln -s $(3)/$(file) \
267 $(subst README-$(2),README,\
268 $(subst Makefile.1,Makefile,\
269 $(file)));) \
270 cd $(3);
271 endef
272
273 # Distribution per language.
274 define lang_template
275 .PHONY: dist-$(1)
276 dist-$(1): $(1) updated-$(1)
277 @uncommited=`svn status $$(call dist_output,$(1)) $$(call txt_files,$(1))`; \
278 echo -n "$$$$uncommited"; \
279 if [ -n "$$$$uncommited" -a -z "$(DIST_FORCE)" ]; \
280 then \
281 echo ""; \
282 echo "There are uncommited changes."; \
283 echo "Commit them before making the distribution zip..."; \
284 echo "or make again with DIST_FORCE=1."; \
285 exit 2; \
286 fi
287 @echo ""
288 rm -fr $(dist-$(1))
289 $$(call make_dist_dir,$(dist-$(1)),$(1),..,$$(call txt_files,$(1)))
290 -zip -qr $(dist-$(1)).zip $(dist-$(1))
291 rm -fr $(dist-$(1))
292 @ls -l $(dist-$(1)).zip; unzip -t $(dist-$(1)).zip
293 endef
294 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
295
296
297
298 dist = $(manual)-help-texinfo
299 #
300 .PHONY: dist
301 dist: all
302 @uncommited=`svn status $(foreach lang,$(languages),$(call dist_output,$(lang)) $(call txt_files,$(lang)))`; \
303 echo -n "$$uncommited"; \
304 if [ -n "$$uncommited" -a -z "$(DIST_FORCE)" ]; \
305 then \
306 echo ""; \
307 echo "There are uncommited changes."; \
308 echo "Commit them before making the distribution zip..."; \
309 echo "or make again with DIST_FORCE=1."; \
310 exit 2; \
311 fi
312 @echo ""
313 rm -fr $(dist)
314 $(call make_dist_dir,$(dist),$(default_language),..,$(call txt_files,$(default_language)))
315 $(foreach lang,$(other_languages), \
316 $(call make_dist_dir,$(dist)/$($(lang)_longname),$(lang),../..,))
317 -zip -qr $(dist).zip $(dist)
318 rm -fr $(dist)
319 @ls -l $(dist).zip; unzip -t $(dist)
320
321
322
323 # A hacky spell check target.
324 # Remove \commandnames to reduce exception list, but not {args} or
325 # [args], since they are often words.
326 .PHONY: spell
327 spell: $(addprefix spell-,$(languages))
328 define lang_template
329 .PHONY: spell-$(1)
330 spell-$(1):
331 sed -e 's/\\[a-zA-Z]*//g' $($(1)_manual).texi \
332 | aspell list --mode=texinfo --add-extra-dicts=`pwd`/aspell.$(1).pws \
333 | sort -f -u
334 endef
335 $(foreach lang,$(languages), $(eval $(call lang_template,$(lang))))
336
337 # Check for doubled words.
338 # http://www.math.utah.edu/~beebe/software/file-tools.html#dw
339 .PHONY: check-dw
340 check-dw: $(addprefix check-dw-,$(languages))
341
342 define _1
343 .PHONY: check-dw-$(1)
344 check-dw-$(1): $($(1)_manual).texi
345 grep -v '^@item' $$< | dw
346
347 endef
348 $(eval $(foreach LANG,$(languages),$(call _1,$(LANG))))
349
350 # Convenience target to tag a delivery to CTAN
351 VC_USERID&=vincentb1
352 TAG?=ctan$(VERSION)
353 MESSAGE?=Delivery to CTAN $(VERSION)
354 CTANTAG?=svn copy svn+ssh://$(VC_USERID)@svn.gna.org.ua/latexrefman/trunk svn+ssh://$(VC_USERID)@svn.gna.org.ua/latexrefman/tags/$(TAG) -m "$(MESSAGE)"
355 .PHONY: tag
356 tag:
357 ifeq ($(VC_USERID),)
358 echo 'Please define VC_USERID variable in your environment to your Puszcza user id'
359 exit -1
360 else ifeq ($(TAG),ctan)
361 @if test -z '$(VC_USERID)'; then \
362 echo 'Please define VC_USERID variable in your environment to your Puszcza user id'; \
363 exit -1; \
364 else \
365 $(MAKE) $@ "VERSION=$(shell date '+%Y-%m-%dT%T')"; \
366 fi
367 else
368 @echo 'Will you run the following command:'
369 @echo '$(CTANTAG)'
370 @select w in yes no; \
371 do \
372 case $$w in \
373 yes) \
374 $(CTANTAG); \
375 break;; \
376 no) \
377 echo 'Cancelled'; \
378 break;; \
379 esac; \
380 done
381 endif
382
383 # Convenience targets to svn revert the generated files,
384 # and svn diff the source files.
385 .PHONY: svr svd
386 svr:
387 svn revert $(addprefix $(manual)*., $(all_suffixes))
388 svd:
389 svn diff $(foreach lang,$(languages),$(call txt_files,$(lang))) $(patsubst %,aspell.%.pws,$(languages)) *.texi
390
391
392 # Target for comparing node lists between languages
393 # use target compare-nodes-fr to compare French & English together.
394 .PHONY: compare-nodes
395 #compare-nodes: $(addprefix compare-nodes-,$(other_languages))
396 # For the time being we compare only French/English as the Spanish
397 # translation does not reuse the same node names
398 compare-nodes: compare-nodes-fr
399
400 define _1
401 .PHONY: compare-nodes-$(1)
402 compare-nodes-$(1): node-list-$(1).txt node-list-$(default_language).txt
403 if diff $$^; then :; \
404 else echo "=================================="; \
405 echo "Node list between $(1) and $(default_language) differ"; \
406 echo "=================================="; \
407 fi
408
409 endef
410 $(eval $(foreach LANG,$(other_languages),$(call _1,$(LANG))))
411
412 define AWK_NODE_LIST
413 /^ *@node/ { gsub(/^ *@node +| *,.*$$$$/,""); print; }
414 endef
415
416 define _1
417 node-list-$(1).txt: $($(1)_manual).texi
418 awk '$(AWK_NODE_LIST)' $$< > $$@
419
420 endef
421 $(eval $(foreach LANG,$(languages),$(call _1,$(LANG))))
422
423 # shorthands for compiling just one output <lang><ext>.
424 # for instance `make frinfo' is equivalent to `make latex2e-fr.info'
425 # `make enpdf`is is equivalent to `make latex2e.pdf'. etc.
426 define _1
427 .PHONY: $(1)$(2)
428 $(1)$(2): $($(1)_manual).$(2)
429
430 endef
431 $(eval $(foreach lang,$(languages),$(foreach suffix,$(suffixes),$(call _1,$(lang),$(suffix)))))
432
433 comma:=,
434 define make_list
435 in {$(join $(1),$(patsubst %,$(comma),$(filter-out $(firstword $(1)),$(1))))}
436 endef
437
438 .PHONY: help h ?
439 h ?:help
440 help:
441 @echo "Target tag to set an SVN tag to delivered version"
442 @echo "Target svr to revert all products"
443 @echo "Target svd to make an svn diff over all deliverable sources"
444 @echo "Target check-dw to check double words in .texi source for all languages"
445 @echo "Target check-dw-L to check double words in .texi source for language L $(call make_list,$(languages))"
446 @echo "Target updated-L to update version in .texi source for language L $(call make_list,$(languages))"
447 @echo "Target L to make all format for language L $(call make_list,$(languages))"
448 @echo "Target LF to make format F for language L $(call make_list,$(foreach L,$(languages),$(foreach F,$(suffixes),$(L)$(F))))"
449 @echo "Target compare-nodes-L to compare node list of language L to node list of $(default_language), for L $(call make_list,$(other_languages))"
450
451 # Local Variables:
452 # coding: utf-8
453 # mode: makefile
454 # End:

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20