[DTrace-devel] [oracle/dtrace-utils] 197be9: build: overridable configuration variables

Nick Alcock noreply at github.com
Wed Nov 29 15:18:54 UTC 2023


  Branch: refs/heads/nix/review/configury
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 197be99b3add0d60e035eaa14faab965085f66bc
      https://github.com/oracle/dtrace-utils/commit/197be99b3add0d60e035eaa14faab965085f66bc
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M Makeconfig
    M Makeoptions

  Log Message:
  -----------
  build: overridable configuration variables

The Makeconfig checks are purely compile-time, so should always work: but if
they don't, it is sometimes desirable to be able to override them.

This change causes every check-* invocation in Makeconfig to respond to
HAVE_* make variables set on the command line, and also to produce a line in
'make help' of the general form

HAVE_LIBSYSTEMD=[yes/no]	Override check for presence of sd_notify in libsystemd

etc.

(The escaping in make-override-help to figure out how many tabs to insert to
properly align the help will make your eyes bleed. One $ for every nested
$(eval $(call ...)): thank goodness they're all at the same level!)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 8dbaa420c046f9603781cbde7e132b05874fd429
      https://github.com/oracle/dtrace-utils/commit/8dbaa420c046f9603781cbde7e132b05874fd429
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M GNUmakefile

  Log Message:
  -----------
  build: get the architecture from gcc -dumpmachine, not uname -m

This makes it at least *possible* to support cross-compilation.
It doesn't mean we do support it, but it's the first necessary
prerequisite for such support.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 171afb1fbf56a84085551c9783ebc0f6324400ab
      https://github.com/oracle/dtrace-utils/commit/171afb1fbf56a84085551c9783ebc0f6324400ab
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M GNUmakefile

  Log Message:
  -----------
  build: avoid building config.mk unnecessarily

'make help' and similar targets in a clean tree can take quite a
long time, and can even fail(!), because the unconditional inclusion
of config.mk forces all the Makeconfig machinery to run even if we
are doing nothing that might ever need any of it.

Include it only when we're not asking for things like help,
make dist, make clean and things like that.  (A surprising amount
does depend on config.mk and more will depend on it once we start
to optionally bake installation paths into it, but this subset
seems likely never to need it.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: e500192b18ed8cebbbb02ddcafeda56cef26d154
      https://github.com/oracle/dtrace-utils/commit/e500192b18ed8cebbbb02ddcafeda56cef26d154
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M Makeconfig
    M Makeoptions

  Log Message:
  -----------
  build: support make help-overrides and make help-options

These provide only *part* of the make help output, and as a side
benefit shuffle the output into a somewhat better order.

Used by the upcoming configure script to avoid needlessly
reduplicating help text.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: daa20dc27e38700b042942d7e201ddfeb3766b7b
      https://github.com/oracle/dtrace-utils/commit/daa20dc27e38700b042942d7e201ddfeb3766b7b
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M GNUmakefile
    M README.md
    A configure

  Log Message:
  -----------
  build: add configure script

This serves three purposes:
 - let you bake configuration into build/config.* so that you don't
   need to specify the same arguments to make repeatedly
 - provide a somewhat familiar interface to builders
 - provide more documentation for bits of the build configuration
   which there was no place to document (notably Make variables
   overridden by the user, which were documented only
   intermittently in comments in the top-level GNUmakefile).

It is *not* generated by Autoconf but is a short and hopefully
comprehensible shell script.

Internally it's fairly boring.

Overrides of makefile variables go into a new config-vars.mk, which is
written as a unit, since their construction is very cheap and they don't
need the variable-by-variable, test-by- test construction process used for
variables that end up in config.{mk,h}.

Some of the help (for all the Makeconfig overrides) is printed by calling
"make help-overrides", which ultimately derives it from the Makeconfig
itself.  (Unfortunately I can't see a way to generate the actual
write_config_var invocations from the same place, so there's still a bit of
extra work to do when you add new Makeconfig tests.)

The rest of the "make help" -- and really most of the configure script -- is
duplicative of stuff already in the GNUmakefile, but I can't see a way to
automate its generation without ending up with *way* more automation than we
have duplicated code here.

In the GNUmakefile, the biggest impact is making all the paths normal
recursively evaluated variables, so that they can pick up
configure-generated paths (which are defined later), and moving most of the
rest of the non-configure-modified variables down below the inclusion of
config-vars.mk.  This gives the desired properties for defaulting:

 - doing nothing causes the assignments in the Makefile to kick in
 - defining stuff via configure causes them to be overridden by
   further assignments in the config-vars.mk (which values are then
   picked up by the moved-down assignments
 - passing stuff on the make command line does what that normally
   does, and suppresses the corresponding in-makefile variable
   assignments, both in GNUmakefile itself and in config-vars.mk,
   thus overriding both the defaults and configure-generated paths

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


Compare: https://github.com/oracle/dtrace-utils/compare/197be99b3add%5E...daa20dc27e38



More information about the DTrace-devel mailing list