[Zlib-devel] zlib 1.2.0.7 really final release candidate

Greg Roelofs newt at pobox.com
Sun Sep 21 21:02:49 EDT 2003


> I decided to put out one more release for testing since I needed to 
> make a bunch of changes to configure and Makefile.in in order to 
> support dynamic library building on Mac OS X (Darwin).  If you have 
> tested 1.2.0.6, you don't need to test this one unless you have a 
> Unix-ish system and use ./configure and/or ./configure --shared.  If 
> you do, then please test ./configure and ./configure --shared followed 
> by a make in each case.  Thank you for your support.

Ugh...I forgot about that.  Not having done any actual testing since, um...
well, quite a while back, I can't really complain too much at this point.
But I still think it's ridiculous in this day and age to have to do two
separate builds just to get both static and shared libraries, and I think
I've made that gripe in the past (and possibly contributed an older version
of the makefile that fixes it).  Make the default makefile build only one
if you wish, but the -shared option should _add_ shared support, not replace
the static support with it.  Gack, etc.

In addition, the shared version is incompatible with match.S since, well,
it doesn't include it.  OBJADLL takes care of that.

Also, the fake targets with no dependencies will fail if someone happens
to touch any of them (e.g., "touch clean; make clean":  oops).  I fixed
that with a .PHONY target, but that's a GNUism; you might want to use
the more traditional FORCE or .FORCE target (empty) as a dependency in
the relevant fake targets.  Either way works in GNU make.

Finally, it would be nice if configure put an extra space after "prefix =",
etc., so those don't show up in diffs against Makefile.in (which has the
extra spaces).  In general, having spaces around all of the = signs is nicer
on humans; only trailing spaces are significant to make.

I've appended a diff against the autogenerated shared version under Linux.
It builds both flavors, fixes the bugs noted above, and cleans up the
dependencies a bit, although I'm sure those will get trashed by a sub-
sequent "make depend."  Anyway, it should be pretty simple to adapt to
a smarter configure script--at least by 1.2.3.  (All you really need to
do is make sure LDSHARED has proper flags for actual shared libraries--
as with "configure -shared" today--and set LIBS to either static or
static + shared.  Most of the added stuff can stay put even if it's not
actually used by the configured build.)  The full version is here, too,
for now:

	http://pobox.com/~newt/test/Makefile.both

Greg


--- Makefile.auto-shared	Sun Sep 21 16:58:36 2003
+++ Makefile	Sun Sep 21 17:28:58 2003
@@ -18,21 +18,28 @@
 
 CC=gcc
 
-CFLAGS=-fPIC -O3 -DUSE_MMAP
+# GRR 20030921:  stock (static) version chosen by configure:
+#CFLAGS=-O3 -DUSE_MMAP
+# GRR 20000717:  added -fomit-frame-pointer on basis of GlennRP's PNG report
+CFLAGS=-O3 -DUSE_MMAP -fomit-frame-pointer
 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
 #CFLAGS=-g -DDEBUG
 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
 #           -Wstrict-prototypes -Wmissing-prototypes
 
-LDFLAGS=-L. libz.so.1.2.0.7
+#LDFLAGS=$(STATICLIB)
+#LDSHARED=gcc
+LDFLAGS=-L. $(SHAREDLIBV)
 LDSHARED=gcc -shared -Wl,-soname,libz.so.1
 CPP=gcc -E
 
-LIBS=libz.so.1.2.0.7
+STATICLIB=libz.a
 SHAREDLIB=libz.so
 SHAREDLIBV=libz.so.1.2.0.7
 SHAREDLIBM=libz.so.1
 
+LIBS=$(STATICLIB) $(SHAREDLIBV)
+
 AR=ar rc
 RANLIB=ranlib
 TAR=tar
@@ -45,12 +52,21 @@
 mandir =${prefix}/share/man
 man3dir = ${mandir}/man3
 
+.SUFFIXES:	.c .o .pic.o
+
 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
        zutil.o inflate.o infback.o inftrees.o inffast.o
 
 OBJA =
