3 # Cross-platform Makefile generator.
5 # Reads the file `Recipe' to determine the list of generated
6 # executables and their component objects. Then reads the source
7 # files to compute #include dependencies. Finally, writes out the
8 # various target Makefiles.
10 # PuTTY specifics which could still do with removing:
11 # - Mac makefile is not portabilised at all. Include directories
12 # are hardwired, and also the libraries are fixed. This is
13 # mainly because I was too scared to go anywhere near it.
14 # - sbcsgen.pl is still run at startup.
16 # Other things undone:
17 # - special-define objects (foo.o[PREPROCSYMBOL]) are not
18 # supported in the mac or vcproj makefiles.
25 open $in, "Recipe" or do {
26 # We want to deal correctly with being run from one of the
27 # subdirs in the source tree. So if we can't find Recipe here,
30 open $in, "Recipe" or die "unable to open Recipe file\n";
34 # HACK: One of the source files in `charset' is auto-generated by
35 # sbcsgen.pl. We need to generate that _now_, before attempting
36 # dependency analysis.
37 eval 'chdir "charset"; require "sbcsgen.pl"; chdir ".."';
41 $divert = undef; # ref to scalar in which text is currently being put
42 $help = ""; # list of newline-free lines of help text
43 $project_name = "project"; # this is a good enough default
44 %makefiles = (); # maps makefile types to output makefile pathnames
45 %makefile_extra = (); # maps makefile types to extra Makefile text
46 %programs = (); # maps prog name + type letter to listref of objects/resources
47 %groups = (); # maps group name to listref of objects/resources
49 @allobjs = (); # all object file names
51 readinput: while (1) {
52 while (not defined ($_ = <$in>)) {
54 last readinput if 0 == scalar @filestack;
61 # Skip comments (unless the comments belong, for example because
62 # they're part of a diversion).
63 next if /^\s*#/ and !defined $divert;
65 if ($_[0] eq "!begin" and $_[1] eq "help") { $divert = \$help; next; }
66 if ($_[0] eq "!end") { $divert = undef; next; }
67 if ($_[0] eq "!name") { $project_name = $_[1]; next; }
68 if ($_[0] eq "!srcdir") { push @srcdirs, $_[1]; next; }
69 if ($_[0] eq "!makefile" and &mfval($_[1])) { $makefiles{$_[1]}=$_[2]; next;}
70 if ($_[0] eq "!specialobj" and &mfval($_[1])) { $specialobj{$_[1]}->{$_[2]} = 1; next;}
71 if ($_[0] eq "!begin") {
72 if ($_[1] =~ /^>(.*)/) {
73 $divert = \$auxfiles{$1};
74 } elsif (&mfval($_[1])) {
75 $divert = \$makefile_extra{$_[1]};
79 if ($_[0] eq "!include") {
81 for ($i = 1; $i <= $#_; $i++) {
82 push @newfiles, (sort glob $_[$i]);
84 for ($i = $#newfiles; $i >= 0; $i--) {
85 $file = $newfiles[$i];
87 open $f, "<$file" or die "unable to open include file '$file'\n";
90 $in = $filestack[$#filestack];
93 # If we're gathering help text, keep doing so.
94 if (defined $divert) { ${$divert} .= "$_\n"; next; }
96 next if scalar @_ == 0;
98 # Now we have an ordinary line. See if it's an = line, a : line
103 $listref = $lastlistref;
105 die "$.: unexpected + line\n" if !defined $lastlistref;
106 } elsif ($_[1] eq "=") {
108 $listref = $groups{$_[0]};
110 shift @objs; # eat the group name
111 } elsif ($_[1] eq "+=") {
112 $groups{$_[0]} = [] if !defined $groups{$_[0]};
113 $listref = $groups{$_[0]};
115 shift @objs; # eat the group name
116 } elsif ($_[1] eq ":") {
119 shift @objs; # eat the program name
121 die "$.: unrecognised line type: '$_'\n";
123 shift @objs; # eat the +, the = or the :
125 while (scalar @objs > 0) {
128 foreach $j (@{$groups{$i}}) { unshift @objs, $j; }
129 } elsif (($i eq "[G]" or $i eq "[C]" or $i eq "[M]" or
130 $i eq "[X]" or $i eq "[U]" or $i eq "[MX]") and defined $prog) {
131 $type = substr($i,1,(length $i)-2);
134 # Object files with a trailing question mark are optional:
135 # the build can proceed fine without them, so we only use
136 # them if their primary source files are present.
138 $i = undef unless defined &finddep($i);
139 } elsif ($i =~ /\|/) {
140 # Object file descriptions containing a vertical bar are
141 # lists of choices: we use the _first_ one whose primary
142 # source file is present.
143 @options = split /\|/, $i;
145 foreach $k (@options) {
146 $j=$k, last if defined &finddep($k);
148 die "no alternative found for $i\n" unless defined $j;
157 if ($prog and $type) {
158 die "multiple program entries for $prog [$type]\n"
159 if defined $programs{$prog . "," . $type};
160 $programs{$prog . "," . $type} = $listref;
162 $lastlistref = $listref;
165 foreach $aux (sort keys %auxfiles) {
167 print AUX $auxfiles{$aux};
171 # Find object file names with predefines (in square brackets after
172 # the module name), and decide on actual object names for them.
173 foreach $i (@allobjs) {
177 $usedobjname{$i} = 1;
180 foreach $i (@allobjs) {
181 if ($i =~ /^(.*)\[([^\]]*)/) {
182 $defs{$i} = [ split ",",$2 ];
183 $srcname{$i} = $s = $1;
187 $maxlen = 8 if $maxlen < 8;
188 $chop = $maxlen - length $index;
189 $chop = length $s if $chop > length $s;
190 $chop = 0 if $chop < 0;
191 $name = substr($s, 0, $chop) . $index;
192 $index++, next if $usedobjname{$name};
193 $objname{$i} = $name;
194 $usedobjname{$name} = 1;
200 # Now retrieve the complete list of objects and resource files, and
201 # construct dependency data for them. While we're here, expand the
202 # object list for each program, and complain if its type isn't set.
203 @prognames = sort keys %programs;
206 foreach $i (@prognames) {
207 ($prog, $type) = split ",", $i;
208 # Strip duplicate object names.
210 @list = grep { $status = ($prev ne $_); $prev=$_; $status }
211 sort @{$programs{$i}};
212 $programs{$i} = [@list];
213 foreach $jj (@list) {
215 $file = &finddep($j);
217 $depends{$jj} = [$file];
218 push @scanlist, $file;
223 # Scan each file on @scanlist and find further inclusions.
224 # Inclusions are given by lines of the form `#include "otherfile"'
225 # (system headers are automatically ignored by this because they'll
226 # be given in angle brackets). Files included by this method are
227 # added back on to @scanlist to be scanned in turn (if not already
230 # Resource scripts (.rc) can also include a file by means of a line
231 # ending `ICON "filename"'. Files included by this method are not
232 # added to @scanlist because they can never include further files.
234 # In this pass we write out a hash %further which maps a source
235 # file name into a listref containing further source file names.
238 while (scalar @scanlist > 0) {
239 $file = shift @scanlist;
240 next if defined $further{$file}; # skip if we've already done it
241 $resource = ($file =~ /\.rc$/ ? 1 : 0);
242 $further{$file} = [];
243 $dirfile = &findfile($file);
244 open IN, "$dirfile" or die "unable to open source file $file\n";
247 /^\s*#include\s+\"([^\"]+)\"/ and do {
248 push @{$further{$file}}, $1;
252 /ICON\s+\"([^\"]+)\"\s*$/ and do {
253 push @{$further{$file}}, $1;
260 # Now we're ready to generate the final dependencies section. For
261 # each key in %depends, we must expand the dependencies list by
262 # iteratively adding entries from %further.
263 foreach $i (keys %depends) {
265 @scanlist = @{$depends{$i}};
266 foreach $i (@scanlist) { $dep{$i} = 1; }
267 while (scalar @scanlist > 0) {
268 $file = shift @scanlist;
269 foreach $j (@{$further{$file}}) {
272 push @{$depends{$i}}, $j;
277 # printf "%s: %s\n", $i, join ' ',@{$depends{$i}};
280 # Validation of input.
284 # Returns true if the argument is a known makefile type. Otherwise,
285 # prints a warning and returns false;
286 if (grep { $type eq $_ }
287 ("vc","vcproj","cygwin","borland","lcc","gtk","mpw","osx")) {
290 warn "$.:unknown makefile type '$type'\n";
294 # Utility routines while writing out the Makefiles.
297 my ($path) = shift @_;
298 my ($sep) = shift @_;
300 while (($i = index $path, $sep) >= 0) {
301 $path = substr $path, ($i + length $sep);
312 unless (defined $findfilecache{$name}) {
314 foreach $dir (@srcdirs) {
315 $outdir = $dir, $i++ if -f "$dir$name";
317 die "multiple instances of source file $name\n" if $i > 1;
318 $findfilecache{$name} = (defined $outdir ? $outdir . $name : undef);
320 return $findfilecache{$name};
326 # Find the first dependency of an object.
328 # Dependencies for "x" start with "x.c" or "x.m" (depending on
330 # Dependencies for "x.res" start with "x.rc".
331 # Dependencies for "x.rsrc" start with "x.r".
332 # Both types of file are pushed on the list of files to scan.
333 # Libraries (.lib) don't have dependencies at all.
334 if ($j =~ /^(.*)\.res$/) {
336 } elsif ($j =~ /^(.*)\.rsrc$/) {
338 } elsif ($j !~ /\./) {
340 $file = "$j.m" unless &findfile($file);
342 # For everything else, we assume it's its own dependency.
345 $file = undef unless &findfile($file);
350 my ($prog, $otmpl, $rtmpl, $ltmpl, $prefix, $dirsep) = @_;
354 foreach $ii (@{$programs{$prog}}) {
357 if ($i =~ /^(.*)\.(res|rsrc)/) {
359 ($x = $rtmpl) =~ s/X/$y/;
360 } elsif ($i =~ /^(.*)\.lib/) {
362 ($x = $ltmpl) =~ s/X/$y/;
363 } elsif ($i !~ /\./) {
364 ($x = $otmpl) =~ s/X/$i/;
366 push @ret, $x if $x ne "";
368 return join " ", @ret;
372 my ($prog, $suffix) = @_;
376 foreach $ii (@{$programs{$prog}}) {
378 if (substr($i, (length $i) - (length $suffix)) eq $suffix) {
382 return join " ", @ret;
386 my ($line, $width, $splitchar) = @_;
388 $len = (defined $width ? $width : 76);
389 $splitchar = (defined $splitchar ? $splitchar : '\\');
390 while (length $line > $len) {
391 $line =~ /^(.{0,$len})\s(.*)$/ or $line =~ /^(.{$len,}?\s(.*)$/;
393 $result .= " ${splitchar}\n\t\t" if $2 ne '';
397 return $result . $line;
401 my ($otmpl, $rtmpl, $prefix, $dirsep, $depchar, $splitchar) = @_;
406 foreach $ii (sort keys %depends) {
408 next if $specialobj{$mftyp}->{$i};
409 if ($i =~ /^(.*)\.(res|rsrc)/) {
410 next if !defined $rtmpl;
412 ($x = $rtmpl) =~ s/X/$y/;
414 ($x = $otmpl) =~ s/X/$i/;
416 @deps = @{$depends{$ii}};
417 # Skip things which are their own dependency.
418 next if grep { $_ eq $i } @deps;
424 push @ret, {obj => $x, deps => [@deps], defs => $defs{$ii}};
431 my ($n, $prog, $type);
434 foreach $n (@prognames) {
435 ($prog, $type) = split ",", $n;
436 push @ret, $n if index(":$types:", ":$type:") >= 0;
443 my ($n, $prog, $type);
446 foreach $n (@prognames) {
447 ($prog, $type) = split ",", $n;
448 push @ret, $prog if index(":$types:", ":$type:") >= 0;
454 my ($types,$suffix) = @_;
456 # assume that all UNIX programs have a man page
457 if($suffix eq "1" && $types =~ /:X:/) {
458 return map("$_.1", &progrealnames($types));
463 # Now we're ready to output the actual Makefiles.
465 if (defined $makefiles{'cygwin'}) {
467 $dirpfx = &dirpfx($makefiles{'cygwin'}, "/");
470 open OUT, ">$makefiles{'cygwin'}"; select OUT;
472 "# Makefile for $project_name under cygwin.\n".
473 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
474 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
475 # gcc command line option is -D not /D
476 ($_ = $help) =~ s/=\/D/=-D/gs;
480 "# You can define this path to point at your tools if you need to\n".
481 "# TOOLPATH = c:\\cygwin\\bin\\ # or similar, if you're running Windows\n".
482 "# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/\n".
483 "CC = \$(TOOLPATH)gcc\n".
484 "RC = \$(TOOLPATH)windres\n".
485 "# Uncomment the following two lines to compile under Winelib\n".
488 "# You may also need to tell windres where to find include files:\n".
489 "# RCINC = --include-dir c:\\cygwin\\include\\\n".
491 &splitline("CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT".
492 " -D_NO_OLDNAMES -DNO_MULTIMON -DNO_HTMLHELP " .
493 (join " ", map {"-I$dirpfx$_"} @srcdirs)) .
495 "LDFLAGS = -mno-cygwin -s\n".
496 &splitline("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1".
497 " --define WINVER=0x0400 --define MINGW32_FIX=1 " .
498 (join " ", map {"--include $dirpfx$_"} @srcdirs) )."\n".
500 print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
502 foreach $p (&prognames("G:C")) {
503 ($prog, $type) = split ",", $p;
504 $objstr = &objects($p, "X.o", "X.res.o", undef);
505 print &splitline($prog . ".exe: " . $objstr), "\n";
506 my $mw = $type eq "G" ? " -mwindows" : "";
507 $libstr = &objects($p, undef, undef, "-lX");
508 print &splitline("\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " .
509 "-Wl,-Map,$prog.map " .
510 $objstr . " $libstr", 69), "\n\n";
512 foreach $d (&deps("X.o", "X.res.o", $dirpfx, "/")) {
513 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
515 if ($d->{obj} =~ /\.res\.o$/) {
516 print "\t\$(RC) \$(FWHACK) \$(RCFL) \$(RCFLAGS) \$< \$\@\n";
518 $deflist = join "", map { " -D$_" } @{$d->{defs}};
519 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS)" .
520 " \$(XFLAGS)$deflist -c \$< -o \$\@\n";
524 print $makefile_extra{'cygwin'};
526 "\trm -f *.o *.exe *.res.o *.map\n".
528 select STDOUT; close OUT;
532 ##-- Borland makefile
533 if (defined $makefiles{'borland'}) {
535 $dirpfx = &dirpfx($makefiles{'borland'}, "\\");
537 %stdlibs = ( # Borland provides many Win32 API libraries intrinsically
549 open OUT, ">$makefiles{'borland'}"; select OUT;
551 "# Makefile for $project_name under Borland C.\n".
552 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
553 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
554 # bcc32 command line option is -D not /D
555 ($_ = $help) =~ s/=\/D/=-D/gs;
559 "# If you rename this file to `Makefile', you should change this line,\n".
560 "# so that the .rsp files still depend on the correct makefile.\n".
561 "MAKEFILE = Makefile.bor\n".
563 "# C compilation flags\n".
564 "CFLAGS = -D_WINDOWS -DWINVER=0x0401\n".
566 "# Get include directory for resource compiler\n".
568 "BCB = \$(MAKEDIR)\\..\n".
571 print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
573 foreach $p (&prognames("G:C")) {
574 ($prog, $type) = split ",", $p;
575 $objstr = &objects($p, "X.obj", "X.res", undef);
576 print &splitline("$prog.exe: " . $objstr . " $prog.rsp"), "\n";
577 my $ap = ($type eq "G") ? "-aa" : "-ap";
578 print "\tilink32 $ap -Gn -L\$(BCB)\\lib \@$prog.rsp\n\n";
580 foreach $p (&prognames("G:C")) {
581 ($prog, $type) = split ",", $p;
582 print $prog, ".rsp: \$(MAKEFILE)\n";
583 $objstr = &objects($p, "X.obj", undef, undef);
584 @objlist = split " ", $objstr;
586 foreach $i (@objlist) {
587 if (length($objlines[$#objlines] . " $i") > 50) {
590 $objlines[$#objlines] .= " $i";
592 $c0w = ($type eq "G") ? "c0w32" : "c0x32";
593 print "\techo $c0w + > $prog.rsp\n";
594 for ($i=0; $i<=$#objlines; $i++) {
595 $plus = ($i < $#objlines ? " +" : "");
596 print "\techo$objlines[$i]$plus >> $prog.rsp\n";
598 print "\techo $prog.exe >> $prog.rsp\n";
599 $objstr = &objects($p, "X.obj", "X.res", undef);
600 @libs = split " ", &objects($p, undef, undef, "X");
601 @libs = grep { !$stdlibs{$_} } @libs;
602 unshift @libs, "cw32", "import32";
603 $libstr = join ' ', @libs;
604 print "\techo nul,$libstr, >> $prog.rsp\n";
605 print "\techo " . &objects($p, undef, "X.res", undef) . " >> $prog.rsp\n";
608 foreach $d (&deps("X.obj", "X.res", $dirpfx, "\\")) {
609 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
611 if ($d->{obj} =~ /\.res$/) {
612 print &splitline("\tbrcc32 \$(FWHACK) \$(RCFL) " .
613 "-i \$(BCB)\\include -r -DNO_WINRESRC_H -DWIN32".
614 " -D_WIN32 -DWINVER=0x0401 \$*.rc",69)."\n";
616 $deflist = join "", map { " -D$_" } @{$d->{defs}};
617 print &splitline("\tbcc32 -w-aus -w-ccc -w-par -w-pia \$(COMPAT)" .
618 " \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist ".
619 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
620 " /o$d->{obj} /c ".$d->{deps}->[0],69)."\n";
624 print $makefile_extra{'borland'};
635 "\t-del *.\$\$\$\$\$\$\n";
636 select STDOUT; close OUT;
639 if (defined $makefiles{'vc'}) {
641 $dirpfx = &dirpfx($makefiles{'vc'}, "\\");
643 ##-- Visual C++ makefile
644 open OUT, ">$makefiles{'vc'}"; select OUT;
646 "# Makefile for $project_name under Visual C.\n".
647 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
648 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
652 "# If you rename this file to `Makefile', you should change this line,\n".
653 "# so that the .rsp files still depend on the correct makefile.\n".
654 "MAKEFILE = Makefile.vc\n".
656 "# C compilation flags\n".
657 "CFLAGS = /nologo /W3 /O1 /D_WINDOWS /D_WIN32_WINDOWS=0x401 /DWINVER=0x401\n".
658 "LFLAGS = /incremental:no /fixed\n".
660 print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
662 foreach $p (&prognames("G:C")) {
663 ($prog, $type) = split ",", $p;
664 $objstr = &objects($p, "X.obj", "X.res", undef);
665 print &splitline("$prog.exe: " . $objstr . " $prog.rsp"), "\n";
666 print "\tlink \$(LFLAGS) -out:$prog.exe -map:$prog.map \@$prog.rsp\n\n";
668 foreach $p (&prognames("G:C")) {
669 ($prog, $type) = split ",", $p;
670 print $prog, ".rsp: \$(MAKEFILE)\n";
671 $objstr = &objects($p, "X.obj", "X.res", "X.lib");
672 @objlist = split " ", $objstr;
674 foreach $i (@objlist) {
675 if (length($objlines[$#objlines] . " $i") > 50) {
678 $objlines[$#objlines] .= " $i";
680 $subsys = ($type eq "G") ? "windows" : "console";
681 print "\techo /nologo /subsystem:$subsys > $prog.rsp\n";
682 for ($i=0; $i<=$#objlines; $i++) {
683 print "\techo$objlines[$i] >> $prog.rsp\n";
687 foreach $d (&deps("X.obj", "X.res", $dirpfx, "\\")) {
688 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
690 if ($d->{obj} =~ /\.res$/) {
691 print "\trc \$(FWHACK) \$(RCFL) -r -DWIN32 -D_WIN32 ".
692 "-DWINVER=0x0400 -fo".$d->{obj}." ".$d->{deps}->[0]."\n";
694 $deflist = join "", map { " /D$_" } @{$d->{defs}};
695 print "\tcl \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist".
696 " /c ".$d->{deps}->[0]." /Fo$d->{obj}\n";
700 print $makefile_extra{'vc'};
701 print "\nclean: tidy\n".
718 "\t-del debug.log\n";
719 select STDOUT; close OUT;
722 if (defined $makefiles{'vcproj'}) {
727 ##-- MSVC 6 Workspace and projects
729 # Note: All files created in this section are written in binary
730 # mode, because although MSVC's command-line make can deal with
731 # LF-only line endings, MSVC project files really _need_ to be
732 # CRLF. Hence, in order for mkfiles.pl to generate usable project
733 # files even when run from Unix, I make sure all files are binary
734 # and explicitly write the CRLFs.
736 # Create directories if necessary
737 mkdir $makefiles{'vcproj'}
738 if(! -d $makefiles{'vcproj'});
739 chdir $makefiles{'vcproj'};
740 @deps = &deps("X.obj", "X.res", "", "\\");
741 %all_object_deps = map {$_->{obj} => $_->{deps}} @deps;
742 # Create the project files
743 # Get names of all Windows projects (GUI and console)
744 my @prognames = &prognames("G:C");
745 foreach $progname (@prognames) {
746 create_project(\%all_object_deps, $progname);
748 # Create the workspace file
749 open OUT, ">$project_name.dsw"; binmode OUT; select OUT;
751 "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n".
752 "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n".
754 "###############################################################################\r\n".
757 foreach $progname (@prognames) {
758 ($windows_project, $type) = split ",", $progname;
759 print "Project: \"$windows_project\"=\".\\$windows_project\\$windows_project.dsp\" - Package Owner=<4>\r\n";
771 "###############################################################################\r\n".
783 "###############################################################################\r\n".
785 select STDOUT; close OUT;
789 my ($all_object_deps, $progname) = @_;
790 # Construct program's dependency info
795 %resource_files = ();
796 @object_files = split " ", &objects($progname, "X.obj", "X.res", "X.lib");
797 foreach $object_file (@object_files) {
798 next if defined $seen_objects{$object_file};
799 $seen_objects{$object_file} = 1;
800 if($object_file =~ /\.lib$/io) {
801 $lib_files{$object_file} = 1;
804 $object_deps = $all_object_deps{$object_file};
805 foreach $object_dep (@$object_deps) {
806 if($object_dep =~ /\.c$/io) {
807 $source_files{$object_dep} = 1;
810 if($object_dep =~ /\.h$/io) {
811 $header_files{$object_dep} = 1;
814 if($object_dep =~ /\.(rc|ico)$/io) {
815 $resource_files{$object_dep} = 1;
820 $libs = join " ", sort keys %lib_files;
821 @source_files = sort keys %source_files;
822 @header_files = sort keys %header_files;
823 @resources = sort keys %resource_files;
824 ($windows_project, $type) = split ",", $progname;
825 mkdir $windows_project
826 if(! -d $windows_project);
827 chdir $windows_project;
828 $subsys = ($type eq "G") ? "windows" : "console";
829 open OUT, ">$windows_project.dsp"; binmode OUT; select OUT;
831 "# Microsoft Developer Studio Project File - Name=\"$windows_project\" - Package Owner=<4>\r\n".
832 "# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n".
833 "# ** DO NOT EDIT **\r\n".
835 "# TARGTYPE \"Win32 (x86) Application\" 0x0101\r\n".
837 "CFG=$windows_project - Win32 Debug\r\n".
838 "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n".
839 "!MESSAGE use the Export Makefile command and run\r\n".
841 "!MESSAGE NMAKE /f \"$windows_project.mak\".\r\n".
843 "!MESSAGE You can specify a configuration when running NMAKE\r\n".
844 "!MESSAGE by defining the macro CFG on the command line. For example:\r\n".
846 "!MESSAGE NMAKE /f \"$windows_project.mak\" CFG=\"$windows_project - Win32 Debug\"\r\n".
848 "!MESSAGE Possible choices for configuration are:\r\n".
850 "!MESSAGE \"$windows_project - Win32 Release\" (based on \"Win32 (x86) Application\")\r\n".
851 "!MESSAGE \"$windows_project - Win32 Debug\" (based on \"Win32 (x86) Application\")\r\n".
854 "# Begin Project\r\n".
855 "# PROP AllowPerConfigDependencies 0\r\n".
856 "# PROP Scc_ProjName \"\"\r\n".
857 "# PROP Scc_LocalPath \"\"\r\n".
862 "!IF \"\$(CFG)\" == \"$windows_project - Win32 Release\"\r\n".
864 "# PROP BASE Use_MFC 0\r\n".
865 "# PROP BASE Use_Debug_Libraries 0\r\n".
866 "# PROP BASE Output_Dir \"Release\"\r\n".
867 "# PROP BASE Intermediate_Dir \"Release\"\r\n".
868 "# PROP BASE Target_Dir \"\"\r\n".
869 "# PROP Use_MFC 0\r\n".
870 "# PROP Use_Debug_Libraries 0\r\n".
871 "# PROP Output_Dir \"Release\"\r\n".
872 "# PROP Intermediate_Dir \"Release\"\r\n".
873 "# PROP Ignore_Export_Lib 0\r\n".
874 "# PROP Target_Dir \"\"\r\n".
875 "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /c\r\n".
876 "# ADD CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /c\r\n".
877 "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n".
878 "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n".
879 "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\r\n".
880 "# ADD RSC /l 0x809 /d \"NDEBUG\"\r\n".
881 "BSC32=bscmake.exe\r\n".
882 "# ADD BASE BSC32 /nologo\r\n".
883 "# ADD BSC32 /nologo\r\n".
884 "LINK32=link.exe\r\n".
885 "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:$subsys /machine:I386\r\n".
886 "# ADD LINK32 $libs /nologo /subsystem:$subsys /machine:I386\r\n".
887 "# SUBTRACT LINK32 /pdb:none\r\n".
889 "!ELSEIF \"\$(CFG)\" == \"$windows_project - Win32 Debug\"\r\n".
891 "# PROP BASE Use_MFC 0\r\n".
892 "# PROP BASE Use_Debug_Libraries 1\r\n".
893 "# PROP BASE Output_Dir \"Debug\"\r\n".
894 "# PROP BASE Intermediate_Dir \"Debug\"\r\n".
895 "# PROP BASE Target_Dir \"\"\r\n".
896 "# PROP Use_MFC 0\r\n".
897 "# PROP Use_Debug_Libraries 1\r\n".
898 "# PROP Output_Dir \"Debug\"\r\n".
899 "# PROP Intermediate_Dir \"Debug\"\r\n".
900 "# PROP Ignore_Export_Lib 0\r\n".
901 "# PROP Target_Dir \"\"\r\n".
902 "# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /GZ /c\r\n".
903 "# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /GZ /c\r\n".
904 "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n".
905 "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n".
906 "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\r\n".
907 "# ADD RSC /l 0x809 /d \"_DEBUG\"\r\n".
908 "BSC32=bscmake.exe\r\n".
909 "# ADD BASE BSC32 /nologo\r\n".
910 "# ADD BSC32 /nologo\r\n".
911 "LINK32=link.exe\r\n".
912 "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:$subsys /debug /machine:I386 /pdbtype:sept\r\n".
913 "# ADD LINK32 $libs /nologo /subsystem:$subsys /debug /machine:I386 /pdbtype:sept\r\n".
914 "# SUBTRACT LINK32 /pdb:none\r\n".
918 "# Begin Target\r\n".
920 "# Name \"$windows_project - Win32 Release\"\r\n".
921 "# Name \"$windows_project - Win32 Debug\"\r\n".
922 "# Begin Group \"Source Files\"\r\n".
924 "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n";
925 foreach $source_file (@source_files) {
927 "# Begin Source File\r\n".
929 "SOURCE=..\\..\\$source_file\r\n";
930 if($source_file =~ /ssh\.c/io) {
931 # Disable 'Edit and continue' as Visual Studio can't handle the macros
934 "!IF \"\$(CFG)\" == \"$windows_project - Win32 Release\"\r\n".
936 "!ELSEIF \"\$(CFG)\" == \"$windows_project - Win32 Debug\"\r\n".
943 print "# End Source File\r\n";
947 "# Begin Group \"Header Files\"\r\n".
949 "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n";
950 foreach $header_file (@header_files) {
952 "# Begin Source File\r\n".
954 "SOURCE=..\\..\\$header_file\r\n".
955 "# End Source File\r\n";
959 "# Begin Group \"Resource Files\"\r\n".
961 "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n";
962 foreach $resource_file (@resources) {
964 "# Begin Source File\r\n".
966 "SOURCE=..\\..\\$resource_file\r\n".
967 "# End Source File\r\n";
973 select STDOUT; close OUT;
978 if (defined $makefiles{'gtk'}) {
980 $dirpfx = &dirpfx($makefiles{'gtk'}, "/");
982 ##-- X/GTK/Unix makefile
983 open OUT, ">$makefiles{'gtk'}"; select OUT;
985 "# Makefile for $project_name under X/GTK and Unix.\n".
986 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
987 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
988 # gcc command line option is -D not /D
989 ($_ = $help) =~ s/=\/D/=-D/gs;
993 "# You can define this path to point at your tools if you need to\n".
994 "# TOOLPATH = /opt/gcc/bin\n".
995 "CC = \$(TOOLPATH)cc\n".
996 "# You can manually set this to `gtk-config' or `pkg-config gtk+-1.2'\n".
997 "# (depending on what works on your system) if you want to enforce\n".
998 "# building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0'\n".
999 "# if you want to enforce 2.0. The default is to try 2.0 and fall back\n".
1000 "# to 1.2 if it isn't found.\n".
1001 "GTK_CONFIG = sh -c 'pkg-config gtk+-2.0 \$\$0 2>/dev/null || gtk-config \$\$0'\n".
1003 &splitline("CFLAGS = -O2 -Wall -Werror -g " .
1004 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
1005 " `\$(GTK_CONFIG) --cflags`")."\n".
1006 "XLDFLAGS = `\$(GTK_CONFIG) --libs`\n".
1008 "INSTALL=install\n",
1009 "INSTALL_PROGRAM=\$(INSTALL)\n",
1010 "INSTALL_DATA=\$(INSTALL)\n",
1011 "prefix=/usr/local\n",
1012 "exec_prefix=\$(prefix)\n",
1013 "bindir=\$(exec_prefix)/bin\n",
1014 "gamesdir=\$(exec_prefix)/games\n",
1015 "mandir=\$(prefix)/man\n",
1016 "man1dir=\$(mandir)/man1\n",
1018 print &splitline("all:" . join "", map { " $_" } &progrealnames("X:U"));
1020 foreach $p (&prognames("X:U")) {
1021 ($prog, $type) = split ",", $p;
1022 $objstr = &objects($p, "X.o", undef, undef);
1023 print &splitline($prog . ": " . $objstr), "\n";
1024 $libstr = &objects($p, undef, undef, "-lX");
1025 print &splitline("\t\$(CC)" . $mw . " \$(${type}LDFLAGS) -o \$@ " .
1026 $objstr . " $libstr", 69), "\n\n";
1028 foreach $d (&deps("X.o", undef, $dirpfx, "/")) {
1029 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
1031 $deflist = join "", map { " -D$_" } @{$d->{defs}};
1032 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
1033 " -c \$< -o \$\@\n";
1036 print $makefile_extra{'gtk'};
1038 "\trm -f *.o". (join "", map { " $_" } &progrealnames("X:U")) . "\n";
1039 select STDOUT; close OUT;
1042 if (defined $makefiles{'mpw'}) {
1045 open OUT, ">$makefiles{'mpw'}"; select OUT;
1047 "# Makefile for $project_name under MPW.\n#\n".
1048 "# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1049 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1050 # MPW command line option is -d not /D
1051 ($_ = $help) =~ s/=\/D/=-d /gs;
1054 "ROptions = `Echo \"{VER}\" | StreamEdit -e \"1,\$ replace /=(\xc5)\xa81\xb0/ 'STR=\xb6\xb6\xb6\xb6\xb6\"' \xa81 '\xb6\xb6\xb6\xb6\xb6\"'\"`".
1059 "C_Carbon = {PPCC}\n".
1061 "# -w 35 disables \"unused parameter\" warnings\n".
1062 "COptions = -i : -i :: -i ::charset -w 35 -w err -proto strict -ansi on \xb6\n".
1064 "COptions_68K = {COptions} -model far -opt time\n".
1065 "# Enabling \"-opt space\" for CFM-68K gives me undefined references to\n".
1066 "# _\$LDIVT and _\$LMODT.\n".
1067 "COptions_CFM68K = {COptions} -model cfmSeg -opt time\n".
1068 "COptions_PPC = {COptions} -opt size -traceback\n".
1069 "COptions_Carbon = {COptions} -opt size -traceback -d TARGET_API_MAC_CARBON\n".
1071 "Link_68K = ILink\n".
1072 "Link_CFM68K = ILink\n".
1073 "Link_PPC = PPCLink\n".
1074 "Link_Carbon = PPCLink\n".
1076 "LinkOptions = -c 'pTTY'\n".
1077 "LinkOptions_68K = {LinkOptions} -br 68k -model far -compact\n".
1078 "LinkOptions_CFM68K = {LinkOptions} -br 020 -model cfmseg -compact\n".
1079 "LinkOptions_PPC = {LinkOptions}\n".
1080 "LinkOptions_Carbon = -m __appstart -w {LinkOptions}\n".
1082 "Libs_68K = \"{CLibraries}StdCLib.far.o\" \xb6\n".
1083 " \"{Libraries}MacRuntime.o\" \xb6\n".
1084 " \"{Libraries}MathLib.far.o\" \xb6\n".
1085 " \"{Libraries}IntEnv.far.o\" \xb6\n".
1086 " \"{Libraries}Interface.o\" \xb6\n".
1087 " \"{Libraries}Navigation.far.o\" \xb6\n".
1088 " \"{Libraries}OpenTransport.o\" \xb6\n".
1089 " \"{Libraries}OpenTransportApp.o\" \xb6\n".
1090 " \"{Libraries}OpenTptInet.o\" \xb6\n".
1091 " \"{Libraries}UnicodeConverterLib.far.o\"\n".
1093 "Libs_CFM = \"{SharedLibraries}InterfaceLib\" \xb6\n".
1094 " \"{SharedLibraries}StdCLib\" \xb6\n".
1095 " \"{SharedLibraries}AppearanceLib\" \xb6\n".
1096 " -weaklib AppearanceLib \xb6\n".
1097 " \"{SharedLibraries}NavigationLib\" \xb6\n".
1098 " -weaklib NavigationLib \xb6\n".
1099 " \"{SharedLibraries}TextCommon\" \xb6\n".
1100 " -weaklib TextCommon \xb6\n".
1101 " \"{SharedLibraries}UnicodeConverter\" \xb6\n".
1102 " -weaklib UnicodeConverter\n".
1104 "Libs_CFM68K = {Libs_CFM} \xb6\n".
1105 " \"{CFM68KLibraries}NuMacRuntime.o\"\n".
1107 "Libs_PPC = {Libs_CFM} \xb6\n".
1108 " \"{SharedLibraries}ControlsLib\" \xb6\n".
1109 " -weaklib ControlsLib \xb6\n".
1110 " \"{SharedLibraries}WindowsLib\" \xb6\n".
1111 " -weaklib WindowsLib \xb6\n".
1112 " \"{SharedLibraries}OpenTransportLib\" \xb6\n".
1113 " -weaklib OTClientLib \xb6\n".
1114 " -weaklib OTClientUtilLib \xb6\n".
1115 " \"{SharedLibraries}OpenTptInternetLib\" \xb6\n".
1116 " -weaklib OTInetClientLib \xb6\n".
1117 " \"{PPCLibraries}StdCRuntime.o\" \xb6\n".
1118 " \"{PPCLibraries}PPCCRuntime.o\" \xb6\n".
1119 " \"{PPCLibraries}CarbonAccessors.o\" \xb6\n".
1120 " \"{PPCLibraries}OpenTransportAppPPC.o\" \xb6\n".
1121 " \"{PPCLibraries}OpenTptInetPPC.o\"\n".
1123 "Libs_Carbon = \"{PPCLibraries}CarbonStdCLib.o\" \xb6\n".
1124 " \"{PPCLibraries}StdCRuntime.o\" \xb6\n".
1125 " \"{PPCLibraries}PPCCRuntime.o\" \xb6\n".
1126 " \"{SharedLibraries}CarbonLib\" \xb6\n".
1127 " \"{SharedLibraries}StdCLib\"\n".
1129 print &splitline("all \xc4 " . join(" ", &progrealnames("M")), undef, "\xb6");
1131 foreach $p (&prognames("M")) {
1132 ($prog, $type) = split ",", $p;
1134 print &splitline("$prog \xc4 $prog.68k $prog.ppc $prog.carbon",
1135 undef, "\xb6"), "\n\n";
1137 $rsrc = &objects($p, "", "X.rsrc", undef);
1139 foreach $arch (qw(68K CFM68K PPC Carbon)) {
1140 $objstr = &objects($p, "X.\L$arch\E.o", "", undef);
1141 print &splitline("$prog.\L$arch\E \xc4 $objstr $rsrc", undef, "\xb6");
1143 print &splitline("\tDuplicate -y $rsrc {Targ}", 69, "\xb6"), "\n";
1144 print &splitline("\t{Link_$arch} -o {Targ} -fragname $prog " .
1145 "{LinkOptions_$arch} " .
1146 $objstr . " {Libs_$arch}", 69, "\xb6"), "\n";
1147 print &splitline("\tSetFile -a BMi {Targ}", 69, "\xb6"), "\n\n";
1151 foreach $d (&deps("", "X.rsrc", "::", ":")) {
1152 next unless $d->{obj};
1153 print &splitline(sprintf("%s \xc4 %s", $d->{obj}, join " ", @{$d->{deps}}),
1154 undef, "\xb6"), "\n";
1155 print "\tRez ", $d->{deps}->[0], " -o {Targ} {ROptions}\n\n";
1157 foreach $arch (qw(68K CFM68K)) {
1158 foreach $d (&deps("X.\L$arch\E.o", "", "::", ":")) {
1159 next unless $d->{obj};
1160 print &splitline(sprintf("%s \xc4 %s", $d->{obj},
1161 join " ", @{$d->{deps}}),
1162 undef, "\xb6"), "\n";
1163 print "\t{C_$arch} ", $d->{deps}->[0],
1164 " -o {Targ} {COptions_$arch}\n\n";
1167 foreach $arch (qw(PPC Carbon)) {
1168 foreach $d (&deps("X.\L$arch\E.o", "", "::", ":")) {
1169 next unless $d->{obj};
1170 print &splitline(sprintf("%s \xc4 %s", $d->{obj},
1171 join " ", @{$d->{deps}}),
1172 undef, "\xb6"), "\n";
1173 # The odd stuff here seems to stop afpd getting confused.
1174 print "\techo -n > {Targ}\n";
1175 print "\tsetfile -t XCOF {Targ}\n";
1176 print "\t{C_$arch} ", $d->{deps}->[0],
1177 " -o {Targ} {COptions_$arch}\n\n";
1180 select STDOUT; close OUT;
1183 if (defined $makefiles{'lcc'}) {
1185 $dirpfx = &dirpfx($makefiles{'lcc'}, "\\");
1188 open OUT, ">$makefiles{'lcc'}"; select OUT;
1190 "# Makefile for $project_name under lcc.\n".
1191 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1192 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1193 # lcc command line option is -D not /D
1194 ($_ = $help) =~ s/=\/D/=-D/gs;
1198 "# If you rename this file to `Makefile', you should change this line,\n".
1199 "# so that the .rsp files still depend on the correct makefile.\n".
1200 "MAKEFILE = Makefile.lcc\n".
1202 "# C compilation flags\n".
1203 "CFLAGS = -D_WINDOWS " .
1204 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
1207 "# Get include directory for resource compiler\n".
1209 print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
1211 foreach $p (&prognames("G:C")) {
1212 ($prog, $type) = split ",", $p;
1213 $objstr = &objects($p, "X.obj", "X.res", undef);
1214 print &splitline("$prog.exe: " . $objstr ), "\n";
1215 $subsystemtype = undef;
1216 if ($type eq "G") { $subsystemtype = "-subsystem windows"; }
1217 my $libss = "shell32.lib wsock32.lib ws2_32.lib winspool.lib winmm.lib imm32.lib";
1218 print &splitline("\tlcclnk $subsystemtype -o $prog.exe $objstr $libss");
1222 foreach $d (&deps("X.obj", "X.res", $dirpfx, "\\")) {
1223 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
1225 if ($d->{obj} =~ /\.res$/) {
1226 print &splitline("\tlrc \$(FWHACK) \$(RCFL) -r \$*.rc",69)."\n";
1228 $deflist = join "", map { " -D$_" } @{$d->{defs}};
1229 print &splitline("\tlcc -O -p6 \$(COMPAT) \$(FWHACK) \$(CFLAGS)".
1230 " \$(XFLAGS)$deflist ".$d->{deps}->[0]." -o \$\@",69)."\n";
1234 print $makefile_extra{'lcc'};
1240 select STDOUT; close OUT;
1243 if (defined $makefiles{'osx'}) {
1245 $dirpfx = &dirpfx($makefiles{'osx'}, "/");
1247 ##-- Mac OS X makefile
1248 open OUT, ">$makefiles{'osx'}"; select OUT;
1250 "# Makefile for $project_name under Mac OS X.\n".
1251 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1252 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1253 # gcc command line option is -D not /D
1254 ($_ = $help) =~ s/=\/D/=-D/gs;
1257 "CC = \$(TOOLPATH)gcc\n".
1259 &splitline("CFLAGS = -O2 -Wall -Werror -g " .
1260 (join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
1261 "LDFLAGS = -framework Cocoa\n".
1262 &splitline("all:" . join "", map { " $_" } &progrealnames("MX:U")) .
1264 $makefile_extra{'osx'} .
1266 ".SUFFIXES: .o .c .m\n".
1269 foreach $p (&prognames("MX")) {
1270 ($prog, $type) = split ",", $p;
1271 $objstr = &objects($p, "X.o", undef, undef);
1272 $icon = &special($p, ".icns");
1273 $infoplist = &special($p, "info.plist");
1274 print "${prog}.app:\n\tmkdir -p \$\@\n";
1275 print "${prog}.app/Contents: ${prog}.app\n\tmkdir -p \$\@\n";
1276 print "${prog}.app/Contents/MacOS: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
1277 $targets = "${prog}.app/Contents/MacOS/$prog";
1278 if (defined $icon) {
1279 print "${prog}.app/Contents/Resources: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
1280 print "${prog}.app/Contents/Resources/${prog}.icns: ${prog}.app/Contents/Resources $icon\n\tcp $icon \$\@\n";
1281 $targets .= " ${prog}.app/Contents/Resources/${prog}.icns";
1283 if (defined $infoplist) {
1284 print "${prog}.app/Contents/Info.plist: ${prog}.app/Contents/Resources $infoplist\n\tcp $infoplist \$\@\n";
1285 $targets .= " ${prog}.app/Contents/Info.plist";
1287 $targets .= " \$(${prog}_extra)";
1288 print &splitline("${prog}: $targets", 69) . "\n\n";
1289 print &splitline("${prog}.app/Contents/MacOS/$prog: ".
1290 "${prog}.app/Contents/MacOS " . $objstr), "\n";
1291 $libstr = &objects($p, undef, undef, "-lX");
1292 print &splitline("\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " .
1293 $objstr . " $libstr", 69), "\n\n";
1295 foreach $p (&prognames("U")) {
1296 ($prog, $type) = split ",", $p;
1297 $objstr = &objects($p, "X.o", undef, undef);
1298 print &splitline($prog . ": " . $objstr), "\n";
1299 $libstr = &objects($p, undef, undef, "-lX");
1300 print &splitline("\t\$(CC)" . $mw . " \$(ULDFLAGS) -o \$@ " .
1301 $objstr . " $libstr", 69), "\n\n";
1303 foreach $d (&deps("X.o", undef, $dirpfx, "/")) {
1304 print &splitline(sprintf("%s: %s", $d->{obj}, join " ", @{$d->{deps}})),
1306 $deflist = join "", map { " -D$_" } @{$d->{defs}};
1307 if ($d->{deps}->[0] =~ /\.m$/) {
1308 print "\t\$(CC) -x objective-c \$(COMPAT) \$(FWHACK) \$(CFLAGS)".
1309 " \$(XFLAGS)$deflist -c \$< -o \$\@\n";
1311 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
1312 " -c \$< -o \$\@\n";
1316 "\trm -f *.o *.dmg". (join "", map { " $_" } &progrealnames("U")) . "\n".
1318 select STDOUT; close OUT;