How to add a -W flag in local Makefile
- Reply: Warner Losh : "Re: How to add a -W flag in local Makefile"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Apr 2024 13:04:23 UTC
Hi, I am trying to add a -W flag to local Makefile so it would only be effective for the local source files. But it seems not working when I build the entire kernel. For example, I added a structure in sys/dev/hyperv/vmbus/vmbus_var.h. The structure requires adding a -W flag ( -Wno-gnu-variable-sized-type-not-at-end ) to build successfully for all .c files included this header file. What I did was I add this line in sys/modules/hyperv/vmbus/Makefile: CWARNFLAGS += -Wno-gnu-variable-sized-type-not-at-end This seems working fine if I build the module by typing 'make' under sys/modules/hyperv/vmbus subdir. But it seems having no effect when building the kernel by using 'make buildkernel' under global directory. Those .c files still fail to build due to lacking this flag. If I add this flag in the global sys/conf/kern.mk, it seems to be working. However, I don't like to add it globally as only a few source files under hyperv/vmbus need it. What did I do wrong? Do you know what the proper way to add this flag? Thanks, Wei