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'}) {
35 foreach $i (split '\n',$store{'console-apps'}) {
42 my ($q) = $store{"$p"} . $store{"objects.$p"} . $store{"resources.$p"};
43 $q =~ s/(\S+)\s[^\n]*\n/\$($1) /gs;
50 my ($q) = $store{"$p"} . $store{"objects.$p"} . $store{"resources.$p"};
51 $q =~ s/(\S+)\s[^\n]*\n/$1 /gs;
52 my (@q) = split ' ',$q;
57 open OUT, ">Makefile.cyg"; select OUT;
59 "# Makefile for PuTTY under cygwin.\n";
60 # gcc command line option is -D not /D
61 ($_ = $store{"help"}) =~ s/=\/D/=-D/gs;
65 "# You can define this path to point at your tools if you need to\n".
66 "# TOOLPATH = c:\\cygwin\\bin\\ # or similar, if you're running Windows\n".
67 "# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/\n".
68 "CC = \$(TOOLPATH)gcc\n".
69 "RC = \$(TOOLPATH)windres\n".
70 "# You may also need to tell windres where to find include files:\n".
71 "# RCINC = --include-dir c:\\cygwin\\include\\\n".
73 "CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT -D_NO_OLDNAMES -I.\n".
74 "LDFLAGS = -mno-cygwin -s\n".
75 "RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400\n".
76 "LIBS = -ladvapi32 -luser32 -lgdi32 -lwsock32 -lcomctl32 -lcomdlg32\n".
80 print $store{"objdefs"};
86 "\t\$(CC) \$(FWHACK) \$(CFLAGS) -c \$<\n".
89 "\t\$(RC) \$(FWHACK) \$(RCFL) \$(RCFLAGS) \$< \$\@\n".
91 foreach $p (@projects) {
92 print $p, ".exe: ", &project($p), "\n";
93 my $mw = $gui{$p} ? " -mwindows" : "";
94 print "\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " . &project($p), " \$(LIBS)\n\n";
96 print $store{"dependencies"};
99 "version.o: FORCE;\n".
100 "# Hack to force version.o to be rebuilt always\n".
102 "\t\$(CC) \$(FWHACK) \$(CFLAGS) \$(VER) -c version.c\n\n".
104 "\trm -f *.o *.exe *.res\n".
106 select STDOUT; close OUT;
108 ##-- Borland makefile
109 open OUT, ">Makefile.bor"; select OUT;
111 "# Makefile for PuTTY under Borland C.\n";
112 # bcc32 command line option is -D not /D
113 ($_ = $store{"help"}) =~ s/=\/D/=-D/gs;
117 "# If you rename this file to `Makefile', you should change this line,\n".
118 "# so that the .rsp files still depend on the correct makefile.\n".
119 "MAKEFILE = Makefile.bor\n".
121 "# Stop windows.h including winsock2.h which would conflict with winsock 1\n".
122 "CFLAGS = -DWIN32_LEAN_AND_MEAN\n".
124 "# Get include directory for resource compiler\n".
126 "BCB = \$(MAKEDIR)\\..\n".
130 "\tbcc32 \$(COMPAT) \$(FWHACK) \$(CFLAGS) /c \$*.c\n".
132 "\tbrc32 \$(FWHACK) \$(RCFL) -i \$(BCB)\\include \\\n".
133 "\t\t-r -DWIN32 -D_WIN32 -DWINVER=0x0400 \$*.rc\n".
138 print $store{"objdefs"};
141 print map { " $_.exe" } @projects;
143 foreach $p (@projects) {
144 print $p, ".exe: ", &project($p), " $p.rsp\n";
145 $tw = $gui{$p} ? " -tW" : "";
146 print "\tbcc32$tw -e$p.exe \@$p.rsp\n";
147 print "\tbrc32 -fe$p.exe " . (join " ", &project("resources.$p")) . "\n\n";
149 foreach $p (@projects) {
150 print $p, ".rsp: \$(MAKEFILE)\n";
152 foreach $i (&projlist("objects.$p")) {
153 print "\techo \$($i) $arrow $p.rsp\n";
158 print $store{"dependencies"};
161 "version.o: FORCE\n".
162 "# Hack to force version.o to be rebuilt always\n".
164 "\tbcc32 \$(FWHACK) \$(VER) \$(CFLAGS) /c version.c\n\n".
174 select STDOUT; close OUT;