Overriding commands for target Android Makefile

元气小坏坏 提交于 2020-01-02 05:09:05

问题


I am trying to compile one of the modules in my Android ndk project with g++ although the sources are all in C. My eyes are irritated by the make system warnings:

`C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:348: warning: overriding commands for target 'obj/local/armeabi/objs/xxx/yyy.o'`  
`C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:345: warning: ignoring old commands for target 'obj/local/armeabi/objs/xxx/yyy.o'`

And these warning pairs will be printed as much as there will be the source files and therefore the objects.

I've tried to declare LOCAL_SRC_FILES with all the different flavors.

`LOCAL_SRC_FILES :=  
$(LOCAL_PATH)/Directory/source.c   
$(notdir $(wildcard $(LOCAL_PATH)/*.c))  
$(notdir $(wildcard $(LOCAL_PATH)/Directory/*.c))  
$(addprefix DirectoryPrefix/,$(notdir $(wildcard $(LOCAL_PATH)/Directory/*.c)))`

And still the warning persists.
Make document says:
warning: overriding commands for target xxx'' warning: ignoring old commands for target xxx'' GNU make allows commands to be specified only once per target (except for double-colon rules). If you give commands for a target which already has been defined to have commands, this warning is issued and the second set of commands will overwrite the first set.

But I cannot understand how this is related at all. After dealing with it seems like making a g++ compile theses C files makes this warning appear.
Therefore specifying this statement:
LOCAL_CPP_EXTENSION := .c
Which makes C files build with g++ is causing it. Because when compiling with gcc no warnings are printed.


回答1:


Make sure that you have included clear vars:

include $(CLEAR_VARS)

And if building any other libraries that you include the correct build macro like

include $(BUILD_SHARED_LIBRARY)

I had run into this a day or two ago and it was while adding a new library I had forgotten to include one or the other (I think the CLEAR_VARS makes most sense.) So it was re-appending some values from the main library to the child library or vice versa.



来源:https://stackoverflow.com/questions/18481999/overriding-commands-for-target-android-makefile

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