File: Makefile

package info (click to toggle)
ada-reference-manual 1%3A2012.2-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,300 kB
  • ctags: 135
  • sloc: ada: 29,330; makefile: 216; python: 92
file content (212 lines) | stat: -rwxr-xr-x 7,692 bytes parent folder | download
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
# Compilation of the Scribe formatter written for the Ada Reference
# Manual, translating .ms[ms] files into various formats. Also build
# tar.gz for the web page.

# Copyright (c) 2010, 2013 Stephen Leake <stephen_leake@stephe-leake.org>
# Copyright (c) 2013       Nicolas Boulenguez <nicolas@debian.org>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# Specific targets generate every $document$year.$format combination.
# Ex: make arm2012.pdf
AVAILABLE_DOCUMENTS := aarm arm
AVAILABLE_YEARS     := 2005 2012
AVAILABLE_FORMATS   := html info texinfo txt pdf

# 'all' builds all versions except pdf; to build a subset, override these on the command line.
DOCUMENTS := $(AVAILABLE_DOCUMENTS)
YEARS     := $(AVAILABLE_YEARS)
FORMATS   := $(filter-out pdf texinfo, $(AVAILABLE_FORMATS))
# Texinfo is an intermediate, and is built as necessary.
# Pdf requires installation of many huge formatting tools; we assume they are not installed.

# see ../README.txt for list of things to change when Scribe or Ada source changes.
#
# Cygwin texi2dvi (GNU Texinfo 4.13) 1.135 fails silently!

# Debian standard build flags for Ada projects
BUILDER_OPTIONS := -k
ADAFLAGS        :=
LDFLAGS         :=
# arm_info.gpr sets its own flags, then appends these variables so
# that they take precedence.  The intent is that you may configure the
# build with a simple variable override.

.PHONY: all clean publish

all: $(foreach d,$(DOCUMENTS),\
     $(foreach y,$(YEARS),\
     $(foreach f,$(FORMATS),\
       $(d)$(y).$(f))))

# We have been unable to get rid of all the section ref violations, so we
# specify --no-validate. Delete that to see the errors.
TEXI_INFO_OPTS := --no-split --no-number-sections --no-validate
TEXI_PDF_OPTS := --quiet

SOURCE_DIR_2005 := ../source_2005
SOURCE_DIR_2012 := ../source_2012

# See progs/command.txt.
CHANGES      := New-Only
# See inside SOURCE_DIR_YEAR/DOCUMENT.msm for possible values.
VERSION_2005 := 2
VERSION_2012 := 3

# Mapping from document acronyms to Randy's file names
MASTER_arm  := rm.msm
MASTER_aarm := aarm.msm

