mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 11:54:38 +01:00
build: Add gitrev as a dependency to specific targets that require it
The gitrev target was added as a dependency of the "all" target ine6c093dd94as 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
This commit is contained in:
1 parent
f704841016
commit
7adc908d33
3 files changed
+9
-4
No files matched your search
+3
-1
@@ -67,9 +67,11 @@ GITREV = include/zfs_gitrev.h
|
||||
CLEANFILES += $(GITREV)
|
||||
PHONY += gitrev
|
||||
gitrev:
|
||||
cd "$(abs_top_builddir)"; \
|
||||
$(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV)
|
||||
|
||||
all: gitrev
|
||||
GITREV_TARGETS := $(shell $(GREP) -rl --include="*.[ch]" $(notdir $(GITREV)) "$(abs_srcdir)"/* | sed "s|$(abs_srcdir)/||" )
|
||||
$(GITREV_TARGETS): gitrev
|
||||
|
||||
PHONY += install-data-hook $(INSTALL_DATA_HOOKS)
|
||||
install-data-hook: $(INSTALL_DATA_HOOKS)
|
||||
|
||||
@@ -102,7 +102,7 @@ override_dh_auto_install:
|
||||
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' | sed '/ZFS_AC_PACKAGE/d' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
|
||||
@# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
|
||||
@# Do not regenerate zfs_gitrev.h during dkms build
|
||||
sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;/make_gitrev.sh/d' \
|
||||
sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;s/\([^\t]*make_gitrev.sh\)/: \1/' \
|
||||
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
@# Sanity test
|
||||
grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
|
||||
|
||||
+5
-2
@@ -3,13 +3,13 @@ include Kbuild
|
||||
INSTALL_MOD_DIR ?= extra
|
||||
INSTALL_MOD_PATH ?= $(DESTDIR)
|
||||
|
||||
all: modules
|
||||
all: modules gitrev
|
||||
distclean maintainer-clean: clean
|
||||
install: modules_install data_install
|
||||
uninstall: modules_uninstall data_uninstall
|
||||
check:
|
||||
|
||||
.PHONY: all distclean maintainer-clean install uninstall check distdir \
|
||||
.PHONY: all distclean maintainer-clean install uninstall check distdir gitrev \
|
||||
modules modules-Linux modules-FreeBSD modules-unknown \
|
||||
clean clean-Linux clean-FreeBSD \
|
||||
modules_install modules_install-Linux modules_install-FreeBSD \
|
||||
@@ -51,6 +51,9 @@ endif
|
||||
|
||||
FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
|
||||
|
||||
gitrev:
|
||||
$(MAKE) -C "@abs_top_builddir@" gitrev
|
||||
|
||||
modules-Linux:
|
||||
mkdir -p $(sort $(dir $(spl-objs) $(spl-)))
|
||||
mkdir -p $(sort $(dir $(zfs-objs) $(zfs-)))
|
||||
|
||||
Reference in new issue
Block a user