Refine lsdump_paths.txt dependencies

This commit moves $(LSDUMP_PATHS) from the prerequisite of
lsdump_paths.txt to the prerequisite of findlsdumps. This change makes
it possible to dump the list of lsdump files without actually building
all lsdump files.

Bug: 124829578
Test: make out/target/product/generic/lsdump_paths.txt
      # does not build the actual lsdump files
Test: make findlsdumps  # builds lsdump_paths.txt and all lsdump files
Change-Id: I924f1c0c61391e958521c376a061651f2a301adb
diff --git a/core/Makefile b/core/Makefile
index a211f13..88ad48b 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4582,9 +4582,3 @@
 ifneq ($(sdk_repo_goal),)
 include $(TOPDIR)development/build/tools/sdk_repo.mk
 endif
-
-#------------------------------------------------------------------
-# Find lsdump paths
-FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
-$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
-	$(hide) rm -rf $@ && echo "$^" | sed -e 's/ /\n/g' > $@
diff --git a/core/main.mk b/core/main.mk
index 610ab28..cbbafc5 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1581,8 +1581,15 @@
 .PHONY: findbugs
 findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
 
+LSDUMP_PATHS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
+
 .PHONY: findlsdumps
-findlsdumps: $(FIND_LSDUMPS_FILE)
+findlsdumps: $(LSDUMP_PATHS_FILE) $(LSDUMP_PATHS)
+
+$(LSDUMP_PATHS_FILE): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS)
+$(LSDUMP_PATHS_FILE):
+	@echo "Generate $@"
+	@rm -rf $@ && echo "$(PRIVATE_LSDUMP_PATHS)" | sed -e 's/ /\n/g' > $@
 
 .PHONY: check-elf-files
 check-elf-files: