问题
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