SSH port forwarding! How cool is that?
[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
dea851d6 53# CFLAGS = /nologo /W3 /YX /Yd /O1 /Gi /D_WINDOWS /DDEBUG /D_WIN32_WINDOWS=0x401
cdd6c586 54# LFLAGS = /debug
373e94e9 55
d9027fbd 56# Disable debug and incremental linking and compiling
01c034ad 57CFLAGS = /nologo /W3 /O1 /D_WINDOWS /D_WIN32_WINDOWS=0x401
cdd6c586 58LFLAGS = /incremental:no /fixed
373e94e9 59
d9027fbd 60# Use MSVC DLL
dea851d6 61# CFLAGS = /nologo /W3 /O1 /MD /D_WINDOWS /D_WIN32_WINDOWS=0x401
d9027fbd 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)
4eeb7d09 72GOBJS2 = sizetip.$(OBJ) wcwidth.$(OBJ) unicode.$(OBJ)
4017be6d 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)
d74d141c 92OBJS4 = x11fwd.$(OBJ) portforward.$(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
88485e4d 127LIBS3 = shell32.lib winmm.lib imm32.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
8a23a541 256be_all.$(OBJ): be_all.c network.h puttymem.h putty.h
257be_none.$(OBJ): be_none.c network.h puttymem.h putty.h
258be_nossh.$(OBJ): be_nossh.c network.h puttymem.h putty.h
259bntest.$(OBJ): bntest.c puttymem.h ssh.h
260int64.$(OBJ): int64.c
261ldisc.$(OBJ): ldisc.c network.h puttymem.h putty.h
262misc.$(OBJ): misc.c network.h puttymem.h putty.h
263mscrypto.$(OBJ): mscrypto.c puttymem.h ssh.h
264noise.$(OBJ): noise.c network.h puttymem.h storage.h ssh.h putty.h
265pageant.$(OBJ): pageant.c puttymem.h ssh.h tree234.h
266pageantc.$(OBJ): pageantc.c puttymem.h
267plink.$(OBJ): plink.c network.h puttymem.h storage.h putty.h tree234.h
268psftp.$(OBJ): psftp.c network.h puttymem.h int64.h sftp.h storage.h ssh.h putty.h
269puttygen.$(OBJ): puttygen.c network.h puttymem.h winstuff.h ssh.h putty.h
270raw.$(OBJ): raw.c network.h puttymem.h putty.h
271rlogin.$(OBJ): rlogin.c network.h puttymem.h putty.h
272scp.$(OBJ): scp.c network.h puttymem.h storage.h winstuff.h putty.h
273settings.$(OBJ): settings.c network.h puttymem.h storage.h putty.h
274sftp.$(OBJ): sftp.c sftp.h int64.h
275sizetip.$(OBJ): sizetip.c network.h puttymem.h winstuff.h putty.h
276ssh.$(OBJ): ssh.c network.h puttymem.h ssh.h putty.h tree234.h
277sshaes.$(OBJ): sshaes.c puttymem.h ssh.h
278sshblowf.$(OBJ): sshblowf.c puttymem.h ssh.h
279sshbn.$(OBJ): sshbn.c network.h puttymem.h ssh.h putty.h
280sshcrc.$(OBJ): sshcrc.c
281sshdes.$(OBJ): sshdes.c puttymem.h ssh.h
282sshdh.$(OBJ): sshdh.c puttymem.h ssh.h
283sshdss.$(OBJ): sshdss.c puttymem.h ssh.h
284sshmd5.$(OBJ): sshmd5.c puttymem.h ssh.h
285sshprime.$(OBJ): sshprime.c puttymem.h ssh.h
286sshpubk.$(OBJ): sshpubk.c puttymem.h ssh.h
287sshrand.$(OBJ): sshrand.c puttymem.h ssh.h
288sshrsa.$(OBJ): sshrsa.c puttymem.h ssh.h
289sshrsag.$(OBJ): sshrsag.c puttymem.h ssh.h
290sshsha.$(OBJ): sshsha.c puttymem.h ssh.h
291sshzlib.$(OBJ): sshzlib.c network.h puttymem.h ssh.h putty.h
292telnet.$(OBJ): telnet.c network.h puttymem.h putty.h
293terminal.$(OBJ): terminal.c network.h puttymem.h putty.h tree234.h
294tree234.$(OBJ): tree234.c tree234.h
295version.$(OBJ): version.c
296winctrls.$(OBJ): winctrls.c winstuff.h
297windlg.$(OBJ): windlg.c network.h puttymem.h storage.h winstuff.h putty.h ssh.h win_res.h
298window.$(OBJ): window.c network.h puttymem.h storage.h winstuff.h putty.h win_res.h
299winnet.$(OBJ): winnet.c network.h puttymem.h putty.h tree234.h
300winstore.$(OBJ): winstore.c network.h puttymem.h storage.h putty.h
d74d141c 301x11fwd.$(OBJ): x11fwd.c network.h puttymem.h ssh.h putty.h
302portforward.$(OBJ): portforward.c network.h puttymem.h ssh.h putty.h
8a23a541 303xlat.$(OBJ): xlat.c network.h puttymem.h putty.h
3d541627 304##--
067a15ea 305
306# Hack to force version.obj to be rebuilt always
d9027fbd 307version.obj: *.c *.h *.rc
067a15ea 308 cl $(FWHACK) $(VER) $(CFLAGS) /c version.c
374330e2 309
3d541627 310##-- dependencies
311win_res.$(RES): win_res.rc win_res.h putty.ico
312##--
313win_res.$(RES):
6ed3635b 314 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 win_res.rc
374330e2 315
3d541627 316##-- dependencies
317scp.$(RES): scp.rc scp.ico
318##--
319scp.$(RES):
6ed3635b 320 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 scp.rc
4585985c 321
5c58ad2d 322##-- dependencies
323pageant.$(RES): pageant.rc pageant.ico pageants.ico
324##--
325pageant.$(RES):
326 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 pageant.rc
327
6e522441 328##-- dependencies
329puttygen.$(RES): puttygen.rc puttygen.ico
330##--
331puttygen.$(RES):
332 rc $(FWHACK) $(RCFL) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 puttygen.rc
333
1a5adedf 334clean: tidy
d9027fbd 335 -del *.exe
1a5adedf 336
337tidy:
d9027fbd 338 -del *.obj
339 -del *.res
340 -del *.pch
341 -del *.aps
342 -del *.ilk
343 -del *.pdb
344 -del *.rsp
345 -del *.dsp
346 -del *.dsw
347 -del *.ncb
348 -del *.opt
349 -del *.plg
350 -del *.map
351 -del *.idb
352 -del debug.log