core/Makefile: Define write-file-lines unconditionally

Right now write-file-lines is defined only if BUILDING_SYSTEM_IMAGE is
true. This means split build / partial build targets that doesn't build
the system image, would fail to build other partition images too
because the $(<parttition>image_intermediates)/file_list.txt build rule
would be undefined.

Move the macro definition out of the `ifdef BUILDING_SYSTEM_IMAGE`
conditional block.

Bug: 326359088
Test: build a target that doesn't build system image
Change-Id: I020c28f7011bd0df0330ba3350e50bea2b75aab4
diff --git a/core/Makefile b/core/Makefile
index d4e241e..f126211 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3395,6 +3395,14 @@
 
 FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
 
+define write-file-lines
+$(1):
+	@echo Writing $$@
+	rm -f $$@
+	echo -n > $$@
+	$$(foreach f,$(2),echo "$$(f)" >> $$@$$(newline))
+endef
+
 # -----------------------------------------------------------------
 ifdef BUILDING_SYSTEM_IMAGE
 
@@ -3448,14 +3456,6 @@
 $(systemimage_intermediates)/staging_dir.stamp: $(FULL_SYSTEMIMAGE_DEPS)
 	touch $@
 
-define write-file-lines
-$(1):
-	@echo Writing $$@
-	rm -f $$@
-	echo -n > $$@
-	$$(foreach f,$(2),echo "$$(f)" >> $$@$$(newline))
-endef
-
 # $(1): output file
 define build-systemimage-target
   @echo "Target system fs image: $(1)"