Revert "ANDROID: kbuild: simplify cmd_mod"

This reverts commit 631b20dd6c9c ("ANDROID: kbuild: simplify cmd_mod")
since this causes regression in how Kbuild handles dependencies.

Bug: 175420575
Change-Id: I162eedf19357287c5ab9840ed84081d071aa320b
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 17d04ea..3f6bf0e 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -272,11 +272,10 @@
 	$(call if_changed_rule,cc_o_c)
 	$(call cmd,force_checksrc)
 
-cmd_mod = $(file >$@,\
-		$(if $($*-objs)$($*-y)$($*-m), \
-			$(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), \
-			$(@:.mod=.o))) \
-	$(undefined_syms) echo >> $@
+cmd_mod = { \
+	echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \
+	$(undefined_syms) echo; \
+	} > $@
 
 $(obj)/%.mod: $(obj)/%.o FORCE
 	$(call if_changed,mod)