Errors from the linux kmod build are not propagated, since make is
run as the first command in a pipeline, and the shell returns the
exit code of the last command in the pipeline. Run the make command
in a subshell to detect errors, and exit afterwards. (This method
is more portable than bash specific pipeline processing options.)
Thanks to Mark Vitale for pointing out this build system defect
to me.
Change-Id: If3e204fe31dbdc9e7416d52fae897f792d27d678
Reviewed-on: http://gerrit.openafs.org/11186
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
.FORCE:
${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE
env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
- env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules 2>&1 | tee .makelog
- @if [ `grep ^WARNING .makelog | wc -l` -ne 0 ]; then \
- echo Error: Undefined symbols in modules ; \
+ ( env EXTRA_CFLAGS="${EXTRA_CFLAGS}" \
+ $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules 2>&1 \
+ || echo "FAILURE: make exit code $$?" ) | tee .makelog
+ @if grep -E -q '^(FAILURE|WARNING)' .makelog; then \
+ grep -q '^WARNING' .makelog && echo "Error: Undefined symbols in modules" ; \
rm .makelog ; \
exit 1 ; \
fi