Skip to content

Commit

Permalink
Complete the versioninfo.md documentation file
Browse files Browse the repository at this point in the history
Complete the description of the versioninfo mechanism, which
commit 37997ba adds in an
incomplete state.
  • Loading branch information
ndim committed Feb 19, 2024
1 parent dcc40cf commit 7f21b55
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions src/build-helpers/versioninfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,66 @@ The `versioninfo.sh` script then prints these items, one per line.
The `build-helpers/versioninfo.m4` m4 include file
--------------------------------------------------

TODO: Write text.
This defines the two parts of the m4 code:

* The m4 code which calls `versioninfo.sh`, parses its output, and
defines some m4 macros before `AC_INIT`:

* The `versioninfo_items` macro describes the sequence of
versioninfo items printed in lines by the `versioninfo.sh`
script

* The `versioninfo_init` macro runs the `versioninfo.sh` script
and parses its output, `m4_define`ing a `versioninfo_<ITEM>`
macro for each `ITEM` from `versioninfo_items`

* The `versioninfo_stampfile` macro contains the name of the
stamp file which caches the versioninfo items for use in
tarballs.

* The `versioninfo_init` macro is evaluated once, so that
`versioninfo.sh` is only run once as well.

The m4 macros with the parsed results can then be evaluated using
`m4_defn(...)` both in the `AC_INIT(...)` invocation for the
`PACKAGE_VERSION`, and also later for defining
`AVRDUDE_FULL_VERSION` and git commit information.

* The m4 code `AC_DEFUN`s the `VERSIONINFO_SETUP` macro, which in
turn defines `AC_SUBST` substitution and make variables for each
of the versioninfo items, and also defines a few
stubstitution-only (not make) variables for use in make rules in
`versioninfo.mk` and `GNUmakefile.in`, which write, read, parse,
and compare the versioninfo items as defined in
`versioninfo_items`.


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

TODO: Write text.
To be `include`d into the top-level `Makefile.am`, this does two things:

* Hooks into the `dist` and `distcheck` targets to check the
recorded version information is the same one `versioninfo.sh`
would detect right now, and prevents builds with out of date
versioninfo items.

* Writes the stamp file with the versioninfo data when creating a
dist tarball.


The `configure.ac` file
-----------------------

TODO: Write text.
Before `AC_INIT`, uses m4 logic to evaluate what the `PACKAGE_VERSION`
should be.

Expands the `VERSIONINFO_SETUP` macro both to run its content and to
force `aclocal` to pull in `versioninfo.m4` into `aclocal.m4` so that
the m4 code from `versioninfo.m4` is evaluated before `AC_INIT`.

Evaluates the `AVRDUDE_FULL_VERSION` message and adds it as both a C
preprocessor macro and a autoconf substitution and make variable.


The `GNUmakefile.in` and `GNUmakefile` files
Expand Down

0 comments on commit 7f21b55

Please sign in to comment.