Skip to content

Commit 7f21b55

Browse files
committed
Complete the versioninfo.md documentation file
Complete the description of the versioninfo mechanism, which commit 37997ba adds in an incomplete state.
1 parent dcc40cf commit 7f21b55

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

src/build-helpers/versioninfo.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,66 @@ The `versioninfo.sh` script then prints these items, one per line.
116116
The `build-helpers/versioninfo.m4` m4 include file
117117
--------------------------------------------------
118118

119-
TODO: Write text.
119+
This defines the two parts of the m4 code:
120+
121+
* The m4 code which calls `versioninfo.sh`, parses its output, and
122+
defines some m4 macros before `AC_INIT`:
123+
124+
* The `versioninfo_items` macro describes the sequence of
125+
versioninfo items printed in lines by the `versioninfo.sh`
126+
script
127+
128+
* The `versioninfo_init` macro runs the `versioninfo.sh` script
129+
and parses its output, `m4_define`ing a `versioninfo_<ITEM>`
130+
macro for each `ITEM` from `versioninfo_items`
131+
132+
* The `versioninfo_stampfile` macro contains the name of the
133+
stamp file which caches the versioninfo items for use in
134+
tarballs.
135+
136+
* The `versioninfo_init` macro is evaluated once, so that
137+
`versioninfo.sh` is only run once as well.
138+
139+
The m4 macros with the parsed results can then be evaluated using
140+
`m4_defn(...)` both in the `AC_INIT(...)` invocation for the
141+
`PACKAGE_VERSION`, and also later for defining
142+
`AVRDUDE_FULL_VERSION` and git commit information.
143+
144+
* The m4 code `AC_DEFUN`s the `VERSIONINFO_SETUP` macro, which in
145+
turn defines `AC_SUBST` substitution and make variables for each
146+
of the versioninfo items, and also defines a few
147+
stubstitution-only (not make) variables for use in make rules in
148+
`versioninfo.mk` and `GNUmakefile.in`, which write, read, parse,
149+
and compare the versioninfo items as defined in
150+
`versioninfo_items`.
120151

121152

122153
The `build-helpers/versioninfo.mk` Makefile include file
123154
--------------------------------------------------------
124155

125-
TODO: Write text.
156+
To be `include`d into the top-level `Makefile.am`, this does two things:
157+
158+
* Hooks into the `dist` and `distcheck` targets to check the
159+
recorded version information is the same one `versioninfo.sh`
160+
would detect right now, and prevents builds with out of date
161+
versioninfo items.
162+
163+
* Writes the stamp file with the versioninfo data when creating a
164+
dist tarball.
126165

127166

128167
The `configure.ac` file
129168
-----------------------
130169

131-
TODO: Write text.
170+
Before `AC_INIT`, uses m4 logic to evaluate what the `PACKAGE_VERSION`
171+
should be.
172+
173+
Expands the `VERSIONINFO_SETUP` macro both to run its content and to
174+
force `aclocal` to pull in `versioninfo.m4` into `aclocal.m4` so that
175+
the m4 code from `versioninfo.m4` is evaluated before `AC_INIT`.
176+
177+
Evaluates the `AVRDUDE_FULL_VERSION` message and adds it as both a C
178+
preprocessor macro and a autoconf substitution and make variable.
132179

133180

134181
The `GNUmakefile.in` and `GNUmakefile` files

0 commit comments

Comments
 (0)