4 # Produces the other PuTTY makefiles from the master one.
11 @words = split /\s+/,$_;
12 shift @words; # remove ##--
13 $i = shift @words; # first word
14 if (!defined $i) { # no words
16 } elsif (!defined $words[0]) { # only one word
18 } else { # at least two words
19 @current = map { $i . "." . $_ } @words;
20 foreach $i (@words) { $projects{$i} = $i; }
21 push @current, "objdefs";
24 foreach $i (@current) { $store{$i} .= $_ . "\n"; }
28 @projects = keys %projects;
30 foreach $i (split '\n',$store{'gui-apps'}) {
32 $speciallibs = [split ' ', $i];
33 $i = shift @$speciallibs; # take off project name
35 $libs{$i} = $speciallibs;
38 foreach $i (split '\n',$store{'console-apps'}) {
40 $speciallibs = [split ' ', $i];
41 $i = shift @$speciallibs; # take off project name
43 $libs{$i} = $speciallibs;
48 my ($q) = $store{"$p"} . $store{"objects.$p"} . $store{"resources.$p"};
49 $q =~ s/(\S+)\s[^\n]*\n/\$($1) /gs;
56 my ($q) = $store{"$p"} . $store{"objects.$p"} . $store{"resources.$p"};
57 $q =~ s/(\S+)\s[^\n]*\n/$1 /gs;
58 my (@q) = split ' ',$q;
63 open OUT, ">Makefile.cyg"; select OUT;
65 "# Makefile for PuTTY under cygwin.\n";
66 # gcc command line option is -D not /D
67 ($_ = $store{"help"}) =~ s/=\/D/=-D/gs;
71 "# You can define this path to point at your tools if you need to\n".
72 "# TOOLPATH = c:\\cygwin\\bin\\ # or similar, if you're running Windows\n".
73 "# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/\n".
74 "CC = \$(TOOLPATH)gcc\n".
75 "RC = \$(TOOLPATH)windres\n".
76 "# You may also need to tell windres where to find include files:\n".
77 "# RCINC = --include-dir c:\\cygwin\\include\\\n".
79 "CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT -D_NO_OLDNAMES -I.\n".
80 "LDFLAGS = -mno-cygwin -s\n".
81 "RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400 --define MINGW32_FIX=1\n".
82 "LIBS = -ladvapi32 -luser32 -lgdi32 -lwsock32 -lcomctl32 -lcomdlg32\n".
86 print $store{"objdefs"};
92 "\t\$(CC) \$(FWHACK) \$(CFLAGS) -c \$<\n".
95 "\t\$(RC) \$(FWHACK) \$(RCFL) \$(RCFLAGS) \$< \$\@\n".
97 foreach $p (@projects) {
98 print $p, ".exe: ", &project($p), "\n";
99 my $mw = $gui{$p} ? " -mwindows" : "";
101 foreach $lib (@{$libs{$p}}) { $libstr .= " -l$lib"; }
102 print "\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " . &project($p), " \$(LIBS)$libstr\n\n";
104 print $store{"dependencies"};
107 "version.o: FORCE;\n".
108 "# Hack to force version.o to be rebuilt always\n".
110 "\t\$(CC) \$(FWHACK) \$(CFLAGS) \$(VER) -c version.c\n\n".
112 "\trm -f *.o *.exe *.res\n".
114 select STDOUT; close OUT;
116 ##-- Borland makefile
117 open OUT, ">Makefile.bor"; select OUT;
119 "# Makefile for PuTTY under Borland C++.\n";
120 # bcc32 command line option is -D not /D
121 ($_ = $store{"help"}) =~ s/=\/D/=-D/gs;
125 "# If you rename this file to `Makefile', you should change this line,\n".
126 "# so that the .rsp files still depend on the correct makefile.\n".
127 "MAKEFILE = Makefile.bor\n".
129 "# Get include directory for resource compiler\n".
131 "BCB = \$(MAKEDIR)\\..\n".
135 "\tbcc32 \$(COMPAT) \$(FWHACK) \$(CFLAGS) /c \$*.c\n".
137 "\tbrcc32 \$(FWHACK) \$(RCFL) -i \$(BCB)\\include \\\n".
138 "\t\t-r -DNO_WINRESRC_H -DWIN32 -D_WIN32 -DWINVER=0x0400 \$*.rc\n".
143 print $store{"objdefs"};
146 print map { " $_.exe" } @projects;
148 foreach $p (@projects) {
149 print $p, ".exe: ", &project($p), " $p.rsp\n";
150 $ap = $gui{$p} ? " -aa" : " -ap";
151 print "\tilink32$ap -Gn -L\$(BCB)\\lib \@$p.rsp\n\n";
153 foreach $p (@projects) {
154 print $p, ".rsp: \$(MAKEFILE)\n";
155 $c0w = $gui{$p} ? "c0w32" : "c0x32";
156 print "\techo $c0w + > $p.rsp\n";
157 @objlines = &projlist("objects.$p");
158 for ($i=0; $i<=$#objlines; $i++) {
159 $plus = ($i < $#objlines ? " +" : "");
160 print "\techo \$($objlines[$i])$plus >> $p.rsp\n";
162 print "\techo $p.exe >> $p.rsp\n";
163 @libs = @{$libs{$p}};
164 unshift @libs, "cw32", "import32";
165 $libstr = join ' ', @libs;
166 print "\techo nul,$libstr, >> $p.rsp\n";
167 print "\techo " . (join " ", &project("resources.$p")) . " >> $p.rsp\n";
170 print $store{"dependencies"};
173 "version.o: FORCE\n".
174 "# Hack to force version.o to be rebuilt always\n".
176 "\tbcc32 \$(FWHACK) \$(VER) \$(CFLAGS) /c version.c\n\n".
187 "\tdel *.\$\$\$\$\$\$\n";
188 select STDOUT; close OUT;