Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Apr 2024 13:04:23 +0000
From:      Wei Hu <weh@microsoft.com>
To:        "freebsd-hackers@FreeBSD.org" <freebsd-hackers@freebsd.org>
Cc:        Wei Hu <weh@microsoft.com>
Subject:   How to add a -W flag in local Makefile
Message-ID:  <TYZP153MB0399580B98D5F790C0A551C3BB0E2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM>

next in thread | raw e-mail | index | archive | help
Hi,

I am trying to add a -W flag to local Makefile so it would only be effectiv=
e for the local source files. But it seems not working when I build the ent=
ire kernel.

For example, I added a structure in sys/dev/hyperv/vmbus/vmbus_var.h. The s=
tructure requires adding a -W flag ( -Wno-gnu-variable-sized-type-not-at-en=
d ) to build successfully for all .c files included this header file.=20

What I did was I add this line in sys/modules/hyperv/vmbus/Makefile:

CWARNFLAGS +=3D -Wno-gnu-variable-sized-type-not-at-end

This seems working fine if I build the module by typing 'make' under sys/mo=
dules/hyperv/vmbus subdir. But it seems having no effect when building the =
kernel by using 'make buildkernel' under global directory. Those .c files s=
till fail to build due to lacking this flag.=20

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 h=
yperv/vmbus need it. What did I do wrong? Do you know what the proper way t=
o add this flag?

Thanks,
Wei




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?TYZP153MB0399580B98D5F790C0A551C3BB0E2>