diff options
author | Aditya Kumar <appujee@google.com> | 2024-03-05 17:50:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-05 17:50:10 +0000 |
commit | 9aa1265fbe665d017f2f13853f3f20c094ed8c3b (patch) | |
tree | 5a3d32c67bb77822182ee7c071361b8a1ed2645f | |
parent | c54c841ebe4aeee4aa1f7f8b3f41fbeb7d9176f0 (diff) | |
parent | 3bf7c4fc22c4464361920524807eef68a742b35b (diff) | |
download | build-9aa1265fbe665d017f2f13853f3f20c094ed8c3b.tar.gz |
Merge "Add CLANG_EXTERNAL_CFLAGS to both vendor and hardware directories" into main
-rw-r--r-- | core/binary.mk | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/binary.mk b/core/binary.mk index 6dab49ca44..b17ab00aad 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -481,6 +481,34 @@ ifneq ($(filter external/%,$(LOCAL_PATH)),) my_cflags += $(CLANG_EXTERNAL_CFLAGS) endif +# Extra cflags for projects under hardware/ directory. +# This should match the definition of `thirdPartyDirPrefixExceptions` +# in build/soong/android/paths.go. +# Get the second element of LOCAL_PATH +ifneq ($(filter hardware/%,$(LOCAL_PATH)),) + my_subdir := $(word 2,$(subst /,$(space),$(LOCAL_PATH))) + must_compile_hardware_subdirs := \ + hardware/google/% \ + hardware/interfaces/% \ + hardware/libhardware/% \ + hardware/libhardware_legacy/% \ + hardware/ril/% + ifeq ($(filter $(must_compile_hardware_subdirs),$(my_subdir)),) + my_cflags += $(CLANG_EXTERNAL_CFLAGS) + endif +endif + +# Extra cflags for projects under vendor/ directory. +# This should match the definition of `thirdPartyDirPrefixExceptions` +# in build/soong/android/paths.go. +ifneq ($(filter vendor/%,$(LOCAL_PATH)),) + my_subdir := $(word 2,$(subst /,$(space),$(LOCAL_PATH))) + # Do not add the flags for any subdir that contains the string "google". + ifneq ($(findstring google,$(my_subdir)),) + my_cflags += $(CLANG_EXTERNAL_CFLAGS) + endif +endif + # arch-specific static libraries go first so that generic ones can depend on them my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries) my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries) |