Consider the following files :
abc.c
#ifdef MY_FLAG
#include <stdio.h>
int main() {
printf("hello world\n");
}
#endif
Android.bp
cc_defaults {
name: "my_defaults_1",
srcs: ["abc.c"],
}
cc_defaults {
name: "my_defaults_2",
defaults: ["my_defaults_1"],
cflags: ["-DMY_FLAG"],
}
cc_library_shared {
name: "my_library",
defaults: ["my_defaults_2"],
}
Here my question is, where do i need to define my flag(MY_FLAG) in order to get that file executed and getting print, is it in my_defaults_1 or my_defaults_2 or defining in any one of these, will cause same result? Because when i defined the flag in my_defaults_2 i didn't got the print.