Re: [fsverity-utils PATCH] override CFLAGS too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/26/20 6:10 PM, Eric Biggers wrote:
> [+Jes Sorensen]
> 
> On Mon, Oct 26, 2020 at 08:48:31PM +0000, luca.boccassi@xxxxxxxxx wrote:
>> From: Romain Perier <romain.perier@xxxxxxxxx>
>>
>> Currently, CFLAGS are defined by default. It has to effect to define its
>> c-compiler options only when the variable is not defined on the cmdline
>> by the user, it is not possible to merge or mix both, while it could
>> be interesting for using the app warning cflags or the pkg-config
>> cflags, while using the distributor flags. Most distributions packages
>> use their own compilation flags, typically for hardening purpose but not
>> only. This fixes the issue by using the override keyword.
>>
>> Signed-off-by: Romain Perier <romain.perier@xxxxxxxxx>
>> ---
>> Currently used in Debian, were we want to append context-specific
>> compiler flags (eg: for compiler hardening options) without
>> removing the default flags
>>
>>  Makefile | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 6c6c8c9..5020cac 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -35,14 +35,15 @@
>>  cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null > /dev/null 2>&1; \
>>  	      then echo $(1); fi)
>>  
>> -CFLAGS ?= -O2 -Wall -Wundef					\
>> +override CFLAGS := -O2 -Wall -Wundef				\
>>  	$(call cc-option,-Wdeclaration-after-statement)		\
>>  	$(call cc-option,-Wimplicit-fallthrough)		\
>>  	$(call cc-option,-Wmissing-field-initializers)		\
>>  	$(call cc-option,-Wmissing-prototypes)			\
>>  	$(call cc-option,-Wstrict-prototypes)			\
>>  	$(call cc-option,-Wunused-parameter)			\
>> -	$(call cc-option,-Wvla)
>> +	$(call cc-option,-Wvla)					\
>> +	$(CFLAGS)
>>  
>>  override CPPFLAGS := -Iinclude -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
> 
> I had it like this originally, but Jes requested that it be changed to the
> current way for rpm packaging.  See the thread:
> https://lkml.kernel.org/linux-fscrypt/20200515205649.1670512-3-Jes.Sorensen@xxxxxxxxx/T/#u
> 
> Can we come to an agreement on one way to do it?
> 
> To me, the approach with 'override' makes more sense.  The only non-warning
> option is -O2, and if someone doesn't want that, they can just specify
> CFLAGS=-O0 and it will override -O2 (since the last option "wins").
> 
> Jes, can you explain why that way doesn't work with rpm?

I don't remember all the details and I haven't looked at this in a
while. Matthew Almond has helpfully offered to look into it.

Jes



[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux