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