[PATCH] respect CFLAGS/CPPFLAGS from build environment
Mike Frysinger
vapier at gentoo.org
Wed Jun 11 17:49:08 EDT 2008
Signed-off-by: Mike Frysinger <vapier at 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
More information about the linux-mtd
mailing list