1 | # Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
|
---|
2 | # Greg Roelofs
|
---|
3 | # Last modified: 16 February 1999
|
---|
4 | #
|
---|
5 | # The programs built by this makefile are described in the book,
|
---|
6 | # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
---|
7 | # Associates, 1999). Go buy a copy, eh? Buy some for friends
|
---|
8 | # and family, too. (Not that this is a blatant plug or anything.)
|
---|
9 | #
|
---|
10 | # Invoke this makefile from a DOS prompt window via:
|
---|
11 | #
|
---|
12 | # %devstudio%\vc\bin\vcvars32.bat
|
---|
13 | # nmake -nologo -f Makefile.w32
|
---|
14 | #
|
---|
15 | # where %devstudio% is the installation directory for MSVC / DevStudio. If
|
---|
16 | # you get "environment out of space" errors, create a desktop shortcut with
|
---|
17 | # "c:\windows\command.com /e:4096" as the program command line and set the
|
---|
18 | # working directory to this directory. Then double-click to open the new
|
---|
19 | # DOS-prompt window with a bigger environment and retry the commands above.
|
---|
20 | #
|
---|
21 | # This makefile assumes libpng and zlib have already been built or downloaded
|
---|
22 | # and are in subdirectories at the same level as the current subdirectory
|
---|
23 | # (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.
|
---|
24 | #
|
---|
25 | # Note that the names of the dynamic and static libpng and zlib libraries
|
---|
26 | # used below may change in later releases of the libraries. This makefile
|
---|
27 | # builds statically linked executables, but that can be changed by uncom-
|
---|
28 | # menting the appropriate PNGLIB and ZLIB lines.
|
---|
29 |
|
---|
30 | !include <ntwin32.mak>
|
---|
31 |
|
---|
32 |
|
---|
33 | # macros --------------------------------------------------------------------
|
---|
34 |
|
---|
35 | PNGPATH = ../libpng
|
---|
36 | PNGINC = -I$(PNGPATH)
|
---|
37 | #PNGLIB = $(PNGPATH)/pngdll.lib
|
---|
38 | PNGLIB = $(PNGPATH)/libpng.lib
|
---|
39 |
|
---|
40 | ZPATH = ../zlib
|
---|
41 | ZINC = -I$(ZPATH)
|
---|
42 | #ZLIB = $(ZPATH)/zlibdll.lib
|
---|
43 | ZLIB = $(ZPATH)/zlibstat.lib
|
---|
44 |
|
---|
45 | WINLIBS = -defaultlib:user32.lib gdi32.lib
|
---|
46 | # ["real" apps may also need comctl32.lib, comdlg32.lib, winmm.lib, etc.]
|
---|
47 |
|
---|
48 | INCS = $(PNGINC) $(ZINC)
|
---|
49 | RLIBS = $(PNGLIB) $(ZLIB) $(WINLIBS)
|
---|
50 | WLIBS = $(PNGLIB) $(ZLIB)
|
---|
51 |
|
---|
52 | CC = cl
|
---|
53 | LD = link
|
---|
54 | RM = del
|
---|
55 | CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
|
---|
56 | # [note that -Wall is an MSVC-specific compilation flag ("all warnings on")]
|
---|
57 | # [see %devstudio%\vc\include\win32.mak for cvars macro definition]
|
---|
58 | O = .obj
|
---|
59 | E = .exe
|
---|
60 |
|
---|
61 | RLDFLAGS = -nologo -subsystem:windows
|
---|
62 | WLDFLAGS = -nologo
|
---|
63 |
|
---|
64 | RPNG = rpng-win
|
---|
65 | RPNG2 = rpng2-win
|
---|
66 | WPNG = wpng
|
---|
67 |
|
---|
68 | ROBJS = $(RPNG)$(O) readpng$(O)
|
---|
69 | ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
---|
70 | WOBJS = $(WPNG)$(O) writepng$(O)
|
---|
71 |
|
---|
72 | EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
---|
73 |
|
---|
74 |
|
---|
75 | # implicit make rules -------------------------------------------------------
|
---|
76 |
|
---|
77 | .c$(O):
|
---|
78 | $(CC) -c $(CFLAGS) $<
|
---|
79 |
|
---|
80 |
|
---|
81 | # dependencies --------------------------------------------------------------
|
---|
82 |
|
---|
83 | all: $(EXES)
|
---|
84 |
|
---|
85 | $(RPNG)$(E): $(ROBJS)
|
---|
86 | $(LD) $(RLDFLAGS) -out:$@ $(ROBJS) $(RLIBS)
|
---|
87 |
|
---|
88 | $(RPNG2)$(E): $(ROBJS2)
|
---|
89 | $(LD) $(RLDFLAGS) -out:$@ $(ROBJS2) $(RLIBS)
|
---|
90 |
|
---|
91 | $(WPNG)$(E): $(WOBJS)
|
---|
92 | $(LD) $(WLDFLAGS) -out:$@ $(WOBJS) $(WLIBS)
|
---|
93 |
|
---|
94 | $(RPNG)$(O): $(RPNG).c readpng.h
|
---|
95 | $(RPNG2)$(O): $(RPNG2).c readpng2.h
|
---|
96 | $(WPNG)$(O): $(WPNG).c writepng.h
|
---|
97 |
|
---|
98 | readpng$(O): readpng.c readpng.h
|
---|
99 | readpng2$(O): readpng2.c readpng2.h
|
---|
100 | writepng$(O): writepng.c writepng.h
|
---|
101 |
|
---|
102 |
|
---|
103 | # maintenance ---------------------------------------------------------------
|
---|
104 |
|
---|
105 | clean:
|
---|
106 | # ideally we could just do this:
|
---|
107 | # $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
|
---|
108 | # ...but the Windows "DEL" command is none too bright, so:
|
---|
109 | $(RM) r*$(E)
|
---|
110 | $(RM) w*$(E)
|
---|
111 | $(RM) r*$(O)
|
---|
112 | $(RM) w*$(O)
|
---|