[LTP] [PATCH] Makefile: Fix module dirs search
Petr Vorel
pvorel@suse.cz
Tue Aug 19 19:09:30 CEST 2025
Hi Martin,
[ Cc Andrea to merge v2 fix ]
> Module dirs search runs relative to current working directory instead
> of the source directory. In an out-of-tree build, the search for makefiles
> will come up empty and grep will try to read from standard input, blocking
> indefinitely. Search for makefiles relative to the source directory to fix
> the issue.
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/Makefile b/Makefile
> index 77270bc7c..7f0ba5e86 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -213,7 +213,7 @@ test-metadata: metadata-all
> $(MAKE) -C $(abs_srcdir)/metadata test
> MODULE_DIRS := $(shell \
> - dirname $$(grep -l 'include.*module\.mk' $$(find testcases/ -type f -name 'Makefile')))
> + dirname $$(grep -l 'include.*module\.mk' $$(find $(abs_srcdir)/testcases/ -type f -name 'Makefile')))
Just having a quick look: v2 will be needed as path is added twice. :(
Build /home/foo/ltp/testcases/commands/insmod
make[1]: Entering directory '/home/pevik/install/src/ltp.git'
make[1]: *** /home/foo/ltp//home/foo/ltp/testcases/commands/insmod: No such file or directory. Stop.
make[1]: Leaving directory '/home/pevik/install/src/ltp.git'
make: *** [Makefile:221: modules] Error 2
I guess removing "$(abs_srcdir)/" will be needed when you add it to find.
+ please add:
Fixes: e3e1fa0e78 ("Makefile: Add kernel modules related make targets")
With the change above you may add my RBT
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
diff --git Makefile Makefile
index 7f0ba5e869..d47b2528e9 100644
--- Makefile
+++ Makefile
@@ -220,17 +220,17 @@ MODULE_DIRS := $(shell \
modules:
@$(foreach dir,$(MODULE_DIRS),\
echo "Build $(dir)";\
- $(MAKE) -C $(abs_srcdir)/$(dir) || exit $$?; \
+ $(MAKE) -C $(dir) || exit $$?; \
)
modules-clean:
@$(foreach dir,$(MODULE_DIRS),\
echo "Build $(dir)";\
- $(MAKE) -C $(abs_srcdir)/$(dir) clean || exit $$?; \
+ $(MAKE) -C $(dir) clean || exit $$?; \
)
modules-install: modules
@$(foreach dir,$(MODULE_DIRS),\
echo "Build $(dir)";\
- $(MAKE) -C $(abs_srcdir)/$(dir) install || exit $$?; \
+ $(MAKE) -C $(dir) install || exit $$?; \
)
## Help
More information about the ltp
mailing list