public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] respect CFLAGS/CPPFLAGS from build environment
@ 2008-06-11 21:49 Mike Frysinger
  2008-06-13 14:51 ` Josh Boyer
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2008-06-11 21:49 UTC (permalink / raw)
  To: linux-mtd

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 Makefile           |   10 ++++++----
 ubi-utils/Makefile |    9 +++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 9f5ef6c..6c13a5a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,15 @@
 
 # -*- sh -*-
 
-OPTFLAGS := -O2 -Wall
 SBINDIR=/usr/sbin
 MANDIR=/usr/share/man
 INCLUDEDIR=/usr/include
+
 #CROSS=arm-linux-
 CC := $(CROSS)gcc
-CFLAGS := -I./include $(OPTFLAGS)
+CFLAGS ?= -O2
+CFLAGS += -Wall
+CPPFLAGS += -I./include
 
 ifeq ($(origin CROSS),undefined)
   BUILDDIR := .
@@ -17,7 +19,7 @@ else
 endif
 
 ifeq ($(WITHOUT_XATTR), 1)
-  CFLAGS += -DWITHOUT_XATTR
+  CPPFLAGS += -DWITHOUT_XATTR
 endif
 
 RAWTARGETS = ftl_format flash_erase flash_eraseall nanddump doc_loadbios \
@@ -38,7 +40,7 @@ SYMLINKS =
 
 $(BUILDDIR)/%.o: %.c
 	mkdir -p $(BUILDDIR)
-	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,$(BUILDDIR)/.$(<F).dep
+	$(CC) $(CPPFLAGS) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,$(BUILDDIR)/.$(<F).dep
 
 .SUFFIXES:
 
diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
index 0394eee..062cc32 100644
--- a/ubi-utils/Makefile
+++ b/ubi-utils/Makefile
@@ -2,7 +2,6 @@
 # Makefile for ubi-utils
 #
 
-OPTFLAGS := -O2 -g -Wall
 KERNELHDR := ../include
 DESTDIR := /usr/local
 SBINDIR=/usr/sbin
@@ -10,8 +9,10 @@ MANDIR=/usr/share/man
 INCLUDEDIR=/usr/include
 
 CC := $(CROSS)gcc
-CFLAGS := -I./inc -I./src -I$(KERNELHDR) $(OPTFLAGS) -Werror \
-	-Wwrite-strings -W -std=gnu99 -DPACKAGE_VERSION=\"1.0\"
+CFLAGS ?= -O2 -g -Werror
+CFLAGS += -Wall -Wwrite-strings -W
+CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
+	-std=gnu99 -DPACKAGE_VERSION=\"1.0\"
 
 PERLPROGS = mkpfi ubicrc32.pl
 
@@ -26,7 +27,7 @@ vpath   %.c ./src
 	$(CC) $(LDFLAGS) -g -o $@ $^
 
 %.o: %.c
-	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
+	$(CC) $(CPPFLAGS) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
 
 all: $(TARGETS)
 	make -C new-utils
-- 
1.5.5.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] respect CFLAGS/CPPFLAGS from build environment
  2008-06-11 21:49 [PATCH] respect CFLAGS/CPPFLAGS from build environment Mike Frysinger
@ 2008-06-13 14:51 ` Josh Boyer
  2008-06-13 21:11   ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Josh Boyer @ 2008-06-13 14:51 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Wed, 11 Jun 2008 17:49:08 -0400
Mike Frysinger <vapier@gentoo.org> wrote:
 
> diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
> index 0394eee..062cc32 100644
> --- a/ubi-utils/Makefile
> +++ b/ubi-utils/Makefile
> @@ -2,7 +2,6 @@
>  # Makefile for ubi-utils
>  #
>  
> -OPTFLAGS := -O2 -g -Wall
>  KERNELHDR := ../include
>  DESTDIR := /usr/local
>  SBINDIR=/usr/sbin
> @@ -10,8 +9,10 @@ MANDIR=/usr/share/man
>  INCLUDEDIR=/usr/include
>  
>  CC := $(CROSS)gcc
> -CFLAGS := -I./inc -I./src -I$(KERNELHDR) $(OPTFLAGS) -Werror \
> -	-Wwrite-strings -W -std=gnu99 -DPACKAGE_VERSION=\"1.0\"
> +CFLAGS ?= -O2 -g -Werror
> +CFLAGS += -Wall -Wwrite-strings -W
> +CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
> +	-std=gnu99 -DPACKAGE_VERSION=\"1.0\"
>  
>  PERLPROGS = mkpfi ubicrc32.pl
>  
> @@ -26,7 +27,7 @@ vpath   %.c ./src
>  	$(CC) $(LDFLAGS) -g -o $@ $^
>  
>  %.o: %.c
> -	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
> +	$(CC) $(CPPFLAGS) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep

Should either remove the unconditional -g here, or not specify it in
the default CFLAGS above, correct?

josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] respect CFLAGS/CPPFLAGS from build environment
  2008-06-13 14:51 ` Josh Boyer
@ 2008-06-13 21:11   ` Mike Frysinger
  2008-06-16 16:12     ` Josh Boyer
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2008-06-13 21:11 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

On Friday 13 June 2008, Josh Boyer wrote:
> On Wed, 11 Jun 2008 17:49:08 -0400
>
> Mike Frysinger <vapier@gentoo.org> wrote:
> > diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
> > index 0394eee..062cc32 100644
> > --- a/ubi-utils/Makefile
> > +++ b/ubi-utils/Makefile
> > @@ -2,7 +2,6 @@
> >  # Makefile for ubi-utils
> >  #
> >
> > -OPTFLAGS := -O2 -g -Wall
> >  KERNELHDR := ../include
> >  DESTDIR := /usr/local
> >  SBINDIR=/usr/sbin
> > @@ -10,8 +9,10 @@ MANDIR=/usr/share/man
> >  INCLUDEDIR=/usr/include
> >
> >  CC := $(CROSS)gcc
> > -CFLAGS := -I./inc -I./src -I$(KERNELHDR) $(OPTFLAGS) -Werror \
> > -	-Wwrite-strings -W -std=gnu99 -DPACKAGE_VERSION=\"1.0\"
> > +CFLAGS ?= -O2 -g -Werror
> > +CFLAGS += -Wall -Wwrite-strings -W
> > +CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
> > +	-std=gnu99 -DPACKAGE_VERSION=\"1.0\"
> >
> >  PERLPROGS = mkpfi ubicrc32.pl
> >
> > @@ -26,7 +27,7 @@ vpath   %.c ./src
> >  	$(CC) $(LDFLAGS) -g -o $@ $^
> >
> >  %.o: %.c
> > -	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
> > +	$(CC) $(CPPFLAGS) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename
> > $<).dep
>
> Should either remove the unconditional -g here, or not specify it in
> the default CFLAGS above, correct?

moving -g in both Makefiles to the default CFLAGS makes the most sense to 
me ... i just figured someone liked it the way it was and i didnt really care 
to fight em for it.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] respect CFLAGS/CPPFLAGS from build environment
  2008-06-13 21:11   ` Mike Frysinger
@ 2008-06-16 16:12     ` Josh Boyer
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Boyer @ 2008-06-16 16:12 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd

On Fri, 13 Jun 2008 17:11:21 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Friday 13 June 2008, Josh Boyer wrote:
> > On Wed, 11 Jun 2008 17:49:08 -0400
> >
> > Mike Frysinger <vapier@gentoo.org> wrote:
> > > diff --git a/ubi-utils/Makefile b/ubi-utils/Makefile
> > > index 0394eee..062cc32 100644
> > > --- a/ubi-utils/Makefile
> > > +++ b/ubi-utils/Makefile
> > > @@ -2,7 +2,6 @@
> > >  # Makefile for ubi-utils
> > >  #
> > >
> > > -OPTFLAGS := -O2 -g -Wall
> > >  KERNELHDR := ../include
> > >  DESTDIR := /usr/local
> > >  SBINDIR=/usr/sbin
> > > @@ -10,8 +9,10 @@ MANDIR=/usr/share/man
> > >  INCLUDEDIR=/usr/include
> > >
> > >  CC := $(CROSS)gcc
> > > -CFLAGS := -I./inc -I./src -I$(KERNELHDR) $(OPTFLAGS) -Werror \
> > > -	-Wwrite-strings -W -std=gnu99 -DPACKAGE_VERSION=\"1.0\"
> > > +CFLAGS ?= -O2 -g -Werror
> > > +CFLAGS += -Wall -Wwrite-strings -W
> > > +CPPFLAGS += -I./inc -I./src -I$(KERNELHDR) \
> > > +	-std=gnu99 -DPACKAGE_VERSION=\"1.0\"
> > >
> > >  PERLPROGS = mkpfi ubicrc32.pl
> > >
> > > @@ -26,7 +27,7 @@ vpath   %.c ./src
> > >  	$(CC) $(LDFLAGS) -g -o $@ $^
> > >
> > >  %.o: %.c
> > > -	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename $<).dep
> > > +	$(CC) $(CPPFLAGS) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$(shell basename
> > > $<).dep
> >
> > Should either remove the unconditional -g here, or not specify it in
> > the default CFLAGS above, correct?
> 
> moving -g in both Makefiles to the default CFLAGS makes the most sense to 
> me ... i just figured someone liked it the way it was and i didnt really care 
> to fight em for it.

Yeah, default CFLAGS makes sense.  I'll fix that up and get this
committed shortly.  Thanks.

josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-16 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-11 21:49 [PATCH] respect CFLAGS/CPPFLAGS from build environment Mike Frysinger
2008-06-13 14:51 ` Josh Boyer
2008-06-13 21:11   ` Mike Frysinger
2008-06-16 16:12     ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox