From d133fc2c71fb6b0358af453b03bcb6d1874e902a Mon Sep 17 00:00:00 2001 From: Etienne Cordonnier Date: Fri, 3 Mar 2023 12:25:40 +0100 Subject: [PATCH 01/15] 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 --- debian/adb.mk | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/adb.mk b/debian/adb.mk index 8dbacf9a..97c9d6ca 100644 --- a/debian/adb.mk +++ b/debian/adb.mk @@ -1,3 +1,4 @@ +include ../../rules_yocto.mk NAME = adb SOURCES = client/adb_client.cpp \ @@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \ 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 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) 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) -- 2.36.1.vfs.0.0