[Zlib-devel] [patch] makefile.msc for 1.2.3.9

William A. Rowe Jr. wrowe at rowe-clan.net
Thu Mar 4 16:29:45 EST 2010


Some suggestions for those of us on win32 who are entirely uninterested
in pretty GUI project representations.

1. warn level 3 at least, please!  If windows.h wasn't such a mess, -W4
   would be preferred.  -Zi and -Fd are flags which prepare the source
   code debugging symbol info file zlib.pdb.

2. -debug -release was nonsense, release overrode debug.  The net effect
   of -release is to turn off incremental linking support, optimize away
   unreferenced code, and kill the diagnostic .pdb symbols file.  The
   suggested change emits a 'source' .pdb file called zlib.pdb that can
   accompany the zlib.lib static library, and a zlib1.pdb runtime symbols
   file that can accompany the zlib1.dll file.  The change otherwise leaves
   the resulting .dll/.exe files as completely optimized.

3. if not run through the equivalent of ./configure, simply axe #cmakedefine
   lines from the zconf.h.in template to produce zconf.h.  This is an example
   of how to invoke vb through the cscript interpreter inline from a makefile.

My first try on 3 above was to simply use windows\system32\find.exe /v
(al la grep -v) but there was no way to suppress the file name sent to stdout.

--- ..\..\vc8\zlib-1.2.3.9\win32\Makefile.msc	Sat Feb 13 18:42:20 2010
+++ win32\Makefile.msc	Thu Mar 04 15:20:38 2010
@@ -21,10 +21,10 @@
 LD = link
 AR = lib
 RC = rc
-CFLAGS  = -nologo -MD -O2 -Oy- $(LOC)
+CFLAGS  = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
 WFLAGS  = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
-ASFLAGS = -coff
-LDFLAGS = -nologo -debug -release
+ASFLAGS = -coff -Zi
+LDFLAGS = -nologo -debug -incremental:no -opt:ref
 ARFLAGS = -nologo
 RCFLAGS = /dWIN32 /r

@@ -74,6 +74,15 @@
 .asm.obj:
 	$(AS) -c $(ASFLAGS) $<

+zconf.h: zconf.h.in
+	cscript.exe <<$(MAKEDIR)\tmp.vbs //nologo < zconf.h.in > zconf.h
+dim ln
+do while not (WScript.StdIn.AtEndofStream)
+    ln = WScript.StdIn.ReadLine
+    if InStr(ln, "#cmakedefine") < 1 then WScript.StdOut.WriteLine ln
+loop
+<<
+
 adler32.obj: adler32.c zlib.h zconf.h

 compress.obj: compress.c zlib.h zconf.h




More information about the Zlib-devel mailing list