+#OBJA = match.o
 # to use the asm code: make OBJA=match.o
 
+OBJSDLL = $(OBJS:.o=.pic.o)
+OBJADLL = $(OBJA:.o=.pic.o)
+
+.c.pic.o:
+	$(CC) -c -fPIC $(CFLAGS) -o $@ $*.c
+
 TEST_OBJS = example.o minigzip.o
 
 all: example minigzip
@@ -66,18 +82,24 @@
 	  echo '		*** zlib test FAILED ***'; \
 	fi
 
-libz.a: $(OBJS) $(OBJA)
-	$(AR) $@ $(OBJS) $(OBJA)
-	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
 match.o: match.S
 	$(CPP) match.S > _match.s
 	$(CC) -c _match.s
 	mv _match.o match.o
 	rm -f _match.s
 
-$(SHAREDLIBV): $(OBJS)
-	$(LDSHARED) -o $@ $(OBJS)
+match.pic.o: match.S
+	$(CPP) match.S > _match.s
+	$(CC) -c -fPIC _match.s
+	mv _match.o match.pic.o
+	rm -f _match.s
+
+$(STATICLIB): $(OBJS) $(OBJA)
+	$(AR) $@ $(OBJS) $(OBJA)
+	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+$(SHAREDLIBV): $(OBJSDLL) $(OBJADLL)
+	$(LDSHARED) -o $@ $(OBJSDLL) $(OBJADLL)
 	rm -f $(SHAREDLIB) $(SHAREDLIBM)
 	ln -s $@ $(SHAREDLIB)
 	ln -s $@ $(SHAREDLIBM)
@@ -97,7 +119,7 @@
 	chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
 	cp $(LIBS) $(libdir)
 	cd $(libdir); chmod 755 $(LIBS)
-	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+	-@(cd $(libdir); $(RANLIB) $(STATICLIB) || true) >/dev/null 2>&1
 	cd $(libdir); if test -f $(SHAREDLIBV); then \
 	  rm -f $(SHAREDLIB) $(SHAREDLIBM); \
 	  ln -s $(SHAREDLIBV) $(SHAREDLIB); \
@@ -111,7 +133,7 @@
 
 uninstall:
 	cd $(includedir); \
-	cd $(libdir); rm -f libz.a; \
+	cd $(libdir); rm -f $(STATICLIB); \
 	if test -f $(SHAREDLIBV); then \
 	  rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
 	fi
@@ -134,19 +156,20 @@
 depend:
 	makedepend -- $(CFLAGS) -- *.[ch]
 
+# "fake" targets:  not real filenames and no deps (else "touch clean" defeats)
+.PHONY:  uninstall clean tags depend
+
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-adler32.o: zlib.h zconf.h
-compress.o: zlib.h zconf.h
-crc32.o: crc32.h zlib.h zconf.h
-deflate.o: deflate.h zutil.h zlib.h zconf.h
-example.o: zlib.h zconf.h
-gzio.o: zutil.h zlib.h zconf.h
-inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h
-minigzip.o: zlib.h zconf.h
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
-uncompr.o: zlib.h zconf.h
-zutil.o: zutil.h zlib.h zconf.h
+# everybody depends on these two:
+$(OBJS) $(OBJSDLL) example.o minigzip.o:	zlib.h zconf.h
+
+crc32.o crc32.pic.o:			crc32.h
+deflate.o deflate.pic.o:		zutil.h deflate.h
+gzio.o gzio.pic.o:			zutil.h
+infback.o infback.pic.o:		zutil.h inftrees.h inflate.h inffast.h
+inffast.o inffast.pic.o:		zutil.h inftrees.h inflate.h inffast.h
+inflate.o inflate.pic.o:		zutil.h inftrees.h inflate.h inffast.h
+inftrees.o inftrees.pic.o:		zutil.h inftrees.h
+trees.o trees.pic.o:			zutil.h deflate.h trees.h
+zutil.o zutil.pic.o:			zutil.h




More information about the Zlib-devel mailing list