[][openwrt][common][sdk][Refactor support for clangd]

[Description]
Refactor support for clangd
1. Patch codechecker to build only native ldlogger.so
2. Write .clangd for packages for accurate indexing

[Release-log]
N/A

Change-Id: I996933098dd42f15142edbf4002fde75f9e6d196
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8215260
diff --git a/tools/codechecker/Makefile b/tools/codechecker/Makefile
index e0d67eb..73ed4c0 100644
--- a/tools/codechecker/Makefile
+++ b/tools/codechecker/Makefile
@@ -16,11 +16,11 @@
 include $(INCLUDE_DIR)/host-build.mk
 
 define Host/Compile
-	$(MAKE) -C $(HOST_BUILD_DIR)/analyzer/tools/build-logger all
+	$(MAKE) -C $(HOST_BUILD_DIR)/analyzer/tools/build-logger -f Makefile.native ldlogger.so
 endef
 
 define Host/Install
-	$(INSTALL_DATA) $(HOST_BUILD_DIR)/analyzer/tools/build-logger/build/lib/`uname -m`/ldlogger.so $(STAGING_DIR_HOST)/lib/
+	$(INSTALL_DATA) $(HOST_BUILD_DIR)/analyzer/tools/build-logger/ldlogger.so $(STAGING_DIR_HOST)/lib/
 endef
 
 define Host/Clean
diff --git a/tools/codechecker/patches/build-native-ldlogger-so.patch b/tools/codechecker/patches/build-native-ldlogger-so.patch
new file mode 100644
index 0000000..262bc60
--- /dev/null
+++ b/tools/codechecker/patches/build-native-ldlogger-so.patch
@@ -0,0 +1,8 @@
+--- a/analyzer/tools/build-logger/Makefile.native
++++ b/analyzer/tools/build-logger/Makefile.native
+@@ -0,0 +1,5 @@
++include Makefile
++
++# ldlogger lib native
++ldlogger.so: $(LDLOGGER_LIB_SOURCES) $(LDLOGGER_LIB_HEADERS)
++	$(CC) $(CPPFLAGS) $(LIB_CFLAGS) $(LIB_LDFLAGS) $(LDLOGGER_LIB_SOURCES) $(LDLOGGER_SOURCES) -o $@