Command Override for Android Makefile Target

I am trying to compile one of the modules in my Android ndk project with g ++, although all the sources are in C. My eyes are annoyed by 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 in the same way as the source files and therefore the objects.

I tried declaring LOCAL_SRC_FILES with all the various options.

 `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)))` 

Nevertheless, the warning remains.
Make document says:
warning: overriding commands for target xxx '' warning: ignoring old commands for target xxx '' GNU make allows you to specify commands only once for each target (except for rules with two colons). If you give commands for a target that has already been defined for the presence of commands, this warning is issued, and the second set of commands overwrites the first set.

But I can’t understand how this is related at all. After working with it, it seems that creating g ++ - compiling abstracts of C files makes this warning. Therefore, indicating this statement:
LOCAL_CPP_EXTENSION := .c
This creates C files with g ++. Because when compiling with gcc, no warnings are printed.

+4
source share
1 answer

Make sure you enable clear vars:

 include $(CLEAR_VARS) 

And if you build any other libraries into which you include the correct assembly macro, for example

 include $(BUILD_SHARED_LIBRARY) 

I came across this a day or two ago, and it was when adding a new library that I forgot to include in it, or something else (I think CLEAR_VARS is of the greatest value.) So it was re-adding some values ​​from The main library for the child library or vice versa.

+3
source

Source: https://habr.com/ru/post/1499317/


All Articles