Makefile: Optimize the code for creating the kernel module list

The time needed for executing shell code strongly depends on how many
times the shell has to call fork(). Hence, instead of invoking 'basename'
once per kernel module, invoke 'basename' once for all kernel modules.

Change-Id: Ibe322c8ebf0a466568f902beb5ab91988381678c
Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/core/Makefile b/core/Makefile
index b023df1..381b9f7 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -465,9 +465,7 @@
 	)
 	$(if $(1),\
 	  cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \
-	  for MODULE in $$(PRIVATE_LOAD_MODULES); do \
-	    basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \
-	  done; \
+	  if [ -n "$$(PRIVATE_LOAD_MODULES)" ]; then basename -a $$(PRIVATE_LOAD_MODULES); fi > $$(PRIVATE_LOAD_FILE); \
 	)
 	# The ln -sf + find -delete sequence is to remove any modules in
 	# PRIVATE_EXTRA_MODULES which have same basename as MODULES in PRIVATE_MODULES