From c57894c204332ef175947d86064714e794230d03 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 28 Oct 2016 16:30:48 -0700 Subject: [PATCH] Improve dotdot workaround when src begins with '/' There are some source files in our tree that use some text processing to find source files, and end up with source file names that look like: /../../dir/file.c This isn't fixed by our dotdot workarounds because the filename doesn't start with '../', so strip the initial '/' from any source files, since they are all relative to $(LOCAL_PATH) anyways. Bug: 32514380 Test: Build internal source with this problem Test: Compare build-aosp_angler.ninja before/after Change-Id: If869419c3d3ba35d55f6e19d9332515695e47d24 --- core/binary.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index 0f9ef2f8a..28ac56f69 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -324,6 +324,10 @@ $(error $(my_missing_exclude_files)) endif my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files)) +# Strip '/' from the beginning of each src file. This helps the ../ detection in case +# the source file is in the form of /../file +my_src_files := $(patsubst /%,%,$(my_src_files)) + my_clang := $(strip $(LOCAL_CLANG)) ifdef LOCAL_CLANG_$(my_32_64_bit_suffix) my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix)))