Multiple executable programs, dynamic libraries, and static libraries can be generated in an android. mk file.
1. Compile the Application Template:
# Test exe
Local_path: = $ (call my-DIR)
# Include $ (clear_vars)
Local_src_files: = Main. c
Local_module: = test_exe
# Local_c_includes: =
# Local_static_libraries: =
# Local_shared_libraries: =
Include $ (build_executable)
(Cainiao-level explanation: = is the meaning of the value assignment, $ is to reference the value of a variable.) Add the source file path to local_src_files and add the header file path to local_c_pair des, local_static_libraries is added to the static library to be linked (*. a) Name: add the dynamic library to be linked in local_shared_libraries (*. so) name. local_module indicates the final name of the module, and build_executable indicates compiling in an executable program.
2. Compile the static library template:
# Test static lib
Local_path: = $ (call my-DIR)
Include $ (clear_vars)
Local_src_files: =/
Helloworld. c
Local_module: = libtest_static
# Local_c_includes: =
# Local_static_libraries: =
# Local_shared_libraries: =
Include $ (build_static_library)
In general, it is similar to the above. build_static_library indicates compiling a static library.
3. Compile the dynamic library template:
# Test shared lib
Local_path: = $ (call my-DIR)
Include $ (clear_vars)
Local_src_files: =/
Helloworld. c
Local_module: = libtest_shared
Target_prelink_modules: = false
# Local_c_includes: =
# Local_static_libraries: =
# Local_shared_libraries: =
Include $ (build_shared_library)
In general, it is similar to the above. build_shared_library indicates compiling a shared library.