671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Greg Roelofs
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Last modified: 16 February 1999
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# The programs built by this makefile are described in the book,
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Associates, 1999). Go buy a copy, eh? Buy some for friends
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# and family, too. (Not that this is a blatant plug or anything.)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Invoke this makefile from a DOS prompt window via:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# %devstudio%\vc\bin\vcvars32.bat
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# nmake -nologo -f Makefile.w32
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# where %devstudio% is the installation directory for MSVC / DevStudio. If
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# you get "environment out of space" errors, create a desktop shortcut with
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# "c:\windows\command.com /e:4096" as the program command line and set the
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# working directory to this directory. Then double-click to open the new
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# DOS-prompt window with a bigger environment and retry the commands above.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# This makefile assumes libpng and zlib have already been built or downloaded
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# and are in subdirectories at the same level as the current subdirectory
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# Note that the names of the dynamic and static libpng and zlib libraries
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# used below may change in later releases of the libraries. This makefile
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# builds statically linked executables, but that can be changed by uncom-
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# menting the appropriate PNGLIB and ZLIB lines.
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync!include <ntwin32.mak>
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# macros --------------------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncPNGPATH = ../libpng
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncPNGINC = -I$(PNGPATH)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#PNGLIB = $(PNGPATH)/pngdll.lib
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncPNGLIB = $(PNGPATH)/libpng.lib
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncZPATH = ../zlib
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncZINC = -I$(ZPATH)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync#ZLIB = $(ZPATH)/zlibdll.lib
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncZLIB = $(ZPATH)/zlibstat.lib
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncWINLIBS = -defaultlib:user32.lib gdi32.lib
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# ["real" apps may also need comctl32.lib, comdlg32.lib, winmm.lib, etc.]
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncINCS = $(PNGINC) $(ZINC)
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncRLIBS = $(PNGLIB) $(ZLIB) $(WINLIBS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncWLIBS = $(PNGLIB) $(ZLIB)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncCC = cl
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncLD = link
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncRM = del
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncCFLAGS = -nologo -O -W3 $(INCS) $(cvars)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")]
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncO = .obj
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncE = .exe
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncRLDFLAGS = -nologo -subsystem:windows
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncWLDFLAGS = -nologo
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncRPNG = rpng-win
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncRPNG2 = rpng2-win
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncWPNG = wpng
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncROBJS = $(RPNG)$(O) readpng$(O)
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncROBJS2 = $(RPNG2)$(O) readpng2$(O)
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncWOBJS = $(WPNG)$(O) writepng$(O)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncEXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# implicit make rules -------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync.c$(O):
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(CC) -c $(CFLAGS) $<
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# dependencies --------------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncall: $(EXES)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(RPNG)$(E): $(ROBJS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(LD) $(RLDFLAGS) -out:$@ $(ROBJS) $(RLIBS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(RPNG2)$(E): $(ROBJS2)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(LD) $(RLDFLAGS) -out:$@ $(ROBJS2) $(RLIBS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(WPNG)$(E): $(WOBJS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(LD) $(WLDFLAGS) -out:$@ $(WOBJS) $(WLIBS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(RPNG)$(O): $(RPNG).c readpng.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(RPNG2)$(O): $(RPNG2).c readpng2.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsync$(WPNG)$(O): $(WPNG).c writepng.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncreadpng$(O): readpng.c readpng.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncreadpng2$(O): readpng2.c readpng2.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncwritepng$(O): writepng.c writepng.h
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# maintenance ---------------------------------------------------------------
671242f350d172e106580348e24bab66b0d7e6a5vboxsync
671242f350d172e106580348e24bab66b0d7e6a5vboxsyncclean:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# ideally we could just do this:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync# ...but the Windows "DEL" command is none too bright, so:
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(RM) r*$(E)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(RM) w*$(E)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(RM) r*$(O)
671242f350d172e106580348e24bab66b0d7e6a5vboxsync $(RM) w*$(O)