No nonsense, direct paste, save time. where improvements are needed, please point out that you can learn together.
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = libcocos2dcpp################################################################################################## ###### #手动遍历文件夹以及子目录 ####################################################### #这是第一种很麻烦的写法 ######################## ######## #XLOCAL_C_INCLUDES: = # $ (local_path)/hellocpp # $ (local_path)/... /.. /classes# #XLOCAL_CPPS: = # $ (wildcard $ (Local_path)/hellocpp/*.cpp) # $ (WILDCA RD $ (Local_path)/.. /.. /CLASSES/*.C) # $ (wildcard $ (local_path)/... /.. /classes/*.cpp) # #XLOCAL_SRC_FILES: = $ (xlocal_cpps:$ (Local_path)/%=%) # #LOCAL_C_INCLUDES + = $ (xlocal_c_includes) # Local_src_files: = $ (xlocal_src_files) ########################################################################## ############################################################################################################# #自动Traverse folders and subdirectories ####################################################### #这是第二种比较方便的写法 ############################### Functions that traverse directories and subdirectories #define WALK # $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) #endef # # Traversal class Es directory #ALLFILES = $ (call walk, $ (local_path)/. /.. /classes) # #FILE_LIST: = hellocpp/main.cpp # # extract all. cpp files from all files #FILE_LIST + = $ (filter%.cpp, $ (AL Lfiles) # #LOCAL_SRC_FILES: = $ (file_list:$ (Local_path)/%=%) #LOCAL_C_INCLUDES: = $ (local_path)/... /.. /classes # $ (local_path)/... /.. /classes/logclass############################################################################################# ########################################################################################## #自动遍历文件夹以及子目录 ( source files and header files) ######################################### #这是第三种之相对最方便的写法 ############################ Configure your own source file directory and source file suffix name App_files_path: = $ (Local_path) $ (local_path)/. /.. /classesapp_files_suffix: =%.cpp%.c# recursively traverse directoryUnder All Files rwildcard=$ (wildcard $1$2) $ (foreach d,$ (wildcard $1*), $ (call Rwildcard, $d/,$2)) # gets the corresponding source file App_all_files: = $ ( foreach src_path,$ (App_files_path), $ (call rwildcard,$ (Src_path), *. *)) App_all_files: = $ (app_all_files:$ (app_cpp_ PATH)/./%=$ (app_cpp_path)%) App_src_list: = $ (Filter $ (app_files_suffix), $ (app_all_files)) App_src_list: = $ (app_src_ list:$ (Local_path)/%=%) # removes duplicate words from a string define Uniq = $ (eval seen: =) $ (foreach _,$1,$ (if $ (filter $_,${seen}), $ (eval seen + = $_))) ${seen}endef# recursive traversal gets all directories app_all_dirs: = $ (dir $ (foreach src_path,$ (App_files_path), $ (call rwildcard,$ (Src_path) , */))) App_all_dirs: = $ (call uniq,$ (app_all_dirs)) # Assignment to the NDK compilation system Local_src_files: = $ (app_src_list) Local_c_includes: = $ ( App_all_dirs) ############################################################################## #LOCAL_WHOLE_STATIC _libraries: = cocos2dx_staticlocal_whole_static_libraries + = cocosdenshion_staticlocal_whole_static_libraries + = Box2d_staticlocal_whole_static_libraries + = Cocosbuilder_staticloCal_whole_static_libraries + = spine_staticlocal_whole_static_libraries + cocostudio_staticlocal_whole_static_ LIBRARIES + = Cocos_network_staticlocal_whole_static_libraries + cocos_extension_staticinclude $ (BUILD_SHARED_ LIBRARY) $ (call Import-module,.) $ (call import-module,audio/android) $ (call import-module,box2d) $ (call Import-module,editor-support/cocosbuilder) $ ( Call Import-module,editor-support/spine) $ (call Import-module,editor-support/cocostudio) $ (call Import-module, Network) $ (call import-module,extensions)