Skip to contentSkip to conversation

makedumpfile: honor the CFLAGS from environment variables

PATCH Superseded Kairui Song 3 participants 5 messages Jan 28, 2019 – Jan 29, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 makedumpfile: honor the CFLAGS from environment variables

This make it easier for passing extra cflags, for example hardening flags could be passed in with enviroment variable.

---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +5 -5
index 612b9d0..b511a78 100644
@@ -8,11 +8,11 @@ ifeq ($(strip $CC),)
 CC	= gcc
 endif
 
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH	= -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-		    -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS_ARCH = $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	      -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS += -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
+	 -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
 # LDFLAGS = -L/usr/local/lib -I/usr/local/include
 
 HOST_ARCH := $(shell uname -m)
Signature · 7 lines
2.20.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw
Quoted 4 lines · Kairui Song

This make it easier for passing extra cflags, for example hardening flags could be passed in with enviroment variable.

Thanks, I like this a lot.

I would like to wake a little to see if there is review from others before applying this.

Quoted 34 lines
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +5 -5
index 612b9d0..b511a78 100644
@@ -8,11 +8,11 @@ ifeq ($(strip $CC),)
 CC	= gcc
 endif
 
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH	= -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-		    -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS_ARCH = $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	      -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS += -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
+	 -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
 # LDFLAGS = -L/usr/local/lib -I/usr/local/include
 
 HOST_ARCH := $(shell uname -m)
Signature · 7 lines
2.20.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 10 lines · Simon Horman
Quoted 4 lines · Kairui Song

This make it easier for passing extra cflags, for example hardening flags could be passed in with enviroment variable.

Thanks, I like this a lot.

I would like to wake a little to see if there is review from others before applying this.

I like this, too, and sorry to steal this... :-)

Quoted 13 lines
Quoted 13 lines
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +0 -0
index 612b9d0..b511a78 100644
@@ -8,11 +8,11 @@ ifeq ($(strip $CC),)
 CC	= gcc
 endif
 
Quoted 7 lines

Makefile ifeq ($(strip $CC),) · line 12

Quoted 7 lines
Makefile +2 -5
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH	= -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-		    -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS_ARCH = $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	      -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

This expands the whole CFLAGS in advance and duplicates some flags, so we can use ":=" instead of "=" for CFLAGS_ARCH ?
If this is fine, I'll fix it when merging.

Thanks,
Kazu

Quoted 10 lines
Quoted 10 lines
Makefile +3 -1
+CFLAGS += -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
+	 -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
 # LDFLAGS = -L/usr/local/lib -I/usr/local/include
 
 HOST_ARCH := $(shell uname -m)
--

2.20.1

Quoted 5 lines
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 27 lines · Kazuhito Hagio
Quoted 10 lines · Simon Horman
Quoted 4 lines · Kairui Song

This make it easier for passing extra cflags, for example hardening flags could be passed in with enviroment variable.

Thanks, I like this a lot.

I would like to wake a little to see if there is review from others before applying this.

I like this, too, and sorry to steal this... :-)

Quoted 13 lines
Quoted 13 lines
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +0 -0
index 612b9d0..b511a78 100644
@@ -8,11 +8,11 @@ ifeq ($(strip $CC),)
 CC	= gcc
 endif
 
Quoted 11 lines
Quoted 7 lines

Makefile ifeq ($(strip $CC),) · line 12

Quoted 7 lines
Makefile +2 -5
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-	  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-	  -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH	= -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-		    -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS_ARCH = $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	      -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

This expands the whole CFLAGS in advance and duplicates some flags, so we can use ":=" instead of "=" for CFLAGS_ARCH ?
If this is fine, I'll fix it when merging.

or it might be good to remove some redundant flags like this at this opportunity.

CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
CFLAGS_ARCH := $(CFLAGS_BASE)

Quoted 14 lines

Thanks,
Kazu

Quoted 10 lines
Quoted 10 lines
Makefile +3 -1
+CFLAGS += -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+	 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
+	 -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
 # LDFLAGS = -L/usr/local/lib -I/usr/local/include
 
 HOST_ARCH := $(shell uname -m)
--

2.20.1

Quoted 12 lines
Quoted 5 lines
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#4 lore raw
Quoted 41 lines · Kazuhito Hagio
Quoted 27 lines · Kazuhito Hagio
Quoted 10 lines · Simon Horman
Quoted 4 lines · Kairui Song

This make it easier for passing extra cflags, for example hardening flags could be passed in with enviroment variable.

Thanks, I like this a lot.

I would like to wake a little to see if there is review from others before applying this.

I like this, too, and sorry to steal this... :-)

Quoted 13 lines
Quoted 13 lines
---
 Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Makefile +0 -0
index 612b9d0..b511a78 100644
@@ -8,11 +8,11 @@ ifeq ($(strip $CC),)
 CC       = gcc
 endif
 
Quoted 11 lines
Quoted 7 lines

Makefile ifeq ($(strip $CC),) · line 12

Quoted 7 lines
Makefile +2 -5
-CFLAGS = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
-   -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
-CFLAGS_ARCH      = -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-             -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+CFLAGS_ARCH = $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
+       -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

This expands the whole CFLAGS in advance and duplicates some flags, so we can use ":=" instead of "=" for CFLAGS_ARCH ?
If this is fine, I'll fix it when mergiKazuhito Hagio <[email protected]>ng.

Quoted 7 lines

or it might be good to remove some redundant flags like this at this opportunity.

CFLAGS_BASE := $(CFLAGS) -g -O2 -Wall -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
CFLAGS := $(CFLAGS_BASE) -DVERSION='"$(VERSION)"' -DRELEASE_DATE='"$(DATE)"'
CFLAGS_ARCH := $(CFLAGS_BASE)

Thanks for the suggestion, it is a good idea, simplifies the CFLAGS definition. Will send a V2 update.

--
Best Regards,
Kairui Song

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec