Debian Codegraph @

build/Makefile

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # Compilation of the Scribe formatter written for the Ada Reference
2 # Manual, translating .ms[ms] files into various formats. Also build
3 # tar.gz for the web page.
4
5 # Copyright (c) 2010, 2013 Stephen Leake <[email protected]>
6 # Copyright (c) 2013 Nicolas Boulenguez <[email protected]>
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 # Specific targets generate every $document$year.$format combination.
23 # Ex: make arm2012.pdf
24 AVAILABLE_DOCUMENTS := aarm arm
25 AVAILABLE_YEARS := 2005 2012 2020
26 AVAILABLE_FORMATS := html info texinfo txt pdf
27
28 # 'all' builds all versions except pdf; to build a subset, override these on the command line.
29 DOCUMENTS := $(AVAILABLE_DOCUMENTS)
30 YEARS := $(AVAILABLE_YEARS)
31 FORMATS := $(filter-out pdf texinfo, $(AVAILABLE_FORMATS))
32 # Texinfo is an intermediate, and is built as necessary.
33 # Pdf requires installation of many huge formatting tools; we assume they are not installed.
34
35 # see ../README.txt for list of things to change when Scribe or Ada source changes.
36 #
37 # Cygwin texi2dvi (GNU Texinfo 4.13) 1.135 fails silently!
38
39 # Debian standard build flags for Ada projects
40 BUILDER_OPTIONS := -k
41 ADAFLAGS :=
42 LDFLAGS :=
43 # arm_info.gpr sets its own flags, then appends these variables so
44 # that they take precedence. The intent is that you may configure the
45 # build with a simple variable override.
46
47 PYTHON ?= python3
48 EMACS_EXE ?= emacs
49
50 .PHONY: all clean publish
51
52 all: $(foreach d,$(DOCUMENTS),\
53 $(foreach y,$(YEARS),\
54 $(foreach f,$(FORMATS),\
55 $(d)$(y).$(f))))
56
57
58 create-dir : force
59 for file in *.info; do install-info $$file dir; done
60
61 # We have been unable to get rid of all the section ref violations, so we
62 # specify --no-validate. Delete that to see the errors.
63 TEXI_INFO_OPTS := --no-split --no-number-sections --no-validate
64 TEXI_PDF_OPTS := --quiet
65
66 SOURCE_DIR_2005 := ../source_2005
67 SOURCE_DIR_2012 := ../source_2012
68 SOURCE_DIR_2020 := ../source_2020
69
70 # See progs/command.txt.
71 CHANGES := New-Only
72 # See arm_form.ada comment before Get_Commands for possible values
73 VERSION_2005 := 2
74 VERSION_2012 := 4
75 VERSION_2020 := 5
76
77 # Mapping from document acronyms to Randy's file names
78 MASTER_arm := rm.msm
79 MASTER_aarm := aarm.msm
80
81 # Rough dependency, but Scribe files should not change often.
82 SOURCES_2005 := $(wildcard $(SOURCE_DIR_2005)/*.ms[ms])
83 SOURCES_2012 := $(wildcard $(SOURCE_DIR_2012)/*.ms[ms])
84 SOURCES_2020 := $(wildcard $(SOURCE_DIR_2020)/*.ms[ms])
85 define doc_year_build
86
87 # Non-unique intermediate paths would create a race condition, so we
88 # store the temporary result into the versioned source directory.
89 $(d)$(y).texinfo: arm_form.exe $(SOURCES_$(y))
90 cd $(SOURCE_DIR_$(y)); \
91 $(CURDIR)/$$< $(MASTER_$(d)) info $(CHANGES) $(VERSION_$(y)) $(VERSION_$(y)) ./; \
92 mv `sed -ne '/^@FilePrefix{\(.*\)}/{s//\L\1/p;q}' $(MASTER_$(d))`.texinfo $(CURDIR)/$$@
•93 $(EMACS_EXE) -Q -batch -L ../progs -l arm-texi-index.el --eval '(progn(do-index "$$@")(kill-emacs))'
94 clean::
95 rm -f $(d)$(y).texinfo
96
97 $(d)$(y).html: arm_form.exe $(SOURCES_$(y))
98 rm -f -r $$@
99 mkdir --parents $$@
100 cd $(SOURCE_DIR_$(y)); \
101 $(CURDIR)/$$< $(MASTER_$(d)) HTML $(CHANGES) $(VERSION_$(y)) $(VERSION_$(y)) $(CURDIR)/$$@/
102 clean::
103 rm -f -r $(d)$(y).html
104
105 $(d)$(y).txt: arm_form.exe $(SOURCES_$(y))
106 rm -f -r $$@
107 mkdir --parents $$@
108 cd $(SOURCE_DIR_$(y)); \
109 $(CURDIR)/$$< $(MASTER_$(d)) Text $(CHANGES) $(VERSION_$(y)) $(VERSION_$(y)) $(CURDIR)/$$@/
110 for i in $$@/*; do \
111 iconv --from-code=iso8859-1 --to-code=utf-8 > $$@/tmp $$$$i && mv $$@/tmp $$$$i; \
112 done
113 clean::
114 rm -f -r $(d)$(y).txt
115
116 # texi2any is from texinfo 5
•117 $(d)$(y).info: $(d)$(y).texinfo
118 texi2any --info $(TEXI_INFO_OPTS) $$< -o $$@
119 clean::
120 rm -f $(d)$(y).info
121
122 $(d)$(y).pdf: $(d)$(y).texinfo
123 texi2any --pdf $(TEXI_PDF_OPTS) $$< -o $$@
124 clean::
125 rm -f $(d)$(y).aux $(d)$(y).cp $(d)$(y).cps $(d)$(y).log $(d)$(y).pdf $(d)$(y).toc
126
127 endef
128 $(foreach d,$(AVAILABLE_DOCUMENTS),\
129 $(foreach y,$(AVAILABLE_YEARS),\
130 $(eval $(doc_year_build))))
131
132 arm_form.exe : force
133 gnatmake -p $(BUILDER_OPTIONS) -P arm_info.gpr $(foreach var,ADAFLAGS LDFLAGS,"-X$(var)=$($(var))")
134 clean::
135 rm -f arm_form.exe
136 rm -f -r objects __pycache__
137
138 trace :
139 addr2line -e arm_form.exe 0x52f218 0x54d4de 0x402123 0x405c6e 0x401393 0x4014f9 0x7ffd98271410 0x7ffd990454f2
140
141 # year is latest standard; bump trailing digit for any change.
142 ZIP_VERSION := $(lastword $(AVAILABLE_YEARS)).1
143
144 INFO_ARCHIVE := arm_info-$(ZIP_VERSION).tar.gz
145 SOURCE_ARCHIVE := arm_info-$(ZIP_VERSION)-src.tar.gz
146 publish: $(INFO_ARCHIVE) $(SOURCE_ARCHIVE)
147
148 # --no-name eliminates time stamps, which helps make the tarball reproducible
149 # --best gives higher compression than the default; we can afford the time here.
150 GZIP := --no-name --best
151
152 $(INFO_ARCHIVE): $(foreach d,$(DOCUMENTS),\
153 $(foreach y,$(YEARS),\
154 $(d)$(y).info))
155 tar cf - $^ | gzip $(GZIP) -c > $@
156 clean::
157 rm -f $(INFO_ARCHIVE)
158
159 $(SOURCE_ARCHIVE): force
160 (cd .. && git archive --prefix=arm_info-$(ZIP_VERSION)-src/ org.adaic.arm_form *) | gzip $(GZIP) -c > $@
161
162 clean::
163 rm -f $(SOURCE_ARCHIVE)
164
165 update_upstream : source_ada.clean source_ada.stamp
166 update_upstream : source_scribe_2005.clean source_scribe_2005.stamp
167 update_upstream : source_scribe_2012.clean source_scribe_2012.stamp
168 update_upstream : source_scribe_2020.clean source_scribe_2020.stamp
169
170 # download.py does not convert to unix line endings here to minimize
171 # the diff with upstream; the Ada compiler can handle DOS line endings
172 # on Unix. download.py does convert file names to lower case here, for
173 # consistency.
174 source_ada.stamp :
175 rm -rf ../../org.adaic.arm_form.upstream/progs
176 cd ../../org.adaic.arm_form.upstream; $(PYTHON) ../org.adaic.arm_form/build/download.py progs
177 touch source_ada.stamp
178
179 source_ada.clean :
180 rm -f source_ada.stamp
181
182 # This retrieves the CVS tag for the year given on the command line
183 # commit to mtn: (dvc-status "../../org.adaic.arm_form.upstream")
184 #
185 # download.py converts to unix line endings here, because the scribe
186 # processor insists on uniform formatting; this works for both Windows
187 # and Debian. download.py also converts all file names to lowercase,
188 # and arm_form does as well; upstream only runs on Windows, which
189 # ignores case in filenames, so the file names in the sources are not
190 # consistently cased.
191 source_scribe_%_downloaded.stamp :
192 rm -rf ../../org.adaic.arm_form.upstream/source_$*
193 cd ../../org.adaic.arm_form.upstream; $(PYTHON) ../org.adaic.arm_form/build/download.py $*
194
195 # download.py often times out, so we need to run it multiple times,
196 # then manually mark it done. Then make source_scribe_%.stamp
197 mark_%_downloaded :
198 touch source_scribe_$*_downloaded.stamp
199
200 source_scribe_%.stamp : source_scribe_%_downloaded.stamp
201 mv ../../org.adaic.arm_form.upstream/source ../../org.adaic.arm_form.upstream/source_$*
202 touch source_scribe_$*.stamp
203
204 source_scribe_%.clean :
205 rm -f source_scribe_$*.stamp
206
207 # These sources do not match the corresponding CVS tag, although they are close.
208 ARM_SRC.ZIP ARM_FORM.ZIP ARM_FSRC.ZIP 2005-SRC.zip 2012-SRC.zip :
209 wget http://www.ada-auth.org/arm-files/$@
210
211 # delete everything back to mtn checkout
212 #
213 # Note that additional 'clean' targets are specified after every
214 # target that builds something.
215 clean ::
216 rm -f *.stamp *.zip
217
218 info-clean :
219 rm -f *.info*
220
221 .PHONY : force
222
223 VPATH = ../source_2005 ../source_2012 ../source_2020 ../progs
224
225 #Local Variables:
226 #eval: (delete '("\\.mss\\'" . scribe-mode) auto-mode-alist)
227 #eval: (ada-parse-prj-file "arm_info.prj")
228 #eval: (ada-select-prj-file "arm_info.prj")
229 #End:
230 # end of file