* [LTP] [PATCH/RFC] module.mk: don't run module builds multiple times
@ 2015-06-18 12:58 Jan Stancek
2015-06-18 16:35 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Jan Stancek @ 2015-06-18 12:58 UTC (permalink / raw)
To: ltp-list
If there are multiple modules (.ko) in MAKE_TARGETS, make gets executed
multiple times in same directory, which is unnecessary and it also leads
to build breakages in parallel builds. For example:
make -C /lib/modules/3.10.0-229.el7.x86_64/build M=/usr/src/ltp/testcases/kernel/module/delete_module
make -C /lib/modules/3.10.0-229.el7.x86_64/build M=/usr/src/ltp/testcases/kernel/module/delete_module
make[1]: Entering directory `/usr/src/kernels/3.10.0-229.el7.x86_64'
LD /usr/src/ltp/testcases/kernel/module/delete_module/built-in.o
CC [M] /usr/src/ltp/testcases/kernel/module/delete_module/dummy_del_mod.o
make[1]: Entering directory `/usr/src/kernels/3.10.0-229.el7.x86_64'
CC [M] /usr/src/ltp/testcases/kernel/module/delete_module/dummy_del_mod.o
objdump: '/usr/src/ltp/testcases/kernel/module/delete_module/.tmp_dummy_del_mod.o': No such file
mv: cannot stat ‘/usr/src/ltp/testcases/kernel/module/delete_module/.tmp_dummy_del_mod.o’: No such file or directory
make[2]: *** [/usr/src/ltp/testcases/kernel/module/delete_module/dummy_del_mod.o] Error 1
make[1]: *** [_module_/usr/src/ltp/testcases/kernel/module/delete_module] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.10.0-229.el7.x86_64'
make: [dummy_del_mod_dep.ko] Error 2 (ignored)
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.gitignore | 1 +
include/mk/module.mk | 11 ++++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index bc3b354..06acb20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ autom4te.cache
/pan/ltp-pan
/pan/ltp-scanner
+.dep_modules
.gitattributes
.pc/
patches/
diff --git a/include/mk/module.mk b/include/mk/module.mk
index 958796b..28e03bd 100644
--- a/include/mk/module.mk
+++ b/include/mk/module.mk
@@ -45,10 +45,19 @@ MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS))
MAKE_TARGETS += $(if $(filter 2,$(SKIP)),$(wildcard *.ko),)
endif
+CLEAN_TARGETS += .dep_modules
+
+MODULE_SOURCES := $(patsubst %.ko,%.c,$(filter %.ko, $(MAKE_TARGETS)))
+
# Ignoring the exit status of commands is done to be forward compatible with
# kernel internal API changes. The user-space test will return TCONF, if it
# doesn't find the module (i.e. it wasn't built either due to kernel-devel
# missing or module build failure).
-%.ko: %.c
+%.ko: %.c .dep_modules ;
+
+.dep_modules: $(MODULE_SOURCES)
+ @echo "Building modules: $(MODULE_SOURCES)"
-$(MAKE) -C $(LINUX_DIR) M=$(abs_srcdir)
rm -rf *.mod.c *.o *.ko.unsigned modules.order .tmp* .*.ko .*.cmd Module.symvers
+ @touch .dep_modules
+
--
1.8.3.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH/RFC] module.mk: don't run module builds multiple times
2015-06-18 12:58 [LTP] [PATCH/RFC] module.mk: don't run module builds multiple times Jan Stancek
@ 2015-06-18 16:35 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2015-06-18 16:35 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
Looks good to me.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-18 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 12:58 [LTP] [PATCH/RFC] module.mk: don't run module builds multiple times Jan Stancek
2015-06-18 16:35 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.