1, this code download from Zilong, although not understand, should be the general version. https://gist.github.com/andyque/6060595
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = game_shared local_module_filename: = Libgame #traverse All the directory and Subdirectorydefine walk $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) Endef #traverse Classes directoryallfiles = $ (call walk, $ (local_path)/. /.. /classes) File_list: = Hellocpp/main.cppfile_list + = $ (filter%.cpp, $ (allfiles)) File_includes: = $ (Shell find $ (LOCAL_PA TH)/. /.. /classes-type d) #source file would be compiledlocal_src_files: = $ (file_list:$ (Local_path)/%=%) Local_c_includes: = $ (Local_path)/. /.. /.. /external/box2d/$ (file_includes) Local_whole_static_libraries: = cocos2dx_static cocosdenshion_static Cocos_ Extension_static box2d_static include $ (build_shared_library) $ (call Import-module,cocosdenshion/android) $ (cal L IMPORT-MODULE,COCOS2DX) $ (call Import-module,extensions) $ (call import-module,external/box2d)
2. My own
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpp#traverse all the directory and Subdirectorydefine walk $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ ( Call Walk, $ (e))) endef #traverse Classes directoryallfiles = $ (call walk, $ (local_path)/. /.. /classes) File_list: = Hellocpp/main.cppfile_list + = $ (filter%.cpp, $ (allfiles)) File_list + = $ (filter%.c, $ (allfiles)) F Ile_includes: = $ (Shell find $ (local_path)/. /.. /classes-type d) #source file would be compiledlocal_src_files: = $ (file_list:$ (Local_path)/%=%) Local_c_includes: = $ (Local_path)/. /.. /.. /external/box2d/$ (file_includes) Local_whole_static_libraries: = cocos2dx_static cocosdenshion_static Cocos_ Extension_static Box2d_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)
Automatic generation of CPP files in android.mk files in Cocos2d-x