Study Notes ANDROID.MK Search Yourself Initiative

Source: Internet
Author: User

Recently has been android.mk this is what a frustrating night, click here to record. iOS you worry more. No matter how much. Xcode solves itself. Text tools: Macvim (text editing tools are useful you can clearly distinguish between tab and spaces, in order not to write. MK error) is a description of the source file to the compiler. It is easy to parse. The following is the basic syntax for the Android.mk file generated when cocos2dx-3.2 new project: "#" gaze ": =" assignment "+ =" Append "$" to reference the value of a variable # macro function My-dir returns the current path provided by the compiled system, that is, the folder of the Android.mk # if (helloworld/proj.android/jni/xx) Local_path: = $ (call my-dir) #初始化模块 Reset all variables except the Local_path variable include $ (clear_vars) # Import Library folder $ (call import-add-path,$ (Local_path)/. /.. /COCOS2D) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/external) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/cocos) #模块名, the only.

Local_module: = cocos2dcpp_shared# module file name. Unique (optional) Local_module_filename: = libcocos2dcpp? The path of the implementation file, such as #把. cpp. C. cc, to Local_src_files I'm using the C + + version of the suffix is. cpp When we create a new file, You need to add a path here. Local_src_files: = Hellocpp/main.cpp. /.. /classes/appdelegate.cpp. /.. /classes/helloworldscene.cpp# Configuration header File Search scope Local_c_includes: = $ (local_path)/... /.. /classes# get static library local_whole_static_libraries: = cocos2dx_static# Append static library local_whole_static_libraries + = Cocosdenshion_ static# local_whole_static_libraries + = box2d_static# local_whole_static_libraries + cocosbuilder_static# LOCAL_ Whole_static_libraries + = spine_static# local_whole_static_libraries + cocostudio_static# LOCAL_WHOLE_STATIC_ LIBRARIES + = cocos_network_static# Local_whole_static_libraries + = cocos_extension_static# based on the variables provided by the compiler Build_shared_ Library generates dynamic libraries include $ (build_shared_library) #导入模块. Here are a few modules that are often used $ (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)



Assuming that the file is less directly in the Local_src_files variable to add the path of the file is good
Unfortunately, I have dozens of documents, one after another to join is not exhausted. and difficult to maintain. Difficult to expand, error-prone ...




I am a lazy person, the Kaoziolong people's Mk rewrite a bit

Local_path: = $ (call My-dir) include $ (clear_vars) $ (call import-add-path,$ (Local_path)/. /.. /COCOS2D) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/external) $ (call import-add-path,$ (Local_path)/... /.. /cocos2d/cocos) Local_module: = cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpp#widcard for Extended wildcard # Traverse folders and subfolders define walk $ (wildcard $ (1)) $ (foreach E, $ (wildcard $ (1)/*), $ (call Walk, $ (e))) endef# Traverse Path Classes folder and subfolder files and deposit the allfiles variable in allfiles = $ (call walk, $ (local_path)/. /.. /classes) #从ALLFILES文件夹中提取文件 and deposited in File_list #.cc is the default extension for C + + source files under Linux/unix, with. cpp a meaning #.c because I want to use sqlite3.c file_list: = Hellocpp/main.cppfile_list + = $ (filter%.cpp, $ (allfiles)) File_list + = $ (filter%.c, $ (allfiles)) File_list + = $ (filter%). CC, $ (allfiles)) #搜索Classes下的子文件夹文件FILE_INCLUDES + = $ (Shell find $ (local_path)/. /.. /classes-type d) #依据搜索到的文件名称 compile the resource file Local_src_files: = $ (file_list:$ (Local_path)/%=%) #提供搜索文件的路径LOCAL_C_INCLUDES: = $ ( Local_path)/.. /.. /classes $ (file_includes) #静态库LOCAL_WHOLE_STATIC_LIBRARIES: = Cocos2Dx_staticlocal_whole_static_libraries + = cocosdenshion_static#local_whole_static_libraries + box2d_static#LOCAL_ Whole_static_libraries + = cocosbuilder_static#local_whole_static_libraries + spine_staticlocal_whole_static_ LIBRARIES + = cocostudio_staticlocal_whole_static_libraries + cocos_network_staticlocal_whole_static_libraries + = cocos_extension_static# compiling the dynamic library include $ (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)


Spit Slots: These bits and pieces of something engine should be solved by software development, or.


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Study Notes ANDROID.MK Search Yourself Initiative

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.