Android NDK 同时编译多个模块
|-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 -llog TARGET_PLATFORM := android-22 LOCAL_MODULE := module1 LOCAL_SRC_FILES := main.c include $(BUILD_EXECUTABLE)
test/sub2/Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) ARGET_PLATFORM := android-22 LOCAL_MODULE := module2 LOCAL_SRC_FILES := main.c include $(BUILD_SHARED_LIBRARY)
原理就是 all-subdir-makefiles 这个宏会返子文件夹下所有Android.mk文件的路径