Files
freebsd/contrib
crass 7adc908d33 build: Add gitrev as a dependency to specific targets that require it
The gitrev target was added as a dependency of the "all" target in
e6c093dd94 as previous to that it was a dependency of all built
sources, including the dist target for which it is unnecessary. This
the meant that the gitrev target would only be triggered when running
the "all" target. All subtargets that have an indirect dependency would
not trigger the gitrev target. Practically this means that building
directly certain binary targets, like zdb, would fail like so:

$ make zdb
  CC       module/zfs/libzpool_la-abd.lo
... snip ...
  CC       module/zfs/libzpool_la-uberblock.lo
/home/user/zfs.git/module/zfs/spa_history.c:32:10: fatal error: zfs_gitrev.h: No such file or directory
   32 | #include "zfs_gitrev.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:11422: module/zfs/libzpool_la-spa_history.lo] Error 1
make: *** Waiting for unfinished jobs....

Fix the build system to allow building directly binary targets by
finding .c or .h souce files that include zfs_gitrev.h and adding
a rule to have them depend on the gitrev target. This way gitrev
will precisely be built for targets that indirectly require it.

This is a bit tricky for the kernel module because the point at
which the rules need to be defined for targets that require gitrev,
the execution is happening from the kernel build system. So build
as a dependency for all targets in the modules directory.

The debian native builds disable the zfs_gitrev.h generation and
these changes broke that. Instead of deleting lines that contain
make_gitrev.sh, prefix with a ':' to make the command a nop, incase
a command needs to be run there.

Fixes: e6c093dd94 (Fix parallel make srpm)
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Glenn Washburn <[email protected]>
Closes #19067
2026-09-14 09:29:38 -07:00
..
2022-11-29 10:00:56 -08:00