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

Grant Erickson gerickson at nuovations.com
Wed Jun 18 10:35:39 EDT 2008


This adds support for allowing the specification of unique CPPFLAGS 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 |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index c5d1933..32ee917 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,17 @@
 
 # -*- sh -*-
 
-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 ?= -O2 -g
 CFLAGS += -Wall
-CPPFLAGS += -I./include
+CPPFLAGS += -I./include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
 
 ifeq ($(origin CROSS),undefined)
   BUILDDIR := .
@@ -65,13 +67,13 @@ $(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 $@ $^
 
 $(BUILDDIR)/jffs2reader: $(BUILDDIR)/jffs2reader.o
-	$(CC) $(LDFLAGS) -o $@ $^ -lz
+	$(CC) $(LDFLAGS) -o $@ $^ $(ZLIBLDFLAGS) -lz
 
 $(BUILDDIR)/jffs2dump: $(BUILDDIR)/jffs2dump.o $(BUILDDIR)/crc32.o
 	$(CC) $(LDFLAGS) -o $@ $^
--
1.5.4.4



More information about the linux-mtd mailing list