How can I set an Android Makefile to copy/rename files?

不打扰是莪最后的温柔 提交于 2019-12-08 02:39:48

问题


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.


回答1:


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)


来源:https://stackoverflow.com/questions/5327383/how-can-i-set-an-android-makefile-to-copy-rename-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!