2012-11-10 119 views
3

NDK 8B时,Eclipse/Cygwin的Android NDK:自定义预构建步骤?

我想添加自定义的预构建的步骤Android.mk:

1)在源树中的每个名为* .xyz文件,运行定制工具生成对应的.h和.cpp文件

2)在.cpp文件添加到LOCAL_SRC_FILES

我读过this post,它不完全是我要找的(这只是一个文件)

+0

类似http://stackoverflow.com/questions/7651608/simplifying-an-android-mk-file哪位-集结多的可执行文件。我认为你可以调整这个问题的答案来解决你的问题。 – acj

回答

1

根据http://www.gnu.org/software/make/manual/make.html你可以使用老式的后缀规则:

source_xyz_files = a.xyz b.xyz 
.xyz.cpp: $(source_xyz_files) 
    if test "`dirname [email protected]`" != "."; then mkdir -p "`dirname [email protected]`"; fi 
    tool_to_create_cpp_and_h_from_xyz $< [email protected] $(patsubst %.cpp,%.h,[email protected]) 
LOCAL_SRC_FILES += $(patsubst %.xyz,%.cpp,$(source_xyz_files)) 

或拍打规则:

generated_cpp_files = a.cpp b.cpp 
$(generated_cpp_files) : %.cpp : %.xyz 
    if test "`dirname [email protected]`" != "."; then mkdir -p "`dirname [email protected]`"; fi 
    tool_to_create_cpp_and_h_from_xyz $< [email protected] $(patsubst %.cpp,%.h,[email protected]) 
LOCAL_SRC_FILES += $(generated_cpp_files) 
相关问题