Blame contrib/gregbook/Makefile.w32

Packit 0ba690
# Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
Packit 0ba690
# Greg Roelofs
Packit 0ba690
# Last modified:  2 June 2007
Packit 0ba690
#
Packit 0ba690
#	The programs built by this makefile are described in the book,
Packit 0ba690
#	"PNG:  The Definitive Guide," by Greg Roelofs (O'Reilly and
Packit 0ba690
#	Associates, 1999).  Go buy a copy, eh?  Well, OK, it's not
Packit 0ba690
#	generally for sale anymore, but it's the thought that counts,
Packit 0ba690
#	right?  (Hint:  http://www.libpng.org/pub/png/book/ )
Packit 0ba690
#
Packit 0ba690
# Invoke this makefile from a DOS prompt window via:
Packit 0ba690
#
Packit 0ba690
#	%devstudio%\vc\bin\vcvars32.bat
Packit 0ba690
#	nmake -nologo -f Makefile.w32
Packit 0ba690
#
Packit 0ba690
# where %devstudio% is the installation directory for MSVC / DevStudio.  If
Packit 0ba690
# you get "environment out of space" errors, create a desktop shortcut with
Packit 0ba690
# "c:\windows\command.com /e:4096" as the program command line and set the
Packit 0ba690
# working directory to this directory.  Then double-click to open the new
Packit 0ba690
# DOS-prompt window with a bigger environment and retry the commands above.
Packit 0ba690
# 
Packit 0ba690
# This makefile assumes libpng and zlib have already been built or downloaded
Packit 0ba690
# and are in subdirectories at the same level as the current subdirectory
Packit 0ba690
# (as indicated by the PNGPATH and ZPATH macros below).  Edit as appropriate.
Packit 0ba690
#
Packit 0ba690
# Note that the names of the dynamic and static libpng and zlib libraries
Packit 0ba690
# used below may change in later releases of the libraries.  This makefile
Packit 0ba690
# builds statically linked executables, but that can be changed by uncom-
Packit 0ba690
# menting the appropriate PNGLIB and ZLIB lines.
Packit 0ba690
Packit 0ba690
!include <ntwin32.mak>
Packit 0ba690
Packit 0ba690
Packit 0ba690
# macros --------------------------------------------------------------------
Packit 0ba690
Packit 0ba690
PNGPATH = ../libpng
Packit 0ba690
PNGINC = -I$(PNGPATH)
Packit 0ba690
#PNGLIB = $(PNGPATH)/pngdll.lib
Packit 0ba690
PNGLIB = $(PNGPATH)/libpng.lib
Packit 0ba690
Packit 0ba690
ZPATH = ../zlib
Packit 0ba690
ZINC = -I$(ZPATH)
Packit 0ba690
#ZLIB = $(ZPATH)/zlibdll.lib
Packit 0ba690
ZLIB = $(ZPATH)/zlibstat.lib
Packit 0ba690
Packit 0ba690
WINLIBS = -defaultlib:user32.lib gdi32.lib
Packit 0ba690
# ["real" apps may also need comctl32.lib, comdlg32.lib, winmm.lib, etc.]
Packit 0ba690
Packit 0ba690
INCS = $(PNGINC) $(ZINC)
Packit 0ba690
RLIBS = $(PNGLIB) $(ZLIB) $(WINLIBS)
Packit 0ba690
WLIBS = $(PNGLIB) $(ZLIB)
Packit 0ba690
Packit 0ba690
CC = cl
Packit 0ba690
LD = link
Packit 0ba690
RM = del
Packit 0ba690
CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
Packit 0ba690
# [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
Packit 0ba690
# [see %devstudio%\vc\include\win32.mak for cvars macro definition]
Packit 0ba690
O = .obj
Packit 0ba690
E = .exe
Packit 0ba690
Packit 0ba690
RLDFLAGS = -nologo -subsystem:windows
Packit 0ba690
WLDFLAGS = -nologo
Packit 0ba690
Packit 0ba690
RPNG  = rpng-win
Packit 0ba690
RPNG2 = rpng2-win
Packit 0ba690
WPNG  = wpng
Packit 0ba690
Packit 0ba690
ROBJS  = $(RPNG)$(O) readpng$(O)
Packit 0ba690
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
Packit 0ba690
WOBJS  = $(WPNG)$(O) writepng$(O)
Packit 0ba690
Packit 0ba690
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
Packit 0ba690
Packit 0ba690
Packit 0ba690
# implicit make rules -------------------------------------------------------
Packit 0ba690
Packit 0ba690
.c$(O):
Packit 0ba690
	$(CC) -c $(CFLAGS) $<
Packit 0ba690
Packit 0ba690
Packit 0ba690
# dependencies --------------------------------------------------------------
Packit 0ba690
Packit 0ba690
all:  $(EXES)
Packit 0ba690
Packit 0ba690
$(RPNG)$(E): $(ROBJS)
Packit 0ba690
	$(LD) $(RLDFLAGS) -out:$@ $(ROBJS) $(RLIBS)
Packit 0ba690
Packit 0ba690
$(RPNG2)$(E): $(ROBJS2)
Packit 0ba690
	$(LD) $(RLDFLAGS) -out:$@ $(ROBJS2) $(RLIBS)
Packit 0ba690
Packit 0ba690
$(WPNG)$(E): $(WOBJS)
Packit 0ba690
	$(LD) $(WLDFLAGS) -out:$@ $(WOBJS) $(WLIBS)
Packit 0ba690
Packit 0ba690
$(RPNG)$(O):	$(RPNG).c readpng.h
Packit 0ba690
$(RPNG2)$(O):	$(RPNG2).c readpng2.h
Packit 0ba690
$(WPNG)$(O):	$(WPNG).c writepng.h
Packit 0ba690
Packit 0ba690
readpng$(O):	readpng.c readpng.h
Packit 0ba690
readpng2$(O):	readpng2.c readpng2.h
Packit 0ba690
writepng$(O):	writepng.c writepng.h
Packit 0ba690
Packit 0ba690
Packit 0ba690
# maintenance ---------------------------------------------------------------
Packit 0ba690
Packit 0ba690
clean:
Packit 0ba690
#	ideally we could just do this:
Packit 0ba690
#	$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
Packit 0ba690
#	...but the Windows "DEL" command is none too bright, so:
Packit 0ba690
	$(RM) r*$(E)
Packit 0ba690
	$(RM) w*$(E)
Packit 0ba690
	$(RM) r*$(O)
Packit 0ba690
	$(RM) w*$(O)