MakefileWorkshop788.png (85828 bytes)

libPNGMakefile.gnu

 
 


About

Who's it for?

If you run the Cygwin posix-emulation layer / GNU toolsuite porting platform on MS Windows, this Makefile might be of interest to you. Software authors who are writing new applications that use libPNG may have many sorts of needs during the development of their project, and this build-configuration aid may help them.

At present the Makefile is only known to function properly when run in the Cygwin bash shell; support for the similar MinGW MSYS (Minimal SYStem) development environment has not been accomplished yet but is planned.

What does it do?

This Makefile is not the same as the standard Makefile for Cygwin that is part of the libPNG package. The author of this Makefile has contributed to the libPNG Cygwin Makefile and is very familiar with the details of building libPNG on Cygwin and similar GNU-enabled MSWin32 systems. What this Makefile can do that the standard one cannot includes:

When I write "cannot do" I of course am not implying that with sufficient hand-work and adaptation, other means could not be accessed by which to accomplish the same objectives listed above. There is no invention of new things going on here; what this system is about is making any of these variations of the basic theme of "libPNG on MSWin32" very simple to accomplish.

Research and Theory

As an experimental feature this Makefile also provides a very simple means of creating a libPNG Dynamic Link Library (MSWin32 DLL) which has the Zlib object code within it as well. In theory, doing so may allow higher performance by cutting the overhead involved in the scenario in which libPNG routines are calling (are linked to) Zlib routines in an external Zlib DLL. By ensuring that libPNG is statically linked to Zlib these inter-library calls are avoided. In addition, this ensures that a missing Zlib DLL on the user system will not cause failure of the functions of libPNG. And a further gain is that Zlib can be compiled with its own processor-specific assembler code optimizations and linking in the object code from such a high-performance Zlib could, again, result in more performance gains.

The drawbacks of this approach include that the user will miss the benefits of any improvements that are made in future releases of Zlib that might get installed to the system, including fixes to security-related issues. In this regard, at the very least, the user is encouraged to make sure they use the most recent (as of this writing) Zlib release, 1.1.4, as it contains fixes for a potential security exploit vulnerability discovered in 1.1.3.

Another potential exists that it might turn out to offer no particular performance improvement to do building of libPNG this way. The topic of Win32 DLL mechanisms is fairly complex and involves several considerations, which I am not going into in any detail here on this project site. No representation is being made that anything discussed here is more than semi-expert speculation and the user is strongly encouraged to do their own research. Data resulting from actual performance benchmarking to compare one way of linking to Zlib (static) with the other (dynamic) would be greatly appreciated.

(Thanks to Glenn Randers-Pehrson for pointing out the need for me to mention the above drawbacks)

What other characteristics are found in this system?

This Makefile fully supports using an external directory location for building libPNG, thus avoiding the potential inconveniences of mixing the libPNG source code files with object code files and other products and by-products of the build process.

The approach taken by nearly all forms of command-line programming, whether written in shell, C, Perl, or any other is taken here: the action of the Makefile is chosen by using optional parameter arguments on the `make' invocation command line. The Makefile should not ever need to be edited, as all the parameters controlling its functioning are accessed through the macros listed when the user types `make -f libpngMakefile.gnu help' [or 'usage']. Also, this Makefile tries earnestly to keep the user informed of what is happening and to clean up after itself when it has completed a phase of operation.

Are there any other special requirements?

As I would hope would be obvious, you must download the libPNG source code package from the usual location, and perhaps the Zlib source code will be needed as well. And, importantly, this Makefile absolutely requires that the user be using GNU 'make' (which is standard on Cygwin and on other similar GNU-ish MSWin32 development platforms).