Put back Robert de Bath's second level of bell overload tracking. It
[u/mdw/putty] / Makefile
CommitLineData
3d541627 1# Visual C++ Makefile for PuTTY.
2#
3# Use `nmake' to build.
4#
5
6##-- help
7#
8# Extra options you can set:
9#
10# - FWHACK=/DFWHACK
11# Enables a hack that tunnels through some firewall proxies.
12#
13# - VER=/DSNAPSHOT=1999-01-25
14# Generates executables whose About box report them as being a
15# development snapshot.
16#
17# - VER=/DRELEASE=0.43
18# Generates executables whose About box report them as being a
19# release version.
20#
4d331a77 21# - COMPAT=/DAUTO_WINSOCK
22# Causes PuTTY to assume that <windows.h> includes its own WinSock
23# header file, so that it won't try to include <winsock.h>.
24#
25# - COMPAT=/DWINSOCK_TWO
26# Causes the PuTTY utilities to include <winsock2.h> instead of
27# <winsock.h>, except Plink which _needs_ WinSock 2 so it already
28# does this.
29#
6ed3635b 30# - RCFL=/DASCIICTLS
760858ff 31# Uses ASCII rather than Unicode to specify the tab control in
32# the resource file. Probably most useful when compiling with
33# Cygnus/mingw32, whose resource compiler may have less of a
34# problem with it.
35#
d9027fbd 36# - XFLAGS=/DDEBUG
37# Causes PuTTY to enable internal debugging.
38#
b191636d 39# - XFLAGS=/DMALLOC_LOG
40# Causes PuTTY to emit a file called putty_mem.log, logging every
41# memory allocation and free, so you can track memory leaks.
42#
43# - XFLAGS=/DMINEFIELD
44# Causes PuTTY to use a custom memory allocator, similar in
45# concept to Electric Fence, in place of regular malloc(). Wastes
46# huge amounts of RAM, but should cause heap-corruption bugs to
47# show up as GPFs at the point of failure rather than appearing
48# later on as second-level damage.
49#
3d541627 50##--
676c0556 51
d9027fbd 52# Enable debug and incremental linking and compiling
53# CFLAGS = /nologo /W3 /YX /Yd /O1 /Gi /D_WINDOWS /DDEBUG
373e94e9 54# LFLAGS = /debug
55
d9027fbd 56# Disable debug and incremental linking and compiling
57CFLAGS = /nologo /W3 /O1 /D_WINDOWS
58LFLAGS = /incremental:no /fixed
373e94e9 59
d9027fbd 60# Use MSVC DLL
61# CFLAGS = /nologo /W3 /O1 /MD /D_WINDOWS
62# LFLAGS = /incremental:no
374330e2 63
64.c.obj:
b191636d 65 cl $(COMPAT) $(FWHACK) $(XFLAGS) $(CFLAGS) /c $*.c
374330e2 66
3d541627 67OBJ=obj
68RES=res
69
89ee5268 70##-- objects putty puttytel
8c3cd914 71GOBJS1 = window.$(OBJ) windlg.$(OBJ) winctrls.$(OBJ) terminal.$(OBJ)
4017be6d 72GOBJS2 = xlat.$(OBJ) sizetip.$(OBJ)
73##-- objects putty puttytel plink
c91409da 74LOBJS1 = telnet.$(OBJ) raw.$(OBJ) rlogin.$(OBJ) ldisc.$(OBJ) winnet.$(OBJ)
4017be6d 75##-- objects putty plink
5c58ad2d 76POBJS = be_all.$(OBJ)
89ee5268 77##-- objects puttytel
78TOBJS = be_nossh.$(OBJ)
4017be6d 79##-- objects plink
a9422f39 80PLOBJS = plink.$(OBJ)
3d541627 81##-- objects pscp
8df7a775 82SOBJS = scp.$(OBJ) winnet.$(OBJ) be_none.$(OBJ)
4a8fc3c4 83##-- objects psftp
79fc73e2 84FOBJS = psftp.$(OBJ) sftp.$(OBJ) int64.$(OBJ) winnet.$(OBJ) be_none.$(OBJ)
4a8fc3c4 85##-- objects putty puttytel pscp psftp plink
a9422f39 86MOBJS = misc.$(OBJ) version.$(OBJ) winstore.$(OBJ) settings.$(OBJ)
8df7a775 87MOBJ2 = tree234.$(OBJ)
4a8fc3c4 88##-- objects putty pscp psftp plink
89ee5268 89OBJS1 = sshcrc.$(OBJ) sshdes.$(OBJ) sshmd5.$(OBJ) sshrsa.$(OBJ) sshrand.$(OBJ)
e5574168 90OBJS2 = sshsha.$(OBJ) sshblowf.$(OBJ) noise.$(OBJ) sshdh.$(OBJ) sshdss.$(OBJ)
4ba9b64b 91OBJS3 = sshbn.$(OBJ) sshpubk.$(OBJ) ssh.$(OBJ) pageantc.$(OBJ) sshzlib.$(OBJ)
8479e33c 92OBJS4 = x11fwd.$(OBJ) sshaes.$(OBJ)
5c58ad2d 93##-- objects pageant
94PAGE1 = pageant.$(OBJ) sshrsa.$(OBJ) sshpubk.$(OBJ) sshdes.$(OBJ) sshbn.$(OBJ)
8479e33c 95PAGE2 = sshmd5.$(OBJ) version.$(OBJ) tree234.$(OBJ) misc.$(OBJ) sshaes.$(OBJ)
ddecd643 96PAGE3 = sshsha.$(OBJ) pageantc.$(OBJ)
6e522441 97##-- objects puttygen
98GEN1 = puttygen.$(OBJ) sshrsag.$(OBJ) sshprime.$(OBJ) sshdes.$(OBJ)
99GEN2 = sshbn.$(OBJ) sshmd5.$(OBJ) version.$(OBJ) sshrand.$(OBJ) noise.$(OBJ)
100GEN3 = sshsha.$(OBJ) winstore.$(OBJ) misc.$(OBJ) winctrls.$(OBJ)
8479e33c 101GEN4 = sshrsa.$(OBJ) sshpubk.$(OBJ) sshaes.$(OBJ)
9d01fc92 102##-- resources putty puttytel
3d541627 103PRESRC = win_res.$(RES)
5c58ad2d 104##-- resources pageant
105PAGERC = pageant.$(RES)
6e522441 106##-- resources puttygen
107GENRC = puttygen.$(RES)
4a8fc3c4 108##-- resources pscp psftp
3d541627 109SRESRC = scp.$(RES)
4017be6d 110##-- resources plink
111LRESRC = plink.$(RES)
3d541627 112##--
113
114##-- gui-apps
115# putty
89ee5268 116# puttytel
5c58ad2d 117# pageant
6e522441 118# puttygen
3d541627 119##-- console-apps
120# pscp
4a8fc3c4 121# psftp
6d2d5e8d 122# plink ws2_32
3d541627 123##--
124
374330e2 125LIBS1 = advapi32.lib user32.lib gdi32.lib
4017be6d 126LIBS2 = comctl32.lib comdlg32.lib
5c58ad2d 127LIBS3 = shell32.lib
4017be6d 128SOCK1 = wsock32.lib
129SOCK2 = ws2_32.lib
4585985c 130
79fc73e2 131all: putty.exe puttytel.exe pscp.exe psftp.exe \
132 plink.exe pageant.exe puttygen.exe
89ee5268 133
9c964e85 134putty.exe: $(GOBJS1) $(GOBJS2) $(LOBJS1) $(POBJS) $(MOBJS) $(MOBJ2) $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(PRESRC) putty.rsp
4491fef5 135 link $(LFLAGS) -out:putty.exe -map:putty.map @putty.rsp
89ee5268 136
8df7a775 137puttytel.exe: $(GOBJS1) $(GOBJS2) $(LOBJS1) $(TOBJS) $(MOBJS) $(MOBJ2) $(PRESRC) puttytel.rsp
4491fef5 138 link $(LFLAGS) -out:puttytel.exe -map:puttytel.map @puttytel.rsp
89ee5268 139
afc47154 140pageant.exe: $(PAGE1) $(PAGE2) $(PAGE3) $(PAGERC) pageant.rsp
4491fef5 141 link $(LFLAGS) -out:pageant.exe -map:pageant.map @pageant.rsp
5c58ad2d 142
6e522441 143puttygen.exe: $(GEN1) $(GEN2) $(GEN3) $(GEN4) $(GENRC) puttygen.rsp
4491fef5 144 link $(LFLAGS) -out:puttygen.exe -map:puttygen.map @puttygen.rsp
6e522441 145
9c964e85 146pscp.exe: $(SOBJS) $(MOBJS) $(MOBJ2) $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(SRESRC) pscp.rsp
4491fef5 147 link $(LFLAGS) -out:pscp.exe -map:pscp.map @pscp.rsp
89ee5268 148
79fc73e2 149psftp.exe: $(FOBJS) $(MOBJS) $(MOBJ2) $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(SRESRC) psftp.rsp
150 link $(LFLAGS) -out:psftp.exe -map:psftp.map @psftp.rsp
151
9c964e85 152plink.exe: $(LOBJS1) $(POBJS) $(PLOBJS) $(MOBJS) $(MOBJ2) $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(LRESRC) plink.rsp
4491fef5 153 link $(LFLAGS) -out:plink.exe -map:plink.map @plink.rsp
4017be6d 154
d9027fbd 155ssh.obj:
156 cl $(FWHACK) $(VER) $(CFLAGS) /Gi- /c ssh.c
157
89ee5268 158putty.rsp: makefile
159 echo /nologo /subsystem:windows > putty.rsp
160 echo $(GOBJS1) >> putty.rsp
161 echo $(GOBJS2) >> putty.rsp
4017be6d 162 echo $(LOBJS1) >> putty.rsp
89ee5268 163 echo $(POBJS) >> putty.rsp
164 echo $(MOBJS) >> putty.rsp
8df7a775 165 echo $(MOBJ2) >> putty.rsp
89ee5268 166 echo $(OBJS1) >> putty.rsp
167 echo $(OBJS2) >> putty.rsp
e5574168 168 echo $(OBJS3) >> putty.rsp
9c964e85 169 echo $(OBJS4) >> putty.rsp
89ee5268 170 echo $(PRESRC) >> putty.rsp
171 echo $(LIBS1) >> putty.rsp
172 echo $(LIBS2) >> putty.rsp
defab6b8 173 echo $(LIBS3) >> putty.rsp
4017be6d 174 echo $(SOCK1) >> putty.rsp
89ee5268 175
176puttytel.rsp: makefile
177 echo /nologo /subsystem:windows > puttytel.rsp
178 echo $(GOBJS1) >> puttytel.rsp
179 echo $(GOBJS2) >> puttytel.rsp
4017be6d 180 echo $(LOBJS1) >> puttytel.rsp
89ee5268 181 echo $(TOBJS) >> puttytel.rsp
182 echo $(MOBJS) >> puttytel.rsp
8df7a775 183 echo $(MOBJ2) >> puttytel.rsp
9d01fc92 184 echo $(PRESRC) >> puttytel.rsp
89ee5268 185 echo $(LIBS1) >> puttytel.rsp
186 echo $(LIBS2) >> puttytel.rsp
defab6b8 187 echo $(LIBS3) >> puttytel.rsp
4017be6d 188 echo $(SOCK1) >> puttytel.rsp
89ee5268 189
5c58ad2d 190pageant.rsp: makefile
191 echo /nologo /subsystem:windows > pageant.rsp
6e522441 192 echo $(PAGE1) >> pageant.rsp
193 echo $(PAGE2) >> pageant.rsp
afc47154 194 echo $(PAGE3) >> pageant.rsp
6e522441 195 echo $(PAGERC) >> pageant.rsp
5c58ad2d 196 echo $(LIBS1) >> pageant.rsp
197 echo $(LIBS2) >> pageant.rsp
198 echo $(LIBS3) >> pageant.rsp
199
6e522441 200puttygen.rsp: makefile
201 echo /nologo /subsystem:windows > puttygen.rsp
202 echo $(GEN1) >> puttygen.rsp
203 echo $(GEN2) >> puttygen.rsp
204 echo $(GEN3) >> puttygen.rsp
205 echo $(GEN4) >> puttygen.rsp
206 echo $(GENRC) >> puttygen.rsp
207 echo $(LIBS1) >> puttygen.rsp
208 echo $(LIBS2) >> puttygen.rsp
209 echo $(LIBS3) >> puttygen.rsp
210
89ee5268 211pscp.rsp: makefile
212 echo /nologo /subsystem:console > pscp.rsp
213 echo $(SOBJS) >> pscp.rsp
214 echo $(MOBJS) >> pscp.rsp
8df7a775 215 echo $(MOBJ2) >> pscp.rsp
89ee5268 216 echo $(OBJS1) >> pscp.rsp
217 echo $(OBJS2) >> pscp.rsp
e5574168 218 echo $(OBJS3) >> pscp.rsp
9c964e85 219 echo $(OBJS4) >> pscp.rsp
89ee5268 220 echo $(SRESRC) >> pscp.rsp
221 echo $(LIBS1) >> pscp.rsp
222 echo $(LIBS2) >> pscp.rsp
4017be6d 223 echo $(SOCK1) >> pscp.rsp
224
79fc73e2 225psftp.rsp: makefile
226 echo /nologo /subsystem:console > psftp.rsp
227 echo $(FOBJS) >> psftp.rsp
228 echo $(MOBJS) >> psftp.rsp
229 echo $(MOBJ2) >> psftp.rsp
230 echo $(OBJS1) >> psftp.rsp
231 echo $(OBJS2) >> psftp.rsp
232 echo $(OBJS3) >> psftp.rsp
233 echo $(OBJS4) >> psftp.rsp
234 echo $(SRESRC) >> psftp.rsp
235 echo $(LIBS1) >> psftp.rsp
236 echo $(LIBS2) >> psftp.rsp
237 echo $(SOCK1) >> psftp.rsp
238
4017be6d 239plink.rsp: makefile
240 echo /nologo /subsystem:console > plink.rsp
241 echo $(LOBJS1) >> plink.rsp
242 echo $(POBJS) >> plink.rsp
243 echo $(PLOBJS) >> plink.rsp
244 echo $(MOBJS) >> plink.rsp
8df7a775 245 echo $(MOBJ2) >> plink.rsp
4017be6d 246 echo $(OBJS1) >> plink.rsp
247 echo $(OBJS2) >> plink.rsp
248 echo $(OBJS3) >> plink.rsp
9c964e85 249 echo $(OBJS4) >> plink.rsp
4017be6d 250 echo $(LRESRC) >> plink.rsp
251 echo $(LIBS1) >> plink.rsp
252 echo $(LIBS2) >> plink.rsp
253 echo $(SOCK2) >> plink.rsp
3d541627 254
255##-- dependencies
dcbde236 256window.$(OBJ): window.c putty.h puttymem.h network.h win_res.h storage.h winstuff.h
257windlg.$(OBJ): windlg.c putty.h puttymem.h network.h ssh.h win_res.h winstuff.h
8c3cd914 258winctrls.$(OBJ): winctrls.c winstuff.h winstuff.h
dcbde236 259settings.$(OBJ): settings.c putty.h puttymem.h network.h storage.h
260winstore.$(OBJ): winstore.c putty.h puttymem.h network.h storage.h
261terminal.$(OBJ): terminal.c putty.h puttymem.h network.h
262sizetip.$(OBJ): sizetip.c putty.h puttymem.h network.h winstuff.h
263telnet.$(OBJ): telnet.c putty.h puttymem.h network.h
264raw.$(OBJ): raw.c putty.h puttymem.h network.h
c91409da 265rlogin.$(OBJ): rlogin.c putty.h puttymem.h network.h
dcbde236 266xlat.$(OBJ): xlat.c putty.h puttymem.h network.h
267ldisc.$(OBJ): ldisc.c putty.h puttymem.h network.h
268misc.$(OBJ): misc.c putty.h puttymem.h network.h
269noise.$(OBJ): noise.c putty.h puttymem.h network.h ssh.h storage.h
270ssh.$(OBJ): ssh.c ssh.h putty.h puttymem.h network.h tree234.h
271sshcrc.$(OBJ): sshcrc.c ssh.h puttymem.h
272sshdes.$(OBJ): sshdes.c ssh.h puttymem.h
8479e33c 273sshaes.$(OBJ): sshaes.c ssh.h puttymem.h
dcbde236 274sshmd5.$(OBJ): sshmd5.c ssh.h puttymem.h
275sshrsa.$(OBJ): sshrsa.c ssh.h puttymem.h
276sshsha.$(OBJ): sshsha.c ssh.h puttymem.h
277sshrand.$(OBJ): sshrand.c ssh.h puttymem.h
278sshblowf.$(OBJ): sshblowf.c ssh.h puttymem.h
279sshdh.$(OBJ): sshdh.c ssh.h puttymem.h
280sshdss.$(OBJ): sshdss.c ssh.h puttymem.h
281sshbn.$(OBJ): sshbn.c ssh.h puttymem.h
282sshpubk.$(OBJ): sshpubk.c ssh.h puttymem.h
283sshzlib.$(OBJ): sshzlib.c ssh.h puttymem.h
284scp.$(OBJ): scp.c putty.h puttymem.h network.h winstuff.h
3d541627 285version.$(OBJ): version.c
89ee5268 286be_all.$(OBJ): be_all.c
287be_nossh.$(OBJ): be_nossh.c
288be_none.$(OBJ): be_none.c
dcbde236 289plink.$(OBJ): plink.c putty.h puttymem.h network.h winstuff.h
290pageant.$(OBJ): pageant.c ssh.h puttymem.h tree234.h
291pageantc.$(OBJ): pageantc.c puttymem.h
292tree234.$(OBJ): tree234.c tree234.h puttymem.h
3332c06e 293puttygen.$(OBJ): puttygen.c putty.h ssh.h winstuff.h
4a8fc3c4 294psftp.$(OBJ): psftp.c putty.h ssh.h storage.h sftp.h int64.h
791ed432 295sftp.$(OBJ): sftp.c sftp.h int64.h
4a8fc3c4 296int64.$(OBJ): int64.c int64.h
8ddd7f4e 297x11fwd.$(OBJ): x11fwd.c putty.h network.h puttymem.h ssh.h
3d541627 298##--
067a15ea 299
300# Hack to force version.obj to be rebuilt always
d9027fbd 301version.obj: *.c *.h *.rc
067a15ea 302 cl $(FWHACK) $(VER) $(CFLAGS) /c version.c
374330e2 303
3d541627 304##-- dependencies
305win_res.$(RES): win_res.rc win_res.h putty.ico
306##--
307win_res.$(RES):
6ed3635b 308 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 win_res.rc
374330e2 309
3d541627 310##-- dependencies
311scp.$(RES): scp.rc scp.ico
312##--
313scp.$(RES):
6ed3635b 314 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 scp.rc
4585985c 315
5c58ad2d 316##-- dependencies
317pageant.$(RES): pageant.rc pageant.ico pageants.ico
318##--
319pageant.$(RES):
320 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 pageant.rc
321
6e522441 322##-- dependencies
323puttygen.$(RES): puttygen.rc puttygen.ico
324##--
325puttygen.$(RES):
326 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 puttygen.rc
327
1a5adedf 328clean: tidy
d9027fbd 329 -del *.exe
1a5adedf 330
331tidy:
d9027fbd 332 -del *.obj
333 -del *.res
334 -del *.pch
335 -del *.aps
336 -del *.ilk
337 -del *.pdb
338 -del *.rsp
339 -del *.dsp
340 -del *.dsw
341 -del *.ncb
342 -del *.opt
343 -del *.plg
344 -del *.map
345 -del *.idb
346 -del debug.log