Android AOSP Android.mk - `$(call all-subdir-makefiles)` Path problems
In order to use the macro $(call all-subdir-makefiles)
in a Makefile
when building AOSP or one of the modules,
one has to save and restore the $LOCAL_PATH
.
$LOCAL_PATH
gets overwritten from called subdir makefiles.$(call my-dir)
must be called beforeinclude $(call all-subdir-makefiles)
- => So we redefine
$LOCAL_PATH
after the call to the subdir makefile
Example
# Save LOCAL_PATH of the current Android.mk file
SAVED_LOCAL_PATH := $(call my-dir)
# Include/Call all Android.mk recursively
include $(call all-subdir-makefiles)
# Restore LOCAL_PATH variable
LOCAL_PATH:= $(SAVED_LOCAL_PATH)
Source: https://groups.google.com/forum/#!topic/android-ndk/7cUf3tkuBSM