diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:22:37 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:22:37 -0700 |
| commit | 4b5a43a219d51066c01ff2ab86af18b967f2d0dd (patch) | |
| tree | 4dcaf0cd18751d04cf638a9a6ec521990d4f2e90 /win32 | |
| parent | 086e982175da84b3db958191031380794315f95f (diff) | |
| download | zlib-1.2.0.5.tar.gz zlib-1.2.0.5.tar.bz2 zlib-1.2.0.5.zip | |
zlib 1.2.0.5v1.2.0.5
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/DLL_FAQ.txt | 358 | ||||
| -rw-r--r-- | win32/Makefile-dll.msc | 76 | ||||
| -rw-r--r-- | win32/Makefile.bor | 52 | ||||
| -rw-r--r-- | win32/Makefile.emx | 69 | ||||
| -rw-r--r-- | win32/Makefile.gcc | 119 | ||||
| -rw-r--r-- | win32/Makefile.msc | 218 | ||||
| -rw-r--r-- | win32/zlib.def | 107 | ||||
| -rw-r--r-- | win32/zlib1.rc | 39 |
8 files changed, 755 insertions, 283 deletions
diff --git a/win32/DLL_FAQ.txt b/win32/DLL_FAQ.txt new file mode 100644 index 0000000..c44bce5 --- /dev/null +++ b/win32/DLL_FAQ.txt | |||
| @@ -0,0 +1,358 @@ | |||
| 1 | |||
| 2 | Frequently Asked Questions about ZLIB1.DLL | ||
| 3 | |||
| 4 | |||
| 5 | This document describes the design, the rationale, and the usage | ||
| 6 | of the official DLL build of zlib, named ZLIB1.DLL. If you have | ||
| 7 | general questions about zlib, you should see the file "FAQ" found | ||
| 8 | in the zlib distribution, or at the following location: | ||
| 9 | http://www.gzip.org/zlib/zlib_faq.html | ||
| 10 | |||
| 11 | |||
| 12 | 1. What is ZLIB1.DLL, and how can I get it? | ||
| 13 | |||
| 14 | - ZLIB1.DLL is the official build of zlib as a DLL. | ||
| 15 | (Please remark the symbol '1' in the name.) | ||
| 16 | |||
| 17 | Pointers to a precompiled ZLIB1.DLL can be found in the zlib | ||
| 18 | web site at: | ||
| 19 | http://www.zlib.org/ | ||
| 20 | |||
| 21 | Applications that link to ZLIB1.DLL can rely on the following | ||
| 22 | specification: | ||
| 23 | |||
| 24 | * The exported symbols are exclusively defined in the source | ||
| 25 | files "zlib.h" and "zlib.def", found in an official zlib | ||
| 26 | source distribution. | ||
| 27 | * The symbols are exported by name, not by ordinal. | ||
| 28 | * The exported names are undecorated. | ||
| 29 | * The calling convention of functions is "C" (CDECL). | ||
| 30 | * The ZLIB1.DLL binary is linked to MSVCRT.DLL. | ||
| 31 | |||
| 32 | The archive in which ZLIB1.DLL is bundled contains compiled | ||
| 33 | test programs that must run with a valid build of ZLIB1.DLL. | ||
| 34 | It is recommended to download the prebuilt DLL from the zlib | ||
| 35 | web site, instead of building it yourself, to avoid potential | ||
| 36 | incompatibilities that could be introduced by your compiler | ||
| 37 | and build settings. If you do build the DLL yourself, please | ||
| 38 | make sure that it complies with all the above requirements, | ||
| 39 | and it runs with the precompiled test programs, bundled with | ||
| 40 | the original ZLIB1.DLL distribution and available at the zlib | ||
| 41 | web site. | ||
| 42 | |||
| 43 | If, for any reason, you need to build an incompatible DLL, | ||
| 44 | please use a different name. | ||
| 45 | |||
| 46 | |||
| 47 | 2. Why did you change the name of the DLL to ZLIB1.DLL? | ||
| 48 | What happened to the old ZLIB.DLL? | ||
| 49 | |||
| 50 | - The old ZLIB.DLL, built from zlib-1.1.x and earlier, required | ||
| 51 | compilation settings that were incompatible to those used by a | ||
| 52 | static build. The DLL settings were supposed to be enabled by | ||
| 53 | defining the macro ZLIB_DLL, before including "zlib.h". | ||
| 54 | Incorrect handling of this macro was silently accepted at | ||
| 55 | build time, resulting in two major problems: | ||
| 56 | |||
| 57 | * ZLIB_DLL was missing from the old makefile. When building | ||
| 58 | the DLL, not all people added it to the build options. In | ||
| 59 | consequence, incompatible incarnations of ZLIB.DLL started | ||
| 60 | to circulate around the net. | ||
| 61 | |||
| 62 | * When switching from using the static library to using the | ||
| 63 | DLL, applications had to define the ZLIB_DLL macro and | ||
| 64 | to recompile all the sources that contained calls to zlib | ||
| 65 | functions. Failure to do so resulted in creating binaries | ||
| 66 | that were unable to run with the official ZLIB.DLL build. | ||
| 67 | |||
| 68 | The only possible solution that we could foresee was to make a | ||
| 69 | binary-incompatible change in the DLL interfacing, in order to | ||
| 70 | remove the dependency on the ZLIB_DLL macro, and to release | ||
| 71 | the new DLL under a different name. | ||
| 72 | |||
| 73 | We chose the name ZLIB1.DLL, where '1' indicates the major | ||
| 74 | zlib version number. We hope that we will not have to break | ||
| 75 | the binary compatibility again, at least not as long as the | ||
| 76 | zlib-1.x series will last. | ||
| 77 | |||
| 78 | There is still a ZLIB_DLL macro, that can trigger a more | ||
| 79 | efficient build and use of the DLL, but compatibility no | ||
| 80 | longer dependents on it. | ||
| 81 | |||
| 82 | |||
| 83 | 3. Can I build ZLIB.DLL from the new zlib sources, and replace | ||
| 84 | an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier? | ||
| 85 | |||
| 86 | - In principle, you can do it by assigning calling convention | ||
| 87 | keywords to the macros ZEXPORT and ZEXPORTVA. In practice, | ||
| 88 | it depends on what you mean by "an old ZLIB.DLL", because | ||
| 89 | the old DLL exists in several mutually-incompatible versions. | ||
| 90 | |||
| 91 | If you have a compiled application that works with a certain | ||
| 92 | ZLIB.DLL without any known security issues, there is hardly | ||
| 93 | a need to rebuild the DLL from new sources only to link it to | ||
| 94 | the old app binary. But if you really want to do it, you have | ||
| 95 | to find out first what kind of calling convention uses your | ||
| 96 | particular ZLIB.DLL build, and to use the same one in the new | ||
| 97 | build. If you don't know what this is all about, you might be | ||
| 98 | better off if you would just forget it. | ||
| 99 | |||
| 100 | |||
| 101 | 4. Can I compile my application using the new zlib interface, and | ||
| 102 | link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or | ||
| 103 | earlier? | ||
| 104 | |||
| 105 | - The official answer is "no"; the real answer depends again on | ||
| 106 | what kind of ZLIB.DLL you have. Even if you are lucky, this | ||
| 107 | course of action is unreliable. | ||
| 108 | |||
| 109 | If you rebuild your application and you intend to use a newer | ||
| 110 | version of zlib (post- 1.1.4), it is strongly recommended to | ||
| 111 | link it to the new ZLIB1.DLL. | ||
| 112 | |||
| 113 | |||
| 114 | 5. Why are the zlib symbols exported by name, and not by ordinal? | ||
| 115 | |||
| 116 | - Although exporting symbols by ordinal is a little faster, it | ||
| 117 | is risky. Any single glitch in the maintenance or use of the | ||
| 118 | DEF file that contains the ordinals can result in incompatible | ||
| 119 | builds and frustrating crashes. Simply put, the benefits of | ||
| 120 | exporting symbols by ordinal do not justify the risks. | ||
| 121 | |||
| 122 | Technically, it should be possible to maintain ordinals in | ||
| 123 | the DEF file, and still export the symbols by name. Ordinals | ||
| 124 | exist in every DLL, and even if the dynamic linking performed | ||
| 125 | at the DLL startup is searching for names, ordinals serve as | ||
| 126 | hints, for a faster name lookup. However, if the DEF file | ||
| 127 | contains ordinals, the Microsoft linker automatically builds | ||
| 128 | an implib that will cause the executables linked to it to use | ||
| 129 | those ordinals, and not the names. It is interesting to | ||
| 130 | notice that the GNU linker for Win32 does not suffer from this | ||
| 131 | problem. | ||
| 132 | |||
| 133 | It is possible to avoid the DEF file if the exported symbols | ||
| 134 | are accompanied by a "__declspec(dllexport)" attribute in the | ||
| 135 | source files. You can do this in zlib by predefining the | ||
| 136 | ZLIB_DLL macro. | ||
| 137 | |||
| 138 | |||
| 139 | 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling | ||
| 140 | convention. Why not use the STDCALL convention? | ||
| 141 | STDCALL is the standard convention in Win32, and I need it in | ||
| 142 | my Visual Basic project! | ||
| 143 | |||
| 144 | (For readability, we use CDECL to refer to the convention | ||
| 145 | triggered by the "__cdecl" keyword, STDCALL to refer to | ||
| 146 | the convention triggered by "__stdcall", and FASTCALL to | ||
| 147 | refer to the convention triggered by "__fastcall".) | ||
| 148 | |||
| 149 | - Most of the native Windows API functions (without varargs) use | ||
| 150 | indeed the WINAPI convention (which translates to STDCALL in | ||
| 151 | Win32), but the standard C functions use CDECL. If a user | ||
| 152 | application is intrinsically tied to the Windows API (e.g. | ||
| 153 | it calls native Windows API functions such as CreateFile()), | ||
| 154 | sometimes it makes sense to decorate its own functions with | ||
| 155 | WINAPI. But if ANSI C or POSIX portability is a goal (e.g. | ||
| 156 | it calls standard C functions such as fopen()), it is not a | ||
| 157 | sound decision to request the inclusion of <windows.h>, or to | ||
| 158 | use non-ANSI constructs, for the sole purpose to make the user | ||
| 159 | functions STDCALL-able. | ||
| 160 | |||
| 161 | The functionality offered by zlib is not in the category of | ||
| 162 | "Windows functionality", but is more like "C functionality". | ||
| 163 | |||
| 164 | Technically, STDCALL is not bad; in fact, it is slightly | ||
| 165 | faster than CDECL, and it works with variable-argument | ||
| 166 | functions, just like CDECL. It is unfortunate that, in spite | ||
| 167 | of using STDCALL in the Windows API, it is not the default | ||
| 168 | convention used by the C compilers that run under Windows. | ||
| 169 | The roots of the problem reside deep inside the unsafety of | ||
| 170 | the K&R-style function prototypes, where the argument types | ||
| 171 | are not specified; but that is another story for another day. | ||
| 172 | |||
| 173 | The fact that remains is that CDECL is the default convention. | ||
| 174 | Even if an explicit convention (such as STDCALL or FASTCALL) | ||
| 175 | is hard-coded into the function prototypes inside C headers, | ||
| 176 | problems may appear. One problem, for example, deals with the | ||
| 177 | necessity to expose the convention in users' callbacks. | ||
| 178 | |||
| 179 | The calling convention issues are also important when using | ||
| 180 | zlib in other programming languages. Some of them, like Ada | ||
| 181 | (GNAT) and Fortran (GNU G77), have C bindings implemented | ||
| 182 | initially on Unix, and relying on the C calling convention. | ||
| 183 | On the other hand, the pre- .NET versions of Microsoft Visual | ||
| 184 | Basic require STDCALL, while Borland Delphi prefers (although | ||
| 185 | it does not require) FASTCALL. | ||
| 186 | |||
| 187 | In fairness to all possible uses of zlib outside the C | ||
| 188 | programming language, we choose the default "C" convention. | ||
| 189 | Anyone interested in different bindings or conventions is | ||
| 190 | encouraged to maintain specialized projects. The "contrib/" | ||
| 191 | directory from the zlib distribution already holds a couple | ||
| 192 | of foreign bindings, such as Ada, C++, and Delphi. | ||
| 193 | |||
| 194 | |||
| 195 | 7. I need a DLL for my Visual Basic project. What can I do? | ||
| 196 | |||
| 197 | - Define the ZLIB_WINAPI macro before including "zlib.h", when | ||
| 198 | building both the DLL and the user application (except that | ||
| 199 | you don't need to define anything when using the DLL in Visual | ||
| 200 | Basic). The ZLIB_WINAPI macro will switch on the WINAPI | ||
| 201 | (STDCALL) convention. The name of this DLL must be different | ||
| 202 | than the official ZLIB1.DLL. | ||
| 203 | |||
| 204 | Gilles Vollant has contributed a build named ZLIBWAPI.DLL, | ||
| 205 | with the ZLIB_WINAPI macro turned on, and with the minizip | ||
| 206 | functionality built in. For more information, please read | ||
| 207 | the notes inside "contrib/vstudio/readme.txt", found in the | ||
| 208 | zlib distribution. | ||
| 209 | |||
| 210 | |||
| 211 | 8. If my application uses ZLIB1.DLL, should I link it to | ||
| 212 | MSVCRT.DLL? Why? | ||
| 213 | |||
| 214 | - It is not required, but it is recommended to link your | ||
| 215 | application to MSVCRT.DLL, if it uses ZLIB1.DLL. | ||
| 216 | |||
| 217 | The executables (.EXE, .DLL, etc.) that are involved in the | ||
| 218 | same process and are using the C run-time library (i.e. they | ||
| 219 | are calling standard C functions), must link to the same | ||
| 220 | library. There are several libraries in the Win32 system: | ||
| 221 | CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. | ||
| 222 | Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that | ||
| 223 | depend on it should also be linked to MSVCRT.DLL. | ||
| 224 | |||
| 225 | |||
| 226 | 9. Why are you saying that ZLIB1.DLL and my application must be | ||
| 227 | linked to the same C run-time (CRT) library? I linked my | ||
| 228 | application and my DLLs to different C libraries (e.g. my | ||
| 229 | application to a static library, and my DLLs to MSVCRT.DLL), | ||
| 230 | and everything works fine. | ||
| 231 | |||
| 232 | - If a user library invokes only pure Win32 API (accessible via | ||
| 233 | <windows.h> and the related headers), its DLL build will work | ||
| 234 | in any context. But if this library invokes standard C API, | ||
| 235 | things get more complicated. | ||
| 236 | |||
| 237 | There is a single Win32 library in a Win32 system. Every | ||
| 238 | function in this library resides in a single DLL module, that | ||
| 239 | is safe to call from anywhere. On the other hand, there are | ||
| 240 | multiple versions of the C library, and each of them has its | ||
| 241 | own separate internal state. Standalone executables and user | ||
| 242 | DLLs that call standard C functions must link to a C run-time | ||
| 243 | (CRT) library, be it static or shared (DLL). Intermixing | ||
| 244 | occurs when an executable (not necessarily standalone) and a | ||
| 245 | DLL are linked to different CRTs, and both are running in the | ||
| 246 | same process. | ||
| 247 | |||
| 248 | Intermixing multiple CRTs is possible, as long as their | ||
| 249 | internal states are kept intact. The Microsoft Knowledge Base | ||
| 250 | articles KB94248 "HOWTO: Use the C Run-Time" and KB140584 | ||
| 251 | "HOWTO: Link with the Correct C Run-Time (CRT) Library" | ||
| 252 | mention the potential problems raised by intermixing. | ||
| 253 | |||
| 254 | If intermixing works for you, it's because your application | ||
| 255 | and DLLs are avoiding the corruption of each of the CRTs' | ||
| 256 | internal states, maybe by careful design, or maybe by fortune. | ||
| 257 | |||
| 258 | Also note that linking ZLIB1.DLL to non-Microsoft CRTs (such | ||
| 259 | as those provided by Borland) raises similar problems. | ||
| 260 | |||
| 261 | |||
| 262 | 10. Why are you linking ZLIB1.DLL to MSVCRT.DLL? | ||
| 263 | |||
| 264 | - MSVCRT.DLL exists on every Windows 95 with a new service pack | ||
| 265 | installed, or with Microsoft Internet Explorer 4 or later, and | ||
| 266 | on all other Windows 4.x or later (Windows 98, Windows NT 4, | ||
| 267 | or later). It is freely distributable; if not present in the | ||
| 268 | system, it can be downloaded from Microsoft or from other | ||
| 269 | software provider for free. | ||
| 270 | |||
| 271 | The fact that MSVCRT.DLL does not exist on a virgin Windows 95 | ||
| 272 | is not so problematic. The number of Windows 95 installations | ||
| 273 | is rapidly decreasing, Microsoft stopped supporting it a long | ||
| 274 | time ago, and many recent applications from various vendors, | ||
| 275 | including Microsoft, do not even run on it. Furthermore, no | ||
| 276 | serious user should run Windows 95 without a proper update | ||
| 277 | installed. | ||
| 278 | |||
| 279 | There is also the fact that the mainstream C compilers for | ||
| 280 | Windows are Microsoft Visual C++ 6.0, and gcc/MinGW. Both | ||
| 281 | are producing executables that link to MSVCRT.DLL by default, | ||
| 282 | without offering other dynamic CRTs as alternatives easy to | ||
| 283 | select by users. | ||
| 284 | |||
| 285 | |||
| 286 | 11. Why are you not linking ZLIB1.DLL to | ||
| 287 | <<my favorite C run-time library>> ? | ||
| 288 | |||
| 289 | - We considered and abandoned the following alternatives: | ||
| 290 | |||
| 291 | * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or | ||
| 292 | LIBCMT.LIB) is not a good option. People are using the DLL | ||
| 293 | mainly to save disk space. If you are linking your program | ||
| 294 | to a static C library, you may as well consider linking zlib | ||
| 295 | in statically, too. | ||
| 296 | |||
| 297 | * Linking ZLIB1.DLL to CRTDLL.DLL looks very appealing, | ||
| 298 | because CRTDLL.DLL is present on every Win32 installation. | ||
| 299 | Unfortunately, it has a series of problems: it raises | ||
| 300 | difficulties when using it with C++ code, it does not work | ||
| 301 | with 64-bit file offsets, (and so on...), and Microsoft | ||
| 302 | discontinued its support a long time ago. | ||
| 303 | |||
| 304 | * Linking ZLIB1.DLL to MSVCR70.DLL, supplied with the | ||
| 305 | Microsoft .NET platform and Visual C++ 7.0 or newer, is not | ||
| 306 | a good option. Although it is available for free download | ||
| 307 | and distribution, its presence is scarce on today's Win32 | ||
| 308 | installations. If it will ever become more popular than | ||
| 309 | MSVCRT.DLL and will be pre-installed on the future Win32 | ||
| 310 | systems, we will probably think again about it. | ||
| 311 | |||
| 312 | * Linking ZLIB1.DLL to NTDLL.DLL is not possible. | ||
| 313 | NTDLL.DLL exports only a part of the C library, and only on | ||
| 314 | Windows NT systems. | ||
| 315 | |||
| 316 | |||
| 317 | 12. I need to link my own DLL build to a CRT different than | ||
| 318 | MSVCRT.DLL. What can I do? | ||
| 319 | |||
| 320 | - Feel free to rebuild the DLL from the zlib sources, and link | ||
| 321 | it the way you want. You should, however, clearly state that | ||
| 322 | your build is unofficial. You should give it a different file | ||
| 323 | name, and/or install it in a private directory that can be | ||
| 324 | accessed by your application only, and is not visible to the | ||
| 325 | others (e.g. it's not in the SYSTEM or the SYSTEM32 directory, | ||
| 326 | and it's not in the PATH). Otherwise, your build may clash | ||
| 327 | with applications that link to the official build. | ||
| 328 | |||
| 329 | For example, in Cygwin, zlib is linked to the Cygwin runtime | ||
| 330 | CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. | ||
| 331 | |||
| 332 | |||
| 333 | 13. May I include additional pieces of code that I find useful, | ||
| 334 | link them in ZLIB1.DLL, and export them? | ||
| 335 | |||
| 336 | - No. A legitimate build of ZLIB1.DLL must not include code | ||
| 337 | that does not originate from the official zlib sources. But | ||
| 338 | you can make your own private build, and give it a different | ||
| 339 | name, as suggested in the previous answer. | ||
| 340 | |||
| 341 | For example, in Borland Delphi and C++ Builder, zlib is a part | ||
| 342 | of the standard VCL library. If an application links to VCL | ||
| 343 | dynamically, the name of the distributable binary (VCLxx.DLL) | ||
| 344 | does not posess any danger of clashing with a legitimate but | ||
| 345 | incompatible ZLIB1.DLL. | ||
| 346 | |||
| 347 | |||
| 348 | 14. I made my own ZLIB1.DLL build. Can I test it for compliance? | ||
| 349 | |||
| 350 | - We prefer that you download the official DLL from the zlib | ||
| 351 | web site. If you need something peculiar from this DLL, you | ||
| 352 | can send your suggestion to the zlib mailing list. | ||
| 353 | |||
| 354 | However, in case you do rebuild the DLL yourself, you can run | ||
| 355 | it with the test programs found in the DLL distribution. | ||
| 356 | Running these test programs is not a guarantee of compliance, | ||
| 357 | but a failure can imply a detected problem. | ||
| 358 | |||
diff --git a/win32/Makefile-dll.msc b/win32/Makefile-dll.msc deleted file mode 100644 index 516f4cf..0000000 --- a/win32/Makefile-dll.msc +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | # Makefile for zlib.dll -- Microsoft (Visual) C. | ||
| 2 | # Author: Cosmin Truta, 11-Mar-2003. | ||
| 3 | # | ||
| 4 | # Usage: nmake -f win32/Makefile-dll.msc | ||
| 5 | |||
| 6 | CC = cl | ||
| 7 | LD = cl | ||
| 8 | CFLAGS = -nologo -MD -O2 | ||
| 9 | LDFLAGS = -nologo | ||
| 10 | |||
| 11 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ | ||
| 12 | inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | ||
| 13 | |||
| 14 | # targets | ||
| 15 | all: zlib.dll zlib.lib example.exe minigzip.exe | ||
| 16 | |||
| 17 | zlib.lib: $(OBJS) | ||
| 18 | lib -out:$@ $(OBJS) | ||
| 19 | |||
| 20 | zlib.dll: $(OBJS) win32/zlib.def | ||
| 21 | link -release -def:win32/zlib.def -dll -out:$@ $(OBJS) | ||
| 22 | |||
| 23 | zlib.lib: zlib.dll | ||
| 24 | |||
| 25 | example.exe: example.obj zlib.lib | ||
| 26 | $(LD) $(LDFLAGS) example.obj zlib.lib | ||
| 27 | |||
| 28 | minigzip.exe: minigzip.obj zlib.lib | ||
| 29 | $(LD) $(LDFLAGS) minigzip.obj zlib.lib | ||
| 30 | |||
| 31 | .c.obj: | ||
| 32 | $(CC) -c $(CFLAGS) $*.c | ||
| 33 | |||
| 34 | adler32.obj: adler32.c zlib.h zconf.h | ||
| 35 | |||
| 36 | compress.obj: compress.c zlib.h zconf.h | ||
| 37 | |||
| 38 | crc32.obj: crc32.c zlib.h zconf.h crc32.h | ||
| 39 | |||
| 40 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | ||
| 41 | |||
| 42 | gzio.obj: gzio.c zutil.h zlib.h zconf.h | ||
| 43 | |||
| 44 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||
| 45 | inffast.h inffixed.h | ||
| 46 | |||
| 47 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||
| 48 | inffast.h | ||
| 49 | |||
| 50 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | ||
| 51 | inffast.h inffixed.h | ||
| 52 | |||
| 53 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | ||
| 54 | |||
| 55 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||
| 56 | |||
| 57 | uncompr.obj: uncompr.c zlib.h zconf.h | ||
| 58 | |||
| 59 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||
| 60 | |||
| 61 | example.obj: example.c zlib.h zconf.h | ||
| 62 | |||
| 63 | minigzip.obj: minigzip.c zlib.h zconf.h | ||
| 64 | |||
| 65 | # testing | ||
| 66 | test: example.exe minigzip.exe | ||
| 67 | example | ||
| 68 | echo hello world | minigzip | minigzip -d | ||
| 69 | |||
| 70 | # cleanup | ||
| 71 | clean: | ||
| 72 | del *.obj | ||
| 73 | del *.dll | ||
| 74 | del *.lib | ||
| 75 | del *.exp | ||
| 76 | del *.exe | ||
diff --git a/win32/Makefile.bor b/win32/Makefile.bor index f1a1c46..b802519 100644 --- a/win32/Makefile.bor +++ b/win32/Makefile.bor | |||
| @@ -1,37 +1,48 @@ | |||
| 1 | # Makefile for zlib | 1 | # Makefile for zlib |
| 2 | # Borland C++ for Win32 | 2 | # Borland C++ for Win32 |
| 3 | # Updated for zlib-1.2.x by Cosmin Truta, 11-Mar-2003. | 3 | # |
| 4 | 4 | # Updated for zlib 1.2.x by Cosmin Truta, 11-Mar-2003 | |
| 5 | # Usage: "make -f win32/makefile.bor" | 5 | # Last updated: 28-Aug-2003 |
| 6 | 6 | # | |
| 7 | # ------------ Borland C++ for Win32 ------------ | 7 | # Usage: |
| 8 | 8 | # make -f win32/Makefile.bor | |
| 9 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) | 9 | # make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj |
| 10 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added | 10 | |
| 11 | # to the declaration of LOC here: | 11 | # ------------ Borland C++ ------------ |
| 12 | |||
| 13 | # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) | ||
| 14 | # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or | ||
| 15 | # added to the declaration of LOC here: | ||
| 12 | LOC = $(LOCAL_ZLIB) | 16 | LOC = $(LOCAL_ZLIB) |
| 13 | 17 | ||
| 14 | CC = bcc32 | 18 | CC = bcc32 |
| 19 | AS = bcc32 | ||
| 15 | LD = bcc32 | 20 | LD = bcc32 |
| 16 | AR = tlib | 21 | AR = tlib |
| 17 | CFLAGS = -O2 -d -k- $(LOC) | 22 | CFLAGS = -a -d -k- -O2 $(LOC) |
| 23 | ASFLAGS = $(LOC) | ||
| 18 | LDFLAGS = $(LOC) | 24 | LDFLAGS = $(LOC) |
| 19 | 25 | ||
| 20 | 26 | ||
| 21 | # variables | 27 | # variables |
| 22 | ZLIB_LIB = zlib.lib | 28 | ZLIB_LIB = zlib.lib |
| 23 | 29 | ||
| 24 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj | 30 | OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj |
| 25 | OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | 31 | OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj |
| 32 | #OBJA = | ||
| 26 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj | 33 | OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj |
| 27 | OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj | 34 | OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj |
| 35 | #OBJPA= | ||
| 28 | 36 | ||
| 29 | 37 | ||
| 30 | # targets | 38 | # targets |
| 31 | all: $(ZLIB_LIB) example.exe minigzip.exe | 39 | all: $(ZLIB_LIB) example.exe minigzip.exe |
| 32 | 40 | ||
| 33 | .c.obj: | 41 | .c.obj: |
| 34 | $(CC) -c $(CFLAGS) $*.c | 42 | $(CC) -c $(CFLAGS) $< |
| 43 | |||
| 44 | .asm.obj: | ||
| 45 | $(AS) -c $(ASFLAGS) $< | ||
| 35 | 46 | ||
| 36 | adler32.obj: adler32.c zlib.h zconf.h | 47 | adler32.obj: adler32.c zlib.h zconf.h |
| 37 | 48 | ||
| @@ -67,10 +78,17 @@ minigzip.obj: minigzip.c zlib.h zconf.h | |||
| 67 | 78 | ||
| 68 | # For the sake of the old Borland make, | 79 | # For the sake of the old Borland make, |
| 69 | # the command line is cut to fit in the MS-DOS 128 byte limit: | 80 | # the command line is cut to fit in the MS-DOS 128 byte limit: |
| 70 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) | 81 | $(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA) |
| 71 | -del $(ZLIB_LIB) | 82 | -del $(ZLIB_LIB) |
| 72 | $(AR) $(ZLIB_LIB) $(OBJP1) | 83 | $(AR) $(ZLIB_LIB) $(OBJP1) |
| 73 | $(AR) $(ZLIB_LIB) $(OBJP2) | 84 | $(AR) $(ZLIB_LIB) $(OBJP2) |
| 85 | $(AR) $(ZLIB_LIB) $(OBJPA) | ||
| 86 | |||
| 87 | |||
| 88 | # testing | ||
| 89 | test: example.exe minigzip.exe | ||
| 90 | example | ||
| 91 | echo hello world | minigzip | minigzip -d | ||
| 74 | 92 | ||
| 75 | example.exe: example.obj $(ZLIB_LIB) | 93 | example.exe: example.obj $(ZLIB_LIB) |
| 76 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) | 94 | $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) |
| @@ -78,14 +96,12 @@ example.exe: example.obj $(ZLIB_LIB) | |||
| 78 | minigzip.exe: minigzip.obj $(ZLIB_LIB) | 96 | minigzip.exe: minigzip.obj $(ZLIB_LIB) |
| 79 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) | 97 | $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) |
| 80 | 98 | ||
| 81 | test: example.exe minigzip.exe | ||
| 82 | example | ||
| 83 | echo hello world | minigzip | minigzip -d | ||
| 84 | 99 | ||
| 100 | # cleanup | ||
| 85 | clean: | 101 | clean: |
| 86 | -del *.obj | 102 | -del *.obj |
| 87 | -del *.exe | ||
| 88 | -del *.lib | 103 | -del *.lib |
| 104 | -del *.exe | ||
| 89 | -del *.tds | 105 | -del *.tds |
| 90 | -del zlib.bak | 106 | -del zlib.bak |
| 91 | -del foo.gz | 107 | -del foo.gz |
diff --git a/win32/Makefile.emx b/win32/Makefile.emx new file mode 100644 index 0000000..7b08424 --- /dev/null +++ b/win32/Makefile.emx | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98. | ||
| 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. | ||
| 3 | # For conditions of distribution and use, see copyright notice in zlib.h | ||
| 4 | |||
| 5 | # To compile, or to compile and test, type: | ||
| 6 | # | ||
| 7 | # make -fmakefile.emx; make test -fmakefile.emx | ||
| 8 | # | ||
| 9 | |||
| 10 | CC=gcc -Zwin32 | ||
| 11 | |||
| 12 | #CFLAGS=-MMD -O | ||
| 13 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | ||
| 14 | #CFLAGS=-MMD -g -DDEBUG | ||
| 15 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | ||
| 16 | -Wstrict-prototypes -Wmissing-prototypes | ||
| 17 | |||
| 18 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . | ||
| 19 | CP=copy /Y | ||
| 20 | # If gnu install.exe is available, replace $(CP) with ginstall. | ||
| 21 | INSTALL=$(CP) | ||
| 22 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: | ||
| 23 | RM=del | ||
| 24 | LDLIBS=-L. -lzlib | ||
| 25 | LD=$(CC) -s -o | ||
| 26 | LDSHARED=$(CC) | ||
| 27 | |||
| 28 | INCL=zlib.h zconf.h | ||
| 29 | LIBS=zlib.a | ||
| 30 | |||
| 31 | AR=ar rcs | ||
| 32 | |||
| 33 | prefix=/usr/local | ||
| 34 | exec_prefix = $(prefix) | ||
| 35 | |||
| 36 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | ||
| 37 | zutil.o inflate.o infback.o inftrees.o inffast.o | ||
| 38 | |||
| 39 | TEST_OBJS = example.o minigzip.o | ||
| 40 | |||
| 41 | all: example.exe minigzip.exe | ||
| 42 | |||
| 43 | test: all | ||
| 44 | ./example | ||
| 45 | echo hello world | .\minigzip | .\minigzip -d | ||
| 46 | |||
| 47 | %.o : %.c | ||
| 48 | $(CC) $(CFLAGS) -c $< -o $@ | ||
| 49 | |||
| 50 | zlib.a: $(OBJS) | ||
| 51 | $(AR) $@ $(OBJS) | ||
| 52 | |||
| 53 | %.exe : %.o $(LIBS) | ||
| 54 | $(LD) $@ $< $(LDLIBS) | ||
| 55 | |||
| 56 | |||
| 57 | .PHONY : clean | ||
| 58 | |||
| 59 | clean: | ||
| 60 | $(RM) *.d | ||
| 61 | $(RM) *.o | ||
| 62 | $(RM) *.exe | ||
| 63 | $(RM) zlib.a | ||
| 64 | $(RM) foo.gz | ||
| 65 | |||
| 66 | DEPS := $(wildcard *.d) | ||
| 67 | ifneq ($(DEPS),) | ||
| 68 | include $(DEPS) | ||
| 69 | endif | ||
diff --git a/win32/Makefile.gcc b/win32/Makefile.gcc index da32859..62a8430 100644 --- a/win32/Makefile.gcc +++ b/win32/Makefile.gcc | |||
| @@ -1,26 +1,36 @@ | |||
| 1 | # Makefile for zlib, derived from Makefile.dj2. | 1 | # Makefile for zlib, derived from Makefile.dj2. |
| 2 | # Modified for mingw32 by C. Spieler, 6/16/98. | 2 | # Modified for mingw32 by C. Spieler, 6/16/98. |
| 3 | # Updated for zlib-1.2.x by Cosmin Truta, 11-Mar-2003. | 3 | # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. |
| 4 | # Last updated: 1-Aug-2003. | ||
| 4 | # Tested under Cygwin and MinGW. | 5 | # Tested under Cygwin and MinGW. |
| 5 | 6 | ||
| 6 | # Copyright (C) 1995-1998 Jean-loup Gailly. | 7 | # Copyright (C) 1995-2003 Jean-loup Gailly. |
| 7 | # For conditions of distribution and use, see copyright notice in zlib.h | 8 | # For conditions of distribution and use, see copyright notice in zlib.h |
| 8 | 9 | ||
| 9 | # To compile, or to compile and test, type: | 10 | # To compile, or to compile and test, type: |
| 10 | # | 11 | # |
| 11 | # make -fmakefile.gcc; make test -fmakefile.gcc | 12 | # make -fmakefile.gcc; make test testdll -fmakefile.gcc |
| 12 | # | 13 | # |
| 14 | # To use the asm code, type: | ||
| 15 | # cp contrib/asm?86/match.S ./match.S | ||
| 16 | # make LOC=-DASMV OBJA=match.o -fmakefile.gcc | ||
| 17 | # | ||
| 13 | # To install libz.a, zconf.h and zlib.h in the system directories, type: | 18 | # To install libz.a, zconf.h and zlib.h in the system directories, type: |
| 14 | # | 19 | # |
| 15 | # make install -fmakefile.gcc | 20 | # make install -fmakefile.gcc |
| 16 | # | ||
| 17 | 21 | ||
| 18 | LIB = libz.a | 22 | # Note: |
| 19 | SHAREDLIB = zlib.dll | 23 | # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), |
| 20 | VER = 1.2.0 | 24 | # the DLL name should be changed from "zlib1.dll". |
| 25 | |||
| 26 | STATICLIB = libz.a | ||
| 27 | SHAREDLIB = zlib1.dll | ||
| 28 | IMPLIB = libzdll.a | ||
| 29 | |||
| 30 | #LOC = -DASMV | ||
| 31 | #LOC = -DDEBUG -g | ||
| 21 | 32 | ||
| 22 | CC = gcc | 33 | CC = gcc |
| 23 | #CFLAGS = -DDEBUG -MMD -g | ||
| 24 | CFLAGS = $(LOC) -O3 -Wall | 34 | CFLAGS = $(LOC) -O3 -Wall |
| 25 | 35 | ||
| 26 | AS = $(CC) | 36 | AS = $(CC) |
| @@ -33,6 +43,7 @@ AR = ar | |||
| 33 | ARFLAGS = rcs | 43 | ARFLAGS = rcs |
| 34 | 44 | ||
| 35 | RC = windres | 45 | RC = windres |
| 46 | RCFLAGS = --define GCC_WINDRES | ||
| 36 | 47 | ||
| 37 | CP = cp -fp | 48 | CP = cp -fp |
| 38 | # If GNU install is available, replace $(CP) with install. | 49 | # If GNU install is available, replace $(CP) with install. |
| @@ -44,61 +55,75 @@ exec_prefix = $(prefix) | |||
| 44 | 55 | ||
| 45 | OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ | 56 | OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ |
| 46 | inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o | 57 | inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o |
| 47 | |||
| 48 | DLLDEF = win32/zlibgcc.def | ||
| 49 | |||
| 50 | # to use the asm code: make OBJA=match.o | ||
| 51 | OBJA = | 58 | OBJA = |
| 52 | 59 | ||
| 53 | TEST_OBJS = example.o minigzip.o | 60 | all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d |
| 54 | |||
| 55 | all: $(LIB) $(SHAREDLIB) example minigzip | ||
| 56 | 61 | ||
| 57 | test: all | 62 | test: example minigzip |
| 58 | ./example | 63 | ./example |
| 59 | echo hello world | ./minigzip | ./minigzip -d | 64 | echo hello world | ./minigzip | ./minigzip -d |
| 65 | |||
| 66 | testdll: example_d minigzip_d | ||
| 67 | ./example_d | ||
| 68 | echo hello world | ./minigzip_d | ./minigzip_d -d | ||
| 60 | 69 | ||
| 61 | .c.o: | 70 | .c.o: |
| 62 | $(CC) $(CFLAGS) -c -o $@ $< | 71 | $(CC) $(CFLAGS) -c -o $@ $< |
| 63 | 72 | ||
| 64 | libz.a: $(OBJS) | 73 | .S.o: |
| 65 | $(AR) $(ARFLAGS) $@ $(OBJS) | 74 | $(AS) $(ASFLAGS) -c -o $@ $< |
| 75 | |||
| 76 | $(STATICLIB): $(OBJS) $(OBJA) | ||
| 77 | $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) | ||
| 78 | |||
| 79 | $(IMPLIB): $(SHAREDLIB) | ||
| 80 | |||
| 81 | $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o | ||
| 82 | dllwrap --driver-name $(CC) --def win32/zlib.def \ | ||
| 83 | --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o | ||
| 84 | strip $@ | ||
| 85 | |||
| 86 | example: example.o $(STATICLIB) | ||
| 87 | $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) | ||
| 66 | 88 | ||
| 67 | $(SHAREDLIB): $(OBJS) $(DLLDEF) zlibrc.o | 89 | minigzip: minigzip.o $(STATICLIB) |
| 68 | dllwrap --driver-name $(CC) --def $(DLLDEF) -o $@ $(OBJS) zlibrc.o | 90 | $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) |
| 69 | 91 | ||
| 70 | example: example.o $(LIB) | 92 | example_d: example.o $(IMPLIB) |
| 71 | $(LD) -o $@ $< $(LIB) | 93 | $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) |
| 72 | 94 | ||
| 73 | minigzip: minigzip.o $(LIB) | 95 | minigzip_d: minigzip.o $(IMPLIB) |
| 74 | $(LD) -o $@ $< $(LIB) | 96 | $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) |
| 75 | 97 | ||
| 76 | zlibrc.o: win32/zlib.rc | 98 | zlibrc.o: win32/zlib1.rc |
| 77 | -$(RC) -o $@ --define GCC_WINDRES win32/zlib.rc | 99 | $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc |
| 78 | 100 | ||
| 79 | 101 | ||
| 80 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . | 102 | # INCLUDE_PATH and LIBRARY_PATH must be set. |
| 81 | 103 | ||
| 82 | .PHONY : uninstall clean | 104 | .PHONY: install uninstall clean |
| 83 | 105 | ||
| 84 | install: zlib.h zconf.h $(LIB) | 106 | install: zlib.h zconf.h $(LIB) |
| 85 | -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH) | 107 | -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH) |
| 86 | -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH) | 108 | -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH) |
| 87 | $(INSTALL) zlib.h $(INCLUDE_PATH) | 109 | -$(INSTALL) zlib.h $(INCLUDE_PATH) |
| 88 | $(INSTALL) zconf.h $(INCLUDE_PATH) | 110 | -$(INSTALL) zconf.h $(INCLUDE_PATH) |
| 89 | $(INSTALL) $(LIB) $(LIBRARY_PATH) | 111 | -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) |
| 112 | -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH) | ||
| 90 | 113 | ||
| 91 | uninstall: | 114 | uninstall: |
| 92 | $(RM) $(INCLUDE_PATH)/zlib.h | 115 | -$(RM) $(INCLUDE_PATH)/zlib.h |
| 93 | $(RM) $(INCLUDE_PATH)/zconf.h | 116 | -$(RM) $(INCLUDE_PATH)/zconf.h |
| 94 | $(RM) $(LIBRARY_PATH)/libz.a | 117 | -$(RM) $(LIBRARY_PATH)/$(STATICLIB) |
| 118 | -$(RM) $(LIBRARY_PATH)/$(IMPLIB) | ||
| 95 | 119 | ||
| 96 | clean: | 120 | clean: |
| 97 | $(RM) *.o | 121 | -$(RM) $(STATICLIB) |
| 98 | $(RM) *.exe | 122 | -$(RM) $(SHAREDLIB) |
| 99 | $(RM) libz.a | 123 | -$(RM) $(IMPLIB) |
| 100 | $(RM) zlib.dll | 124 | -$(RM) *.o |
| 101 | $(RM) foo.gz | 125 | -$(RM) *.exe |
| 126 | -$(RM) foo.gz | ||
| 102 | 127 | ||
| 103 | adler32.o: zlib.h zconf.h | 128 | adler32.o: zlib.h zconf.h |
| 104 | compress.o: zlib.h zconf.h | 129 | compress.o: zlib.h zconf.h |
| @@ -110,7 +135,7 @@ inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | |||
| 110 | inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 135 | inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |
| 111 | infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 136 | infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |
| 112 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h | 137 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h |
| 113 | minigzip.o: zlib.h zconf.h | 138 | minigzip.o: zlib.h zconf.h |
| 114 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | 139 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h |
| 115 | uncompr.o: zlib.h zconf.h | 140 | uncompr.o: zlib.h zconf.h |
| 116 | zutil.o: zutil.h zlib.h zconf.h | 141 | zutil.o: zutil.h zlib.h zconf.h |
diff --git a/win32/Makefile.msc b/win32/Makefile.msc index 4dc8819..528ecaa 100644 --- a/win32/Makefile.msc +++ b/win32/Makefile.msc | |||
| @@ -1,92 +1,126 @@ | |||
| 1 | # Makefile for Win32 zlib.dll and the static library zlibstat.lib | 1 | # Makefile for zlib -- Microsoft (Visual) C |
| 2 | # -- Microsoft (Visual) C. | 2 | # |
| 3 | # Author: Cosmin Truta, 11-Mar-2003 | 3 | # Authors: |
| 4 | # Christian Spieler, 19-Mar-2003 | 4 | # Cosmin Truta, 11-Mar-2003 |
| 5 | # | 5 | # Christian Spieler, 19-Mar-2003 |
| 6 | # Usage: nmake -f win32/Makefile.msc | 6 | # |
| 7 | 7 | # Last updated: | |
| 8 | CC = cl | 8 | # Cosmin Truta, 27-Aug-2003 |
| 9 | LD = cl | 9 | # |
| 10 | RC = rc | 10 | # Usage: |
| 11 | CFLAGS = -nologo -MD -O2 | 11 | # nmake -f win32/Makefile.msc (standard build) |
| 12 | LDFLAGS = -nologo | 12 | # nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) |
| 13 | 13 | # nmake -f win32/Makefile.msc LOC=-DASMV OBJA=match.obj (use ASM code) | |
| 14 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ | 14 | |
| 15 | inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj | 15 | |
| 16 | 16 | # optional build flags | |
| 17 | # targets | 17 | LOC = |
| 18 | all: zlib.dll zlibstat.lib example.exe minigzip.exe exampl_s.exe minigz_s.exe | 18 | |
| 19 | 19 | ||
| 20 | zlibstat.lib: $(OBJS) | 20 | # variables |
| 21 | lib -out:$@ $(OBJS) | 21 | STATICLIB = zlib.lib |
| 22 | 22 | SHAREDLIB = zlib1.dll | |
| 23 | zlib.dll: $(OBJS) zlib.res win32/zlib.def | 23 | IMPLIB = zdll.lib |
| 24 | link -release -def:win32/zlib.def -dll -out:$@ $(OBJS) zlib.res | 24 | |
| 25 | 25 | CC = cl | |
| 26 | zlib.lib: zlib.dll | 26 | AS = ml |
| 27 | 27 | LD = link | |
| 28 | example.exe: example.obj zlib.lib | 28 | AR = lib |
| 29 | $(LD) $(LDFLAGS) example.obj zlib.lib | 29 | RC = rc |
| 30 | 30 | CFLAGS = -nologo -MD -O2 $(LOC) | |
| 31 | minigzip.exe: minigzip.obj zlib.lib | 31 | ASFLAGS = -coff |
| 32 | $(LD) $(LDFLAGS) minigzip.obj zlib.lib | 32 | LDFLAGS = -nologo -release |
| 33 | 33 | ARFLAGS = -nologo | |
| 34 | exampl_s.exe: example.obj zlibstat.lib | 34 | RCFLAGS = /dWIN32 /r |
| 35 | $(LD) $(LDFLAGS) -o $@ example.obj zlibstat.lib | 35 | |
| 36 | 36 | OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ | |
| 37 | minigz_s.exe: minigzip.obj zlibstat.lib | 37 | inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj |
| 38 | $(LD) $(LDFLAGS) -o $@ minigzip.obj zlibstat.lib | 38 | OBJA = |
| 39 | 39 | ||
| 40 | .c.obj: | 40 | |
| 41 | $(CC) -c $(CFLAGS) $< | 41 | # targets |
| 42 | 42 | all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ | |
| 43 | zlib.res: win32/zlib.rc | 43 | example.exe minigzip.exe example_d.exe minigzip_d.exe |
| 44 | $(RC) /l 0x409 /fo$@ /d WIN32 win32/zlib.rc | 44 | |
| 45 | 45 | $(STATICLIB): $(OBJS) $(OBJA) | |
| 46 | adler32.obj: adler32.c zlib.h zconf.h | 46 | $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) |
| 47 | 47 | ||
| 48 | compress.obj: compress.c zlib.h zconf.h | 48 | $(IMPLIB): $(SHAREDLIB) |
| 49 | 49 | ||
| 50 | crc32.obj: crc32.c zlib.h zconf.h crc32.h | 50 | $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res |
| 51 | 51 | $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \ | |
| 52 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h | 52 | -out:$@ $(OBJS) $(OBJA) zlib1.res |
| 53 | 53 | ||
| 54 | gzio.obj: gzio.c zutil.h zlib.h zconf.h | 54 | example.exe: example.obj $(STATICLIB) |
| 55 | 55 | $(LD) $(LDFLAGS) example.obj $(STATICLIB) | |
| 56 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | 56 | |
| 57 | inffast.h inffixed.h | 57 | minigzip.exe: minigzip.obj $(STATICLIB) |
| 58 | 58 | $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB) | |
| 59 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | 59 | |
| 60 | inffast.h | 60 | example_d.exe: example.obj $(IMPLIB) |
| 61 | 61 | $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB) | |
| 62 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | 62 | |
| 63 | inffast.h inffixed.h | 63 | minigzip_d.exe: minigzip.obj $(IMPLIB) |
| 64 | 64 | $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB) | |
| 65 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h | 65 | |
| 66 | 66 | .c.obj: | |
| 67 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | 67 | $(CC) -c $(CFLAGS) $< |
| 68 | 68 | ||
| 69 | uncompr.obj: uncompr.c zlib.h zconf.h | 69 | .asm.obj: |
| 70 | 70 | $(AS) -c $(ASFLAGS) $< | |
| 71 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | 71 | |
| 72 | 72 | adler32.obj: adler32.c zlib.h zconf.h | |
| 73 | example.obj: example.c zlib.h zconf.h | 73 | |
| 74 | 74 | compress.obj: compress.c zlib.h zconf.h | |
| 75 | minigzip.obj: minigzip.c zlib.h zconf.h | 75 | |
| 76 | 76 | crc32.obj: crc32.c zlib.h zconf.h crc32.h | |
| 77 | # testing | 77 | |
| 78 | test: example.exe minigzip.exe | 78 | deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h |
| 79 | example | 79 | |
| 80 | echo hello world | minigzip | minigzip -d | 80 | gzio.obj: gzio.c zutil.h zlib.h zconf.h |
| 81 | 81 | ||
| 82 | teststat: exampl_s.exe minigz_s.exe | 82 | infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ |
| 83 | exampl_s | 83 | inffast.h inffixed.h |
| 84 | echo hello world | minigz_s | minigz_s -d | 84 | |
| 85 | 85 | inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ | |
| 86 | # cleanup | 86 | inffast.h |
| 87 | clean: | 87 | |
| 88 | del *.obj | 88 | inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ |
| 89 | del *.dll | 89 | inffast.h inffixed.h |
| 90 | del *.lib | 90 | |
| 91 | del *.exp | 91 | inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h |
| 92 | del *.exe | 92 | |
| 93 | trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h | ||
| 94 | |||
| 95 | uncompr.obj: uncompr.c zlib.h zconf.h | ||
| 96 | |||
| 97 | zutil.obj: zutil.c zutil.h zlib.h zconf.h | ||
| 98 | |||
| 99 | example.obj: example.c zlib.h zconf.h | ||
| 100 | |||
| 101 | minigzip.obj: minigzip.c zlib.h zconf.h | ||
| 102 | |||
| 103 | zlib1.res: win32/zlib1.rc | ||
| 104 | $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc | ||
| 105 | |||
| 106 | |||
| 107 | # testing | ||
| 108 | test: example.exe minigzip.exe | ||
| 109 | example | ||
| 110 | echo hello world | minigzip | minigzip -d | ||
| 111 | |||
| 112 | testdll: example_d.exe minigzip_d.exe | ||
| 113 | example_d | ||
| 114 | echo hello world | minigzip_d | minigzip_d -d | ||
| 115 | |||
| 116 | |||
| 117 | # cleanup | ||
| 118 | clean: | ||
| 119 | -del $(STATICLIB) | ||
| 120 | -del $(SHAREDLIB) | ||
| 121 | -del $(IMPLIB) | ||
| 122 | -del *.obj | ||
| 123 | -del *.res | ||
| 124 | -del *.exp | ||
| 125 | -del *.exe | ||
| 126 | -del foo.gz | ||
diff --git a/win32/zlib.def b/win32/zlib.def index d299ed5..5688a1c 100644 --- a/win32/zlib.def +++ b/win32/zlib.def | |||
| @@ -1,52 +1,59 @@ | |||
| 1 | LIBRARY zlib.dll | 1 | LIBRARY |
| 2 | DESCRIPTION "zlib data compression library" | 2 | ; zlib data compression library |
| 3 | 3 | ||
| 4 | EXPORTS | 4 | EXPORTS |
| 5 | adler32 @1 | 5 | ; basic functions |
| 6 | compress @2 | 6 | zlibVersion |
| 7 | crc32 @3 | 7 | deflate |
| 8 | deflate @4 | 8 | deflateEnd |
| 9 | deflateCopy @5 | 9 | inflate |
| 10 | deflateEnd @6 | 10 | inflateEnd |
| 11 | deflateInit2_ @7 | 11 | ; advanced functions |
| 12 | deflateInit_ @8 | 12 | deflateSetDictionary |
| 13 | deflateParams @9 | 13 | deflateCopy |
| 14 | deflateReset @10 | 14 | deflateReset |
| 15 | deflateSetDictionary @11 | 15 | deflateParams |
| 16 | gzclose @12 | 16 | deflateBound |
| 17 | gzdopen @13 | 17 | inflateSetDictionary |
| 18 | gzerror @14 | 18 | inflateSync |
| 19 | gzflush @15 | 19 | inflateCopy |
| 20 | gzopen @16 | 20 | inflateReset |
| 21 | gzread @17 | 21 | inflateBack |
| 22 | gzwrite @18 | 22 | inflateBackEnd |
| 23 | inflate @19 | 23 | zlibCompileFlags |
| 24 | inflateEnd @20 | 24 | ; utility functions |
| 25 | inflateInit2_ @21 | 25 | compress |
| 26 | inflateInit_ @22 | 26 | compress2 |
| 27 | inflateReset @23 | 27 | compressBound |
| 28 | inflateSetDictionary @24 | 28 | uncompress |
| 29 | inflateSync @25 | 29 | gzopen |
| 30 | uncompress @26 | 30 | gzdopen |
| 31 | zlibVersion @27 | 31 | gzsetparams |
| 32 | gzprintf @28 | 32 | gzread |
| 33 | gzputc @29 | 33 | gzwrite |
| 34 | gzgetc @30 | 34 | gzprintf |
| 35 | gzseek @31 | 35 | gzputs |
| 36 | gzrewind @32 | 36 | gzgets |
| 37 | gztell @33 | 37 | gzputc |
| 38 | gzeof @34 | 38 | gzgetc |
| 39 | gzsetparams @35 | 39 | gzungetc |
| 40 | zError @36 | 40 | gzflush |
| 41 | inflateSyncPoint @37 | 41 | gzseek |
| 42 | get_crc_table @38 | 42 | gzrewind |
| 43 | compress2 @39 | 43 | gztell |
| 44 | gzputs @40 | 44 | gzeof |
| 45 | gzgets @41 | 45 | gzclose |
| 46 | ; since zlib-1.2.0: | 46 | gzerror |
| 47 | inflateCopy @42 | 47 | gzclearerr |
| 48 | inflateBackInit_ @43 | 48 | ; checksum functions |
| 49 | inflateBack @44 | 49 | adler32 |
| 50 | inflateBackEnd @45 | 50 | crc32 |
| 51 | compressBound @46 | 51 | ; various hacks, don't look :) |
| 52 | deflateBound @47 | 52 | deflateInit_ |
| 53 | deflateInit2_ | ||
| 54 | inflateInit_ | ||
| 55 | inflateInit2_ | ||
| 56 | inflateBackInit_ | ||
| 57 | inflateSyncPoint | ||
| 58 | get_crc_table | ||
| 59 | zError | ||
diff --git a/win32/zlib1.rc b/win32/zlib1.rc new file mode 100644 index 0000000..138d30c --- /dev/null +++ b/win32/zlib1.rc | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #include <windows.h> | ||
| 2 | |||
| 3 | #ifdef GCC_WINDRES | ||
| 4 | VS_VERSION_INFO VERSIONINFO | ||
| 5 | #else | ||
| 6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE | ||
| 7 | #endif | ||
| 8 | FILEVERSION 1,2,0,5 | ||
| 9 | PRODUCTVERSION 1,2,0,5 | ||
| 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | ||
| 11 | #ifdef _DEBUG | ||
| 12 | FILEFLAGS 1 | ||
| 13 | #else | ||
| 14 | FILEFLAGS 0 | ||
| 15 | #endif | ||
| 16 | FILEOS VOS_DOS_WINDOWS32 | ||
| 17 | FILETYPE VFT_DLL | ||
| 18 | FILESUBTYPE 0 // not used | ||
| 19 | BEGIN | ||
| 20 | BLOCK "StringFileInfo" | ||
| 21 | BEGIN | ||
| 22 | BLOCK "040904E4" | ||
| 23 | //language ID = U.S. English, char set = Windows, Multilingual | ||
| 24 | BEGIN | ||
| 25 | VALUE "FileDescription", "zlib data compression library\0" | ||
| 26 | VALUE "FileVersion", "1.2.0.5\0" | ||
| 27 | VALUE "InternalName", "zlib1.dll\0" | ||
| 28 | VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" | ||
| 29 | VALUE "OriginalFilename", "zlib1.dll\0" | ||
| 30 | VALUE "ProductName", "zlib\0" | ||
| 31 | VALUE "ProductVersion", "1.2.0.5\0" | ||
| 32 | VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" | ||
| 33 | END | ||
| 34 | END | ||
| 35 | BLOCK "VarFileInfo" | ||
| 36 | BEGIN | ||
| 37 | VALUE "Translation", 0x0409, 1252 | ||
| 38 | END | ||
| 39 | END | ||
