Skip to contentSkip to conversation

: Add Optional ZLIB and LZO CFLAGS and LDFLAGS

PATCH New Grant Erickson 1 participant 1 message Feb 26, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Add Optional ZLIB and LZO CFLAGS and LDFLAGS

This patch 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.

Compiled, linked and tested successfully in both a i686-unknown-linux to powerpc-unknown-linux cross-compilation environment as well as a native i686-unknown-linux environment

---

Makefile 2008-02-26 09:51:46.000000000 -0800 renamed from Makefile 2007-08-03 06:55:51.000000000 -0700 +7 -5
diff -aruN mtd-utils-1.1.0/Makefile mtd-utils-1.1.0.N/Makefile
@@ -1,12 +1,14 @@
 
 # -*- sh -*-
 
-SBINDIR=/usr/sbin
-MANDIR=/usr/man
-INCLUDEDIR=/usr/include
+PREFIX=/usr
+EXEC_PREFIX=$(PREFIX)
+SBINDIR=$(EXEC_PREFIX)/sbin
+MANDIR=$(PREFIX)/man
+INCLUDEDIR=$(PREFIX)/include
 #CROSS=arm-linux-
 CC := $(CROSS)gcc
-CFLAGS := -I./include -O2 -Wall
+CFLAGS := -I./include $(ZLIBCFLAGS) $(LZOCFLAGS) -O2 -Wall
 
 ifeq ($(origin CROSS),undefined)
   BUILDDIR := .
@@ -58,7 +60,7 @@
             $(BUILDDIR)/compr_zlib.o \
             $(BUILDDIR)/compr_lzo.o \
             $(BUILDDIR)/compr.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 $@ $^

--