OSDN Git Service

Fix phony dependency marshmallow-x86 android-x86-6.0-r3
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 14 Apr 2017 04:10:26 +0000 (12:10 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 14 Apr 2017 04:10:26 +0000 (12:10 +0800)
It's wrong to let the toybox executable depend on a phony target
toybox_links. It makes "Nothing to be done" not work.

Rewrite the rules by LOCAL_POST_INSTALL_CMD like the toolbox does.

Android.mk

index 3144913..b3a24ac 100644 (file)
@@ -268,7 +268,7 @@ LOCAL_MODULE := toybox
 
 # for dumping the list of toys
 TOYBOX_INSTLIST := $(HOST_OUT_EXECUTABLES)/toybox-instlist
-LOCAL_ADDITIONAL_DEPENDENCIES := toybox_links
+LOCAL_ADDITIONAL_DEPENDENCIES := $(TOYBOX_INSTLIST)
 
 # we still want a link for ls/ps, but the toolbox version needs to
 # stick around for compatibility reasons, for now.
@@ -279,18 +279,11 @@ TOYS_FOR_XBIN := ls ps
 # image though.
 TOYS_WITHOUT_LINKS := blkid traceroute6
 
-include $(BUILD_EXECUTABLE)
-
-toybox_links: $(TOYBOX_INSTLIST) toybox
-toybox_links: TOY_LIST=$(shell $(TOYBOX_INSTLIST))
-toybox_links: TOYBOX_BINARY := $(TARGET_OUT)/bin/toybox
-toybox_links:
-       @echo -e ${CL_CYN}"Generate Toybox links:"${CL_RST} $(TOY_LIST)
-       @mkdir -p $(TARGET_OUT)/bin
-       @mkdir -p $(TARGET_OUT)/xbin
-       $(hide) $(foreach t,$(filter-out $(TOYS_FOR_XBIN) $(TOYS_WITHOUT_LINKS),$(TOY_LIST)),ln -sf toybox $(TARGET_OUT_EXECUTABLES)/$(t);)
-       $(hide) $(foreach t,$(TOYS_FOR_XBIN),ln -sf /system/bin/toybox $(TARGET_OUT_OPTIONAL_EXECUTABLES)/$(t);)
+LOCAL_POST_INSTALL_CMD := $(hide) \
+       echo "Generate Toybox links:" $$($(TOYBOX_INSTLIST)); \
+       $(TOYBOX_INSTLIST) | grep -vFx -f <(tr ' ' '\n' <<< '$(TOYS_FOR_XBIN) $(TOYS_WITHOUT_LINKS)') | xargs -I'{}' ln -sf toybox '$(TARGET_OUT_EXECUTABLES)/{}'
 
+include $(BUILD_EXECUTABLE)
 
 # This is used by the recovery system
 include $(CLEAR_VARS)