[Zlib-devel] [PATCH 4/3] contrib/minizip: add support for VPATH builds
Jonathan Nieder
jrnieder at gmail.com
Tue Jan 17 16:06:41 EST 2012
Instead of using relative paths directly, use paths relative to
top_srcdir and top_builddir to refer to source files and built files,
respectively.
Note that the toplevel zlib configure script still does not have any
special support for out-of-tree builds. But now you can do
(cd contrib/minizip && autoreconf -fis)
mkdir -p BUILD/test
cp *.c *.h *.in zlib.map configure zlib.3 BUILD
cp test/*.c BUILD/test
(cd BUILD && ./configure --shared)
(cd BUILD && make)
mkdir -p BUILD/contrib/minizip
cd BUILD/contrib/minizip
../../../contrib/minizip/configure
make
While at it, move the include path and library path settings to
CPPFLAGS and LDFLAGS respectively instead of setting both in CFLAGS.
Thanks to Mike Frysinger for advice.
---
Mike Frysinger wrote:
> zlib.h is in the source tree, so you probably need:
> -I$(top_srcdir)/../..
>
> while zlib.a is in the build tree, so:
> -L$(top_builddir)/../..
Makes sense.
contrib/minizip/Makefile.am | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/contrib/minizip/Makefile.am b/contrib/minizip/Makefile.am
index b80a2f9e..86bd4bdc 100644
--- a/contrib/minizip/Makefile.am
+++ b/contrib/minizip/Makefile.am
@@ -1,13 +1,18 @@
lib_LTLIBRARIES = libminizip.la
+zlib_top_srcdir = $(top_srcdir)/../..
+zlib_top_builddir = $(top_builddir)/../..
+
+AM_CPPFLAGS = -I$(zlib_top_srcdir)
+AM_LDFLAGS = -L$(zlib_top_builddir)
+
libminizip_la_SOURCES = \
ioapi.c \
mztools.c \
unzip.c \
zip.c
-AM_CFLAGS = -I../.. -L../..
-libminizip_la_LDFLAGS = -version-info 1:0:0 -lz
+libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
minizip_includedir = $(includedir)/minizip
minizip_include_HEADERS = \
--
1.7.9.rc1
More information about the Zlib-devel
mailing list