如何设置 Android Makefile 来复制/重命名文件?
根据 Android 在线文档,目前无法在 Android makefile 中为 gcc 编译器指定多个/混合文件扩展名。我正在使用的源是一个公共项目,有多个扩展名,为了使其编译,我需要在构建之前使用其他扩展名 .cpp 重命名文件。
我设置了一个项目子文件夹,我可以将这些文件复制到其中并重命名它们,然后从那里链接到它们,但我想让此步骤成为构建过程的一部分,以便任何时候修改这些文件时我都可以确定这个版本将反映这些变化。
我不知道如何告诉 Android.mk 文件复制文件并重命名它们。我尝试了这个,但它不起作用:
cp '$(LOCAL_PATH)/$(SOURCE_ROOT)/Sprite.mm' '$(LOCAL_PATH)/$(MM_RENAMES)/Sprite.cpp'
我收到以下错误:
Anhdroid.mk:10 * 缺少分隔符。停止。
谢谢,
更新
另外,如果有人知道一种在 makefile 开头嵌入执行 shell/Perl 脚本的调用的方法也可以。
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.
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 * missing separator. Stop.
Thanks,
Update
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,明白了,这可以复制文件:
这也可以运行外部脚本:
Ok, got it, this worked to copy files:
And this also works to run an outside script: