* [PATCH] make sure compiler supports warning flags
@ 2009-02-25 23:38 Mike Frysinger
2009-02-26 7:43 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2009-02-25 23:38 UTC (permalink / raw)
To: linux-mtd
Some compilers (like gcc-3.3) don't support all the newer -W flags that we
are using. So import the compiler check found in the kernel and test each
flag we add. The := is important so we only do the compiler tests once
per `make` rather than every time we compile a file.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
common.mk | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/common.mk b/common.mk
index 0e8c62b..3ff5cad 100644
--- a/common.mk
+++ b/common.mk
@@ -1,8 +1,18 @@
CC := $(CROSS)gcc
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib
+
+# Stolen from Linux build system
+try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)"; echo CHECK $(2) >/dev/stderr)
+cc-option = $(call try-run, $(CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2))
+
CFLAGS ?= -O2 -g
-CFLAGS += -Wall -Wextra -Wwrite-strings -Wno-sign-compare -D_FILE_OFFSET_BITS=64
+WFLAGS := -Wall \
+ $(call cc-option,-Wextra) \
+ $(call cc-option,-Wwrite-strings) \
+ $(call cc-option,-Wno-sign-compare)
+CFLAGS += $(WFLAGS)
+CPPFLAGS += -D_FILE_OFFSET_BITS=64
DESTDIR ?= /usr/local
PREFIX=/usr
--
1.6.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] make sure compiler supports warning flags
2009-02-25 23:38 [PATCH] make sure compiler supports warning flags Mike Frysinger
@ 2009-02-26 7:43 ` Artem Bityutskiy
2009-02-26 8:28 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2009-02-26 7:43 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Wed, 2009-02-25 at 18:38 -0500, Mike Frysinger wrote:
> Some compilers (like gcc-3.3) don't support all the newer -W flags that we
> are using. So import the compiler check found in the kernel and test each
> flag we add. The := is important so we only do the compiler tests once
> per `make` rather than every time we compile a file.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Looks fine for me, but I cannot really review this, so lets wait a
little, and if there are no complaints I'll push it. Thanks!
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] make sure compiler supports warning flags
2009-02-26 7:43 ` Artem Bityutskiy
@ 2009-02-26 8:28 ` Mike Frysinger
2009-02-26 8:30 ` [PATCH v2] " Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2009-02-26 8:28 UTC (permalink / raw)
To: dedekind; +Cc: linux-mtd, Mike Frysinger
On Thu, Feb 26, 2009 at 02:43, Artem Bityutskiy wrote:
> On Wed, 2009-02-25 at 18:38 -0500, Mike Frysinger wrote:
>> Some compilers (like gcc-3.3) don't support all the newer -W flags that we
>> are using. So import the compiler check found in the kernel and test each
>> flag we add. The := is important so we only do the compiler tests once
>> per `make` rather than every time we compile a file.
>>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>
> Looks fine for me, but I cannot really review this, so lets wait a
> little, and if there are no complaints I'll push it. Thanks!
that's good because i just realized i left stupid debugging echo in there :/
-mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] make sure compiler supports warning flags
2009-02-26 8:28 ` Mike Frysinger
@ 2009-02-26 8:30 ` Mike Frysinger
2009-02-27 16:42 ` Artem Bityutskiy
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2009-02-26 8:30 UTC (permalink / raw)
To: linux-mtd
Some compilers (like gcc-3.3) don't support all the newer -W flags that we
are using. So import the compiler check found in the kernel and test each
flag we add. The := is important so we only do the compiler tests once
per `make` rather than every time we compile a file.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
- remove debug code in try-run
common.mk | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/common.mk b/common.mk
index 0e8c62b..5e92b07 100644
--- a/common.mk
+++ b/common.mk
@@ -1,8 +1,18 @@
CC := $(CROSS)gcc
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib
+
+# Stolen from Linux build system
+try-run = $(shell set -e; ($(1)) >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
+cc-option = $(call try-run, $(CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2))
+
CFLAGS ?= -O2 -g
-CFLAGS += -Wall -Wextra -Wwrite-strings -Wno-sign-compare -D_FILE_OFFSET_BITS=64
+WFLAGS := -Wall \
+ $(call cc-option,-Wextra) \
+ $(call cc-option,-Wwrite-strings) \
+ $(call cc-option,-Wno-sign-compare)
+CFLAGS += $(WFLAGS)
+CPPFLAGS += -D_FILE_OFFSET_BITS=64
DESTDIR ?= /usr/local
PREFIX=/usr
--
1.6.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] make sure compiler supports warning flags
2009-02-26 8:30 ` [PATCH v2] " Mike Frysinger
@ 2009-02-27 16:42 ` Artem Bityutskiy
0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2009-02-27 16:42 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Thu, 2009-02-26 at 03:30 -0500, Mike Frysinger wrote:
> Some compilers (like gcc-3.3) don't support all the newer -W flags that we
> are using. So import the compiler check found in the kernel and test each
> flag we add. The := is important so we only do the compiler tests once
> per `make` rather than every time we compile a file.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Pushed, thanks!
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-27 16:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25 23:38 [PATCH] make sure compiler supports warning flags Mike Frysinger
2009-02-26 7:43 ` Artem Bityutskiy
2009-02-26 8:28 ` Mike Frysinger
2009-02-26 8:30 ` [PATCH v2] " Mike Frysinger
2009-02-27 16:42 ` Artem Bityutskiy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.