71fd71dd8899fa0c2f853652bcd482048a818888
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 = -g -O2 -D_WINDOWS -DDEBUG\n".
74 "RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1 --define WINVER=0x0400\n".
75 "LIBS = -ladvapi32 -luser32 -lgdi32 -lwsock32 -lcomctl32 -lcomdlg32\n".
79 print $store{"objdefs"};
85 "\t\$(CC) \$(FWHACK) \$(CFLAGS) -c \$<\n".
88 "\t\$(RC) \$(FWHACK) \$(RCFLAGS) \$<\n".
90 foreach $p (@projects) {
91 print $p, ".exe: ", &project
($p), "\n";
92 print "\t\$(CC) \$(LDFLAGS) -o \$@ " . &project
($p), " \$(LIBS)\n\n";
94 print $store{"dependencies"};
98 "# Hack to force version.o to be rebuilt always\n".
100 "\t\$(CC) \$(FWHACK) \$(CFLAGS) \$(VER) -c version.c\n\n".
102 "\trm -f *.o *.exe *.res\n".
104 select STDOUT
; close OUT
;
106 ##-- Borland makefile
107 open OUT
, ">Makefile.bor"; select OUT
;
109 "# Makefile for PuTTY under Borland C.\n";
110 # bcc32 command line option is -D not /D
111 ($_ = $store{"help"}) =~ s/=\/D/=-D
/gs
;
115 "# If you rename this file to `Makefile', you should change this line,\n".
116 "# so that the .rsp files still depend on the correct makefile.\n".
117 "MAKEFILE = Makefile.bor\n".
119 "# Stop windows.h including winsock2.h which would conflict with winsock 1\n".
120 "CFLAGS = -DWIN32_LEAN_AND_MEAN\n".
122 "# Get include directory for resource compiler\n".
124 "BCB = \$(MAKEDIR)\\..\n".
128 "\tbcc32 \$(COMPAT) \$(FWHACK) \$(CFLAGS) /c \$*.c\n".
130 "\tbrc32 \$(FWHACK) -i \$(BCB)\\include \\\n".
131 "\t\t-r -DWIN32 -D_WIN32 -DWINVER=0x0400 \$*.rc\n".
136 print $store{"objdefs"};
139 print map { " $_.exe" } @projects;
141 foreach $p (@projects) {
142 print $p, ".exe: ", &project
($p), " $p.rsp\n";
143 $tw = $gui{$p} ?
" -tW" : "";
144 print "\tbcc32$tw -e$p.exe \@$p.rsp\n";
145 print "\tbrc32 -fe$p.exe " . (join " ", &project
("resources.$p")) . "\n\n";
147 foreach $p (@projects) {
148 print $p, ".rsp: \$(MAKEFILE)\n";
150 foreach $i (&projlist
("objects.$p")) {
151 print "\techo \$($i) $arrow $p.rsp\n";
156 print $store{"dependencies"};
159 "version.o: FORCE\n".
160 "# Hack to force version.o to be rebuilt always\n".
162 "\tbcc32 \$(FWHACK) \$(VER) \$(CFLAGS) /c version.c\n\n".
172 select STDOUT
; close OUT
;