# Rough dependency, but Scribe files should not change often.
SOURCES_2005 := $(wildcard $(SOURCE_DIR_2005)/*.ms[ms])
SOURCES_2012 := $(wildcard $(SOURCE_DIR_2012)/*.ms[ms])

define doc_year_build

  # Non-unique intermediate paths would create a race condition, so we
  # store the temporary result into the versioned source directory.
  $(d)$(y).texinfo: arm_form.exe $(SOURCES_$(y))
	cd $(SOURCE_DIR_$(y)); \
        $(CURDIR)/$$< $(MASTER_$(d)) info $(CHANGES) $(VERSION_$(y)) ./; \
        mv `sed -ne '/^@FilePrefix{\(.*\)}/{s//\L\1/p;q}' $(MASTER_$(d))`.texinfo $(CURDIR)/$$@
  clean::
	rm -f $(d)$(y).texinfo

  $(d)$(y).html: arm_form.exe $(SOURCES_$(y))
	rm -f -r $$@
	mkdir --parents $$@
	cd $(SOURCE_DIR_$(y)); \
        $(CURDIR)/$$< $(MASTER_$(d)) HTML $(CHANGES) $(VERSION_$(y)) $(CURDIR)/$$@/
  clean::
	rm -f -r $(d)$(y).html

  $(d)$(y).txt: arm_form.exe $(SOURCES_$(y))
	rm -f -r $$@
	mkdir --parents $$@
	cd $(SOURCE_DIR_$(y)); \
        $(CURDIR)/$$< $(MASTER_$(d)) Text $(CHANGES) $(VERSION_$(y)) $(CURDIR)/$$@/
  clean::
	rm -f -r $(d)$(y).txt

# texi2any is from texinfo 5
  $(d)$(y).info: $(d)$(y).texinfo
	texi2any --info $(TEXI_INFO_OPTS) $$< -o $$@
  clean::
	rm -f $(d)$(y).info

  $(d)$(y).pdf: $(d)$(y).texinfo
	texi2any --pdf $(TEXI_PDF_OPTS) $$< -o $$@
  clean::
	rm -f $(d)$(y).aux $(d)$(y).log $(d)$(y).pdf $(d)$(y).toc

endef
$(foreach d,$(AVAILABLE_DOCUMENTS),\
$(foreach y,$(AVAILABLE_YEARS),\
$(eval $(doc_year_build))))

arm_form.exe : force
	gnatmake -p $(BUILDER_OPTIONS) -P arm_info.gpr $(foreach var,ADAFLAGS LDFLAGS,"-X$(var)=$($(var))")
clean::
	rm -f arm_form.exe
	rm -f -r objects

trace :
	addr2line -e arm_form.exe 0x5c12e7 0x5c598e 0x43e05b 0x446c5b 0x448369 0x545205 0x4e9221 0x4e3b1a 0x5831a1 0x5ad295 0x5adee9 0x4cb3f5 0x401850 0x401235 0x401286 0x7c817075

# year is latest standard; bump trailing digit for any change.
ZIP_VERSION := $(lastword $(AVAILABLE_YEARS)).2

INFO_ARCHIVE := arm_info-$(ZIP_VERSION).tar.gz
SOURCE_ARCHIVE  := arm_info-$(ZIP_VERSION)-src.tar.gz
publish: $(INFO_ARCHIVE) $(SOURCE_ARCHIVE)

# --no-name eliminates time stamps, which helps make the tarball reproducible
# --best gives higher compression than the default; we can afford the time here.
GZIP := --no-name --best

$(INFO_ARCHIVE): $(foreach d,$(DOCUMENTS),\
                 $(foreach y,$(YEARS),\
                 $(d)$(y).info))
	tar cf - $^ | gzip $(GZIP) -c > $@
clean::
	rm -f $(INFO_ARCHIVE)

ZIP_EXCLUDES := *~ *.dvi *.gz *.info *.log *.pdf *.ps *.texinfo *.toc \
  *.stamp *.zip arm_form.exe _MTN .mtn-ignore .dvc-exclude aarm2005.html \
  aarm2005.txt aarm2012.html aarm2012.txt arm2005.html arm2005.txt arm2012.html \
  arm2012.txt objects
$(SOURCE_ARCHIVE):
	tar cf - -C ../.. $(foreach e,$(ZIP_EXCLUDES),--exclude="$(e)") org.adaic.arm_form | gzip $(GZIP) -c > $@
clean::
	rm -f $(SOURCE_ARCHIVE)

update_upstream : source_ada.clean         source_ada.stamp
update_upstream : source_scribe_2005.clean source_scribe_2005.stamp
update_upstream : source_scribe_2012.clean source_scribe_2012.stamp

# download.py does not convert to unix line endings here to minimize
# the diff with upstream; the Ada compiler can handle DOS line endings
# on Unix. download.py does convert file names to lower case here, for
# consistency.
source_ada.stamp :
	rm -rf ../../org.adaic.arm_form.upstream/progs
	cd ../../org.adaic.arm_form.upstream; python3 ../org.adaic.arm_form/build/download.py progs
	touch source_ada.stamp

source_ada.clean :
	rm -f source_ada.stamp

# This retrieves the CVS tag for the year given on the command line
# commit to mtn: (dvc-status "../../org.adaic.arm_form.upstream")
#
# download.py converts to unix line endings here, because the scribe
# processor insists on uniform formatting; this works for both Windows
# and Debian. download.py also converts all file names to lowercase,
# and arm_form does as well; upstream only runs on Windows, which
# ignores case in filenames, so the file names in the sources are not
# consistently cased.
source_scribe_%.stamp :
	rm -rf ../../org.adaic.arm_form.upstream/source_$*
	cd ../../org.adaic.arm_form.upstream; python3 ../org.adaic.arm_form/build/download.py $*
	mv ../../org.adaic.arm_form.upstream/source ../../org.adaic.arm_form.upstream/source_$*
	touch source_scribe_$*.stamp

source_scribe_%.clean :
	rm -f source_scribe_$*.stamp

# These sources do not match teh correpsonding CVS tag, although they are close.
ARM_SRC.ZIP ARM_FORM.ZIP ARM_FSRC.ZIP 2005-SRC.zip 2012-SRC.zip :
	wget http://www.ada-auth.org/arm-files/$@

# delete everything back to mtn checkout
#
# Note that additional 'clean' targets are specified after every
# target that builds something.
clean ::
	rm -f *.stamp *.zip

info-clean :
	rm -f *.info*

.PHONY : force

VPATH = ../source_2005 ../source_2012 ../progs

#Local Variables:
#eval: (delete '("\\.mss\\'" . scribe-mode) auto-mode-alist)
#eval: (ada-parse-prj-file "arm_info.prj")
#eval: (ada-select-prj-file "arm_info.prj")
#End:
# end of file