|-test|---Android.mk|---Application.mk|---sub1|------Android.mk|------main.c |---sub2 |------Android.mk |------main.c
拿上边的文件结构为例
test/Android.mk
include $(call all-subdir-makefiles)
test/sub1/Android.mk
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_CFLAGS += -pie -fPIE LOCAL_LDFLAGS += -pie -fPIE -llogTARGET_PLATFORM := android-22 LOCAL_MODULE := module1LOCAL_SRC_FILES := main.cinclude $(BUILD_EXECUTABLE)
test/sub2/Android.mk
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)ARGET_PLATFORM := android-22LOCAL_MODULE := module2LOCAL_SRC_FILES := main.cinclude $(BUILD_SHARED_LIBRARY)
原理就是 all-subdir-makefiles 这个宏会返子文件夹下所有Android.mk文件的路径