patching adb.mk to build in yocto environment. Changes include: Introduced an output folder which will keep all the outputs from the android-tools. Adding an include file that is setting the common flags. Changed the cppflag to include the headers from other components of android-tools Modified LDflags so that the libraries that are coming from other android-tools are searched in the output folder. Modified the build rule so that it outputs the binary to the OUT_DIR Signed-off-by: Nisha Parrakat Upstream-Status: Pending --- git/system/core/debian/adb.mk 2021-04-29 21:11:00.617892503 +0200 +++ git/system/core/debian/adb.mk 2021-04-29 21:17:33.256016600 +0200 @@ -1,3 +1,4 @@ +include ../../rules_yocto.mk NAME = adb SOURCES = client/adb_client.cpp \ @@ -12,10 +13,10 @@ SOURCES := $(foreach source, $(SOURCES), adb/$(source)) CXXFLAGS += -std=gnu++2a -CPPFLAGS += -Iinclude -Iadb -Ibase/include \ +CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ \ -DADB_VERSION='"$(DEB_VERSION)"' -DADB_HOST=1 -D_GNU_SOURCE -LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=. \ - -lpthread -L. -ladb -lbase +LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ + -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -ladb -lbase # -latomic should be the last library specified # https://github.com/android/ndk/issues/589 @@ -24,7 +25,8 @@ endif build: $(SOURCES) - $(CXX) $^ -o adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) + mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) clean: - $(RM) adb/$(NAME) + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME)