Add multi-makefile management system
[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#
21# - COMPAT=/DWIN32S_COMPAT
22# Generates a binary that works (minimally) with Win32s.
23#
24##--
676c0556 25
5f48a59c 26CFLAGS = /nologo /W3 /YX /O2 /Yd /D_WINDOWS /DDEBUG /ML /Fd
374330e2 27
28.c.obj:
676c0556 29 cl $(COMPAT) $(FWHACK) $(CFLAGS) /c $*.c
374330e2 30
3d541627 31OBJ=obj
32RES=res
33
34##-- objects putty
35POBJS1 = window.$(OBJ) windlg.$(OBJ) terminal.$(OBJ) telnet.$(OBJ) raw.$(OBJ)
36POBJS2 = xlat.$(OBJ) ldisc.$(OBJ) sizetip.$(OBJ) ssh.$(OBJ)
37##-- objects pscp
38SOBJS = scp.$(OBJ) windlg.$(OBJ) scpssh.$(OBJ)
39##-- objects putty pscp
40OBJS1 = misc.$(OBJ) noise.$(OBJ)
41OBJS2 = sshcrc.$(OBJ) sshdes.$(OBJ) sshmd5.$(OBJ) sshrsa.$(OBJ) sshrand.$(OBJ)
42OBJS3 = sshsha.$(OBJ) sshblowf.$(OBJ) version.$(OBJ)
43##-- resources putty
44PRESRC = win_res.$(RES)
45##-- resources pscp
46SRESRC = scp.$(RES)
47##--
48
49##-- gui-apps
50# putty
51##-- console-apps
52# pscp
53##--
54
374330e2 55LIBS1 = advapi32.lib user32.lib gdi32.lib
0cb88877 56LIBS2 = wsock32.lib comctl32.lib comdlg32.lib
4585985c 57
58all: putty.exe pscp.exe
374330e2 59
3d541627 60putty.exe: $(POBJS1) $(POBJS2) $(OBJS1) $(OBJS2) $(OBJS3) $(PRESRC) link.rsp
374330e2 61 link /debug -out:putty.exe @link.rsp
62
3d541627 63pscp.exe: $(SOBJS) $(OBJS1) $(OBJS2) $(OBJS3) $(SRESRC) scp.rsp
64 link /debug -out:pscp.exe @scp.rsp
374330e2 65
66link.rsp: makefile
67 echo /nologo /subsystem:windows > link.rsp
5bc238bb 68 echo $(POBJS1) >> link.rsp
69 echo $(POBJS2) >> link.rsp
374330e2 70 echo $(OBJS1) >> link.rsp
71 echo $(OBJS2) >> link.rsp
72 echo $(OBJS3) >> link.rsp
3d541627 73 echo $(PRESRC) >> link.rsp
374330e2 74 echo $(LIBS1) >> link.rsp
75 echo $(LIBS2) >> link.rsp
76
3d541627 77scp.rsp: makefile
78 echo /nologo /subsystem:console > scp.rsp
79 echo $(SOBJS) >> scp.rsp
80 echo $(OBJS1) >> scp.rsp
81 echo $(OBJS2) >> scp.rsp
82 echo $(OBJS3) >> scp.rsp
83 echo $(SRESRC) >> scp.rsp
84 echo $(LIBS1) >> scp.rsp
85 echo $(LIBS2) >> scp.rsp
86
87##-- dependencies
88window.$(OBJ): window.c putty.h win_res.h
89windlg.$(OBJ): windlg.c putty.h ssh.h win_res.h
90terminal.$(OBJ): terminal.c putty.h
91sizetip.$(OBJ): sizetip.c putty.h
92telnet.$(OBJ): telnet.c putty.h
93raw.$(OBJ): raw.c putty.h
94xlat.$(OBJ): xlat.c putty.h
95ldisc.$(OBJ): ldisc.c putty.h
96misc.$(OBJ): misc.c putty.h
97noise.$(OBJ): noise.c putty.h ssh.h
98ssh.$(OBJ): ssh.c ssh.h putty.h
99sshcrc.$(OBJ): sshcrc.c ssh.h
100sshdes.$(OBJ): sshdes.c ssh.h
101sshmd5.$(OBJ): sshmd5.c ssh.h
102sshrsa.$(OBJ): sshrsa.c ssh.h
103sshsha.$(OBJ): sshsha.c ssh.h
104sshrand.$(OBJ): sshrand.c ssh.h
105sshblowf.$(OBJ): sshblowf.c ssh.h
106scp.$(OBJ): scp.c putty.h scp.h
107scpssh.$(OBJ): scpssh.c putty.h ssh.h scp.h
108version.$(OBJ): version.c
109##--
067a15ea 110
111# Hack to force version.obj to be rebuilt always
3d541627 112version.obj: versionpseudotarget
113 @echo (built version.obj)
067a15ea 114versionpseudotarget:
115 cl $(FWHACK) $(VER) $(CFLAGS) /c version.c
374330e2 116
3d541627 117##-- dependencies
118win_res.$(RES): win_res.rc win_res.h putty.ico
119##--
120win_res.$(RES):
067a15ea 121 rc $(FWHACK) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 win_res.rc
374330e2 122
3d541627 123##-- dependencies
124scp.$(RES): scp.rc scp.ico
125##--
126scp.$(RES):
127 rc $(FWHACK) -r -DWIN32 -D_WIN32 -DWINVER=0x0400 scp.rc
4585985c 128
374330e2 129clean:
130 del *.obj
131 del *.exe
132 del *.res
133 del *.pch
134 del *.aps
135 del *.ilk
136 del *.pdb
067a15ea 137 del *.rsp