[PATCH] [MTD-UTILS] Makefile: Add Optional ZLIB and LZO CFLAGS and LDFLAGS

Grant Erickson gerickson at nuovations.com
Fri Jun 13 11:46:20 EDT 2008


This adds support for allowing the specification of unique CFLAGS and 
LDFLAGS for both LZO and ZLIB. In addition, it allows for independently 
specifying both PREFIX and EXEC_PREFIX.

The former is useful in some cross-compilation environments where the 
LZO and ZLIB versions being built against are not those installed in the 
standard locations.

The latter is useful when installing mtd-utils in a multi-architecture 
installation area.

Signed-off-by: Grant Erickson <gerickson at nuovations.com>
---
 Makefile |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 9f5ef6c..9d1c73d 100644
--- a/Makefile
+++ b/Makefile
@@ -2,12 +2,15 @@
 # -*- sh -*-
 
 OPTFLAGS := -O2 -Wall
-SBINDIR=/usr/sbin
-MANDIR=/usr/share/man
-INCLUDEDIR=/usr/include
+
+PREFIX=/usr
+EXEC_PREFIX=$(PREFIX)
+SBINDIR=$(EXEC_PREFIX)/sbin
+MANDIR=$(PREFIX)/share/man
+INCLUDEDIR=$(PREFIX)/include
 #CROSS=arm-linux-
 CC := $(CROSS)gcc
-CFLAGS := -I./include $(OPTFLAGS)
+CFLAGS := -I./include $(ZLIBCFLAGS) $(LZOCFLAGS) $(OPTFLAGS)
 
 ifeq ($(origin CROSS),undefined)
   BUILDDIR := .
@@ -63,7 +66,7 @@ $(BUILDDIR)/mkfs.jffs2: $(BUILDDIR)/crc32.o \
 			$(BUILDDIR)/compr_lzo.o \
 			$(BUILDDIR)/compr.o \
 			$(BUILDDIR)/rbtree.o
-	$(CC) $(LDFLAGS) -o $@ $^ -lz -llzo2
+	$(CC) $(LDFLAGS) -o $@ $^ $(ZLIBLDFLAGS) -lz $(LZOLDFLAGS) -llzo2
 
 $(BUILDDIR)/flash_eraseall: $(BUILDDIR)/crc32.o $(BUILDDIR)/flash_eraseall.o
 	$(CC) $(LDFLAGS) -o $@ $^
-- 
1.5.4.3




More information about the linux-mtd mailing list