In writing an android .mk file, is there a short way to include many source files which are in different folders and subfolders? Like a loop or a code for iterating the folders? For example:
folder1
|---subfolder1.1
|---subfolder1.1.1 |---some cpp files |--subfolder1.1.2 |--some cpp files
folder2
|---subfolder2.1
|--subfolder2.1.1 |--some cpp files
|--(so on and so forth, another folders and subfolders and cpp files)
I know I can use include $(call all-subdir-makefiles)
for folders and subfolders but it will take too much time if I have so many folders, is there a better way? Like a loop for iterating through the folders? So I will have just one library for folder1 and another for folder2 and so on...
FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/**/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/**/**/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
You can use ** wildcard to include files from all subdirectories:
LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard folder/**/*.cpp))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With