diff mbox series

[2/2] Let package manager override CFLAGS and CPPFLAGS

Message ID 20200520200811.257542-3-Jes.Sorensen@gmail.com (mailing list archive)
State Superseded
Headers show
Series fsverity-utils Makefile fixes | expand

Commit Message

Jes Sorensen May 20, 2020, 8:08 p.m. UTC
From: Jes Sorensen <jsorensen@fb.com>

Package managers such as RPM wants to build everything with their
preferred flags, and we shouldn't hard override flags.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
---
 Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Eric Biggers May 20, 2020, 9:06 p.m. UTC | #1
On Wed, May 20, 2020 at 04:08:11PM -0400, Jes Sorensen wrote:
> From: Jes Sorensen <jsorensen@fb.com>
> 
> Package managers such as RPM wants to build everything with their
> preferred flags, and we shouldn't hard override flags.
> 
> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
> ---
>  Makefile | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index e7fb5cf..7bcd5e4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -32,15 +32,14 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null &>/dev/null; \
>  #### Common compiler flags.  You can add additional flags by defining CFLAGS
>  #### and/or CPPFLAGS in the environment or on the 'make' command line.

The above comment is still being made outdated.  IMO, just remove it.

>  
> -override CFLAGS := -O2 -Wall -Wundef				\
> +CFLAGS := -O2 -Wall -Wundef				\
>  	$(call cc-option,-Wdeclaration-after-statement)		\
>  	$(call cc-option,-Wmissing-prototypes)			\
>  	$(call cc-option,-Wstrict-prototypes)			\
>  	$(call cc-option,-Wvla)					\
> -	$(call cc-option,-Wimplicit-fallthrough)		\
> -	$(CFLAGS)
> +	$(call cc-option,-Wimplicit-fallthrough)
>  
> -override CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
> +CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)

On the other thread you ageed that CPPFLAGS should be left as-is, but here you
removed 'override'.  I think always using -D_FILE_OFFSET_BITS=64 is what we
want, since it avoids incorrect builds on 32-bit platforms.  Right?

- Eric
Jes Sorensen May 20, 2020, 9:20 p.m. UTC | #2
On 5/20/20 5:06 PM, Eric Biggers wrote:
> On Wed, May 20, 2020 at 04:08:11PM -0400, Jes Sorensen wrote:
>> From: Jes Sorensen <jsorensen@fb.com>
>>
>> Package managers such as RPM wants to build everything with their
>> preferred flags, and we shouldn't hard override flags.
>>
>> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
>> ---
>>  Makefile | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index e7fb5cf..7bcd5e4 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -32,15 +32,14 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null &>/dev/null; \
>>  #### Common compiler flags.  You can add additional flags by defining CFLAGS
>>  #### and/or CPPFLAGS in the environment or on the 'make' command line.
> 
> The above comment is still being made outdated.  IMO, just remove it.

Good point, I'll send out a v3.

>>  
>> -override CFLAGS := -O2 -Wall -Wundef				\
>> +CFLAGS := -O2 -Wall -Wundef				\
>>  	$(call cc-option,-Wdeclaration-after-statement)		\
>>  	$(call cc-option,-Wmissing-prototypes)			\
>>  	$(call cc-option,-Wstrict-prototypes)			\
>>  	$(call cc-option,-Wvla)					\
>> -	$(call cc-option,-Wimplicit-fallthrough)		\
>> -	$(CFLAGS)
>> +	$(call cc-option,-Wimplicit-fallthrough)
>>  
>> -override CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
>> +CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
> 
> On the other thread you ageed that CPPFLAGS should be left as-is, but here you
> removed 'override'.  I think always using -D_FILE_OFFSET_BITS=64 is what we
> want, since it avoids incorrect builds on 32-bit platforms.  Right?

That should work I think, I read your response as agreeing with me,
hence leaving the change in place.

Cheers,
Jes
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index e7fb5cf..7bcd5e4 100644
--- a/Makefile
+++ b/Makefile
@@ -32,15 +32,14 @@  cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null &>/dev/null; \
 #### Common compiler flags.  You can add additional flags by defining CFLAGS
 #### and/or CPPFLAGS in the environment or on the 'make' command line.
 
-override CFLAGS := -O2 -Wall -Wundef				\
+CFLAGS := -O2 -Wall -Wundef				\
 	$(call cc-option,-Wdeclaration-after-statement)		\
 	$(call cc-option,-Wmissing-prototypes)			\
 	$(call cc-option,-Wstrict-prototypes)			\
 	$(call cc-option,-Wvla)					\
-	$(call cc-option,-Wimplicit-fallthrough)		\
-	$(CFLAGS)
+	$(call cc-option,-Wimplicit-fallthrough)
 
-override CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
+CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS)
 
 #### Other user settings