如何设置一个Android的Makefile复制/重命名文件?重命名、如何设置、文件、Makefile

由网友(野趣味)分享简介:根据Android的在线文档有目前还没有办法在Android生成文件来指定gcc编译多个/混合文件扩展名。我使用的源头,一个公益项目,有多个扩展和为了得到它来编译,我需要与其他扩展构建之前的.cpp重命名这些文件。According to the Android online docs there's current...

根据Android的在线文档有目前还没有办法在Android生成文件来指定gcc编译多个/混合文件扩展名。我使用的源头,一个公益项目,有多个扩展和为了得到它来编译,我需要与其他扩展构建之前的.cpp重命名这些文件。

According to the Android online docs there's currently no way to specify multiple/mixed file extensions for the gcc compiler in an Android makefile. The source I'm using, a public project, has multiple extensions and in order to get it to compile I need to rename the files with the other extensions .cpp before build.

我成立了一个项目子文件夹,我可以将这些文件复制到将其重新命名,然后只链接到他们从那里,但我想使这个步骤构建过程的一部分,以便任何时候这些文件被修改我可以肯定这个版本将反映这些变化。

I set up a project subfolder I can copy these files into and rename them and then just link to them from there but I'd like to make this step a part of the build process so that any time those files are modified I can be certain this build will reflect those changes.

我不知道如何告诉Android.mk文件复制文件并重新命名。我试过,但它不工作:

I'm not sure how to tell the Android.mk file to copy the files and rename them. I tried this but it doesn't work:

cp '$(LOCAL_PATH)/$(SOURCE_ROOT)/Sprite.mm' '$(LOCAL_PATH)/$(MM_RENAMES)/Sprite.cpp'

我收到以下错误:

I receive the following error:

Anhdroid.mk:10的 * 的丢失分隔符。停止。

Anhdroid.mk:10 * missing separator. Stop.

谢谢,

更新

另外,如果有人知道的方式嵌入一个呼叫在makefile的开始执行shell / Perl脚本,将工作太。

Alternatively, if someone knows a way to embed a call to execute a shell/Perl script in the beginning of the makefile would work too.

推荐答案

好,我知道,这个工作拷贝文件:

Ok, got it, this worked to copy files:

$(shell cp -fr $(LOCAL_PATH)/$(SOURCE_ROOT)/Sprite.mm $(LOCAL_PATH)/$(MM_RENAMES)/Sprite.cpp)

这也适用于运行外部脚本:

And this also works to run an outside script:

$(perl scripts/foo.pl)
阅读全文

相关推荐

最新文章