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}};
422 push @ret, {obj
=> $x, deps
=> [@deps], defs
=> $defs{$ii}};
429 my ($n, $prog, $type);
432 foreach $n (@prognames) {
433 ($prog, $type) = split ",", $n;
434 push @ret, $n if index(":$types:", ":$type:") >= 0;
441 my ($n, $prog, $type);
444 foreach $n (@prognames) {
445 ($prog, $type) = split ",", $n;
446 push @ret, $prog if index(":$types:", ":$type:") >= 0;
452 my ($types,$suffix) = @_;
454 # assume that all UNIX programs have a man page
455 if($suffix eq "1" && $types =~ /:X:/) {
456 return map("$_.1", &progrealnames
($types));
461 # Now we're ready to output the actual Makefiles.
463 if (defined $makefiles{'cygwin'}) {
465 $dirpfx = &dirpfx
($makefiles{'cygwin'}, "/");
468 open OUT
, ">$makefiles{'cygwin'}"; select OUT
;
470 "# Makefile for $project_name under cygwin.\n".
471 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
472 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
473 # gcc command line option is -D not /D
474 ($_ = $help) =~ s/=\/D/=-D
/gs
;
478 "# You can define this path to point at your tools if you need to\n".
479 "# TOOLPATH = c:\\cygwin\\bin\\ # or similar, if you're running Windows\n".
480 "# TOOLPATH = /pkg/mingw32msvc/i386-mingw32msvc/bin/\n".
481 "CC = \$(TOOLPATH)gcc\n".
482 "RC = \$(TOOLPATH)windres\n".
483 "# Uncomment the following two lines to compile under Winelib\n".
486 "# You may also need to tell windres where to find include files:\n".
487 "# RCINC = --include-dir c:\\cygwin\\include\\\n".
489 &splitline
("CFLAGS = -mno-cygwin -Wall -O2 -D_WINDOWS -DDEBUG -DWIN32S_COMPAT".
490 " -D_NO_OLDNAMES -DNO_MULTIMON " .
491 (join " ", map {"-I$dirpfx$_"} @srcdirs)) .
493 "LDFLAGS = -mno-cygwin -s\n".
494 &splitline
("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1".
495 " --define WINVER=0x0400 --define MINGW32_FIX=1 " .
496 (join " ", map {"--include $dirpfx$_"} @srcdirs) )."\n".
498 print &splitline
("all:" . join "", map { " $_.exe" } &progrealnames
("G:C"));
500 foreach $p (&prognames
("G:C")) {
501 ($prog, $type) = split ",", $p;
502 $objstr = &objects
($p, "X.o", "X.res.o", undef);
503 print &splitline
($prog . ".exe: " . $objstr), "\n";
504 my $mw = $type eq "G" ?
" -mwindows" : "";
505 $libstr = &objects
($p, undef, undef, "-lX");
506 print &splitline
("\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " .
507 "-Wl,-Map,$prog.map " .
508 $objstr . " $libstr", 69), "\n\n";
510 foreach $d (&deps
("X.o", "X.res.o", $dirpfx, "/")) {
511 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
513 if ($d->{obj
} =~ /\.res\.o$/) {
514 print "\t\$(RC) \$(FWHACK) \$(RCFL) \$(RCFLAGS) \$< \$\@\n";
516 $deflist = join "", map { " -D$_" } @
{$d->{defs
}};
517 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS)" .
518 " \$(XFLAGS)$deflist -c \$< -o \$\@\n";
522 print $makefile_extra{'cygwin'};
524 "\trm -f *.o *.exe *.res.o *.map\n".
526 select STDOUT
; close OUT
;
530 ##-- Borland makefile
531 if (defined $makefiles{'borland'}) {
533 $dirpfx = &dirpfx
($makefiles{'borland'}, "\\");
535 %stdlibs = ( # Borland provides many Win32 API libraries intrinsically
547 open OUT
, ">$makefiles{'borland'}"; select OUT
;
549 "# Makefile for $project_name under Borland C.\n".
550 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
551 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
552 # bcc32 command line option is -D not /D
553 ($_ = $help) =~ s/=\/D/=-D
/gs
;
557 "# If you rename this file to `Makefile', you should change this line,\n".
558 "# so that the .rsp files still depend on the correct makefile.\n".
559 "MAKEFILE = Makefile.bor\n".
561 "# C compilation flags\n".
562 "CFLAGS = -D_WINDOWS -DWINVER=0x0401\n".
564 "# Get include directory for resource compiler\n".
566 "BCB = \$(MAKEDIR)\\..\n".
569 print &splitline
("all:" . join "", map { " $_.exe" } &progrealnames
("G:C"));
571 foreach $p (&prognames
("G:C")) {
572 ($prog, $type) = split ",", $p;
573 $objstr = &objects
($p, "X.obj", "X.res", undef);
574 print &splitline
("$prog.exe: " . $objstr . " $prog.rsp"), "\n";
575 my $ap = ($type eq "G") ?
"-aa" : "-ap";
576 print "\tilink32 $ap -Gn -L\$(BCB)\\lib \@$prog.rsp\n\n";
578 foreach $p (&prognames
("G:C")) {
579 ($prog, $type) = split ",", $p;
580 print $prog, ".rsp: \$(MAKEFILE)\n";
581 $objstr = &objects
($p, "X.obj", undef, undef);
582 @objlist = split " ", $objstr;
584 foreach $i (@objlist) {
585 if (length($objlines[$#objlines] . " $i") > 50) {
588 $objlines[$#objlines] .= " $i";
590 $c0w = ($type eq "G") ?
"c0w32" : "c0x32";
591 print "\techo $c0w + > $prog.rsp\n";
592 for ($i=0; $i<=$#objlines; $i++) {
593 $plus = ($i < $#objlines ?
" +" : "");
594 print "\techo$objlines[$i]$plus >> $prog.rsp\n";
596 print "\techo $prog.exe >> $prog.rsp\n";
597 $objstr = &objects
($p, "X.obj", "X.res", undef);
598 @libs = split " ", &objects
($p, undef, undef, "X");
599 @libs = grep { !$stdlibs{$_} } @libs;
600 unshift @libs, "cw32", "import32";
601 $libstr = join ' ', @libs;
602 print "\techo nul,$libstr, >> $prog.rsp\n";
603 print "\techo " . &objects
($p, undef, "X.res", undef) . " >> $prog.rsp\n";
606 foreach $d (&deps
("X.obj", "X.res", $dirpfx, "\\")) {
607 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
609 if ($d->{obj
} =~ /\.res$/) {
610 print &splitline
("\tbrcc32 \$(FWHACK) \$(RCFL) " .
611 "-i \$(BCB)\\include -r -DNO_WINRESRC_H -DWIN32".
612 " -D_WIN32 -DWINVER=0x0401 \$*.rc",69)."\n";
614 $deflist = join "", map { " -D$_" } @
{$d->{defs
}};
615 print &splitline
("\tbcc32 -w-aus -w-ccc -w-par -w-pia \$(COMPAT)" .
616 " \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist ".
617 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
618 " /o$d->{obj} /c ".$d->{deps
}->[0],69)."\n";
622 print $makefile_extra{'borland'};
633 "\t-del *.\$\$\$\$\$\$\n";
634 select STDOUT
; close OUT
;
637 if (defined $makefiles{'vc'}) {
639 $dirpfx = &dirpfx
($makefiles{'vc'}, "\\");
641 ##-- Visual C++ makefile
642 open OUT
, ">$makefiles{'vc'}"; select OUT
;
644 "# Makefile for $project_name under Visual C.\n".
645 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
646 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
650 "# If you rename this file to `Makefile', you should change this line,\n".
651 "# so that the .rsp files still depend on the correct makefile.\n".
652 "MAKEFILE = Makefile.vc\n".
654 "# C compilation flags\n".
655 "CFLAGS = /nologo /W3 /O1 /D_WINDOWS /D_WIN32_WINDOWS=0x401 /DWINVER=0x401\n".
656 "LFLAGS = /incremental:no /fixed\n".
658 print &splitline
("all:" . join "", map { " $_.exe" } &progrealnames
("G:C"));
660 foreach $p (&prognames
("G:C")) {
661 ($prog, $type) = split ",", $p;
662 $objstr = &objects
($p, "X.obj", "X.res", undef);
663 print &splitline
("$prog.exe: " . $objstr . " $prog.rsp"), "\n";
664 print "\tlink \$(LFLAGS) -out:$prog.exe -map:$prog.map \@$prog.rsp\n\n";
666 foreach $p (&prognames
("G:C")) {
667 ($prog, $type) = split ",", $p;
668 print $prog, ".rsp: \$(MAKEFILE)\n";
669 $objstr = &objects
($p, "X.obj", "X.res", "X.lib");
670 @objlist = split " ", $objstr;
672 foreach $i (@objlist) {
673 if (length($objlines[$#objlines] . " $i") > 50) {
676 $objlines[$#objlines] .= " $i";
678 $subsys = ($type eq "G") ?
"windows" : "console";
679 print "\techo /nologo /subsystem:$subsys > $prog.rsp\n";
680 for ($i=0; $i<=$#objlines; $i++) {
681 print "\techo$objlines[$i] >> $prog.rsp\n";
685 foreach $d (&deps
("X.obj", "X.res", $dirpfx, "\\")) {
686 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
688 if ($d->{obj
} =~ /\.res$/) {
689 print "\trc \$(FWHACK) \$(RCFL) -r -DWIN32 -D_WIN32 ".
690 "-DWINVER=0x0400 -fo".$d->{obj
}." ".$d->{deps
}->[0]."\n";
692 $deflist = join "", map { " /D$_" } @
{$d->{defs
}};
693 print "\tcl \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist".
694 " /c ".$d->{deps}->[0]." /Fo$d->{obj}\n";
698 print $makefile_extra{'vc'};
699 print "\nclean: tidy\n".
716 "\t-del debug.log\n";
717 select STDOUT
; close OUT
;
720 if (defined $makefiles{'vcproj'}) {
725 ##-- MSVC 6 Workspace and projects
727 # Note: All files created in this section are written in binary
728 # mode, because although MSVC's command-line make can deal with
729 # LF-only line endings, MSVC project files really _need_ to be
730 # CRLF. Hence, in order for mkfiles.pl to generate usable project
731 # files even when run from Unix, I make sure all files are binary
732 # and explicitly write the CRLFs.
734 # Create directories if necessary
735 mkdir $makefiles{'vcproj'}
736 if(! -d
$makefiles{'vcproj'});
737 chdir $makefiles{'vcproj'};
738 @deps = &deps
("X.obj", "X.res", "", "\\");
739 %all_object_deps = map {$_->{obj
} => $_->{deps
}} @deps;
740 # Create the project files
741 # Get names of all Windows projects (GUI and console)
742 my @prognames = &prognames
("G:C");
743 foreach $progname (@prognames) {
744 create_project
(\
%all_object_deps, $progname);
746 # Create the workspace file
747 open OUT
, ">$project_name.dsw"; binmode OUT
; select OUT
;
749 "Microsoft Developer Studio Workspace File, Format Version 6.00\r\n".
750 "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n".
752 "###############################################################################\r\n".
755 foreach $progname (@prognames) {
756 ($windows_project, $type) = split ",", $progname;
757 print "Project: \"$windows_project\"=\".\\$windows_project\\$windows_project.dsp\" - Package Owner=<4>\r\n";
769 "###############################################################################\r\n".
781 "###############################################################################\r\n".
783 select STDOUT
; close OUT
;
787 my ($all_object_deps, $progname) = @_;
788 # Construct program's dependency info
793 %resource_files = ();
794 @object_files = split " ", &objects
($progname, "X.obj", "X.res", "X.lib");
795 foreach $object_file (@object_files) {
796 next if defined $seen_objects{$object_file};
797 $seen_objects{$object_file} = 1;
798 if($object_file =~ /\.lib$/io) {
799 $lib_files{$object_file} = 1;
802 $object_deps = $all_object_deps{$object_file};
803 foreach $object_dep (@
$object_deps) {
804 if($object_dep =~ /\.c$/io) {
805 $source_files{$object_dep} = 1;
808 if($object_dep =~ /\.h$/io) {
809 $header_files{$object_dep} = 1;
812 if($object_dep =~ /\.(rc|ico)$/io) {
813 $resource_files{$object_dep} = 1;
818 $libs = join " ", sort keys %lib_files;
819 @source_files = sort keys %source_files;
820 @header_files = sort keys %header_files;
821 @resources = sort keys %resource_files;
822 ($windows_project, $type) = split ",", $progname;
823 mkdir $windows_project
824 if(! -d
$windows_project);
825 chdir $windows_project;
826 $subsys = ($type eq "G") ?
"windows" : "console";
827 open OUT
, ">$windows_project.dsp"; binmode OUT
; select OUT
;
829 "# Microsoft Developer Studio Project File - Name=\"$windows_project\" - Package Owner=<4>\r\n".
830 "# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n".
831 "# ** DO NOT EDIT **\r\n".
833 "# TARGTYPE \"Win32 (x86) Application\" 0x0101\r\n".
835 "CFG=$windows_project - Win32 Debug\r\n".
836 "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n".
837 "!MESSAGE use the Export Makefile command and run\r\n".
839 "!MESSAGE NMAKE /f \"$windows_project.mak\".\r\n".
841 "!MESSAGE You can specify a configuration when running NMAKE\r\n".
842 "!MESSAGE by defining the macro CFG on the command line. For example:\r\n".
844 "!MESSAGE NMAKE /f \"$windows_project.mak\" CFG=\"$windows_project - Win32 Debug\"\r\n".
846 "!MESSAGE Possible choices for configuration are:\r\n".
848 "!MESSAGE \"$windows_project - Win32 Release\" (based on \"Win32 (x86) Application\")\r\n".
849 "!MESSAGE \"$windows_project - Win32 Debug\" (based on \"Win32 (x86) Application\")\r\n".
852 "# Begin Project\r\n".
853 "# PROP AllowPerConfigDependencies 0\r\n".
854 "# PROP Scc_ProjName \"\"\r\n".
855 "# PROP Scc_LocalPath \"\"\r\n".
860 "!IF \"\$(CFG)\" == \"$windows_project - Win32 Release\"\r\n".
862 "# PROP BASE Use_MFC 0\r\n".
863 "# PROP BASE Use_Debug_Libraries 0\r\n".
864 "# PROP BASE Output_Dir \"Release\"\r\n".
865 "# PROP BASE Intermediate_Dir \"Release\"\r\n".
866 "# PROP BASE Target_Dir \"\"\r\n".
867 "# PROP Use_MFC 0\r\n".
868 "# PROP Use_Debug_Libraries 0\r\n".
869 "# PROP Output_Dir \"Release\"\r\n".
870 "# PROP Intermediate_Dir \"Release\"\r\n".
871 "# PROP Ignore_Export_Lib 0\r\n".
872 "# PROP Target_Dir \"\"\r\n".
873 "# ADD BASE CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /c\r\n".
874 "# ADD CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /c\r\n".
875 "# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n".
876 "# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /win32\r\n".
877 "# ADD BASE RSC /l 0x809 /d \"NDEBUG\"\r\n".
878 "# ADD RSC /l 0x809 /d \"NDEBUG\"\r\n".
879 "BSC32=bscmake.exe\r\n".
880 "# ADD BASE BSC32 /nologo\r\n".
881 "# ADD BSC32 /nologo\r\n".
882 "LINK32=link.exe\r\n".
883 "# 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".
884 "# ADD LINK32 $libs /nologo /subsystem:$subsys /machine:I386\r\n".
885 "# SUBTRACT LINK32 /pdb:none\r\n".
887 "!ELSEIF \"\$(CFG)\" == \"$windows_project - Win32 Debug\"\r\n".
889 "# PROP BASE Use_MFC 0\r\n".
890 "# PROP BASE Use_Debug_Libraries 1\r\n".
891 "# PROP BASE Output_Dir \"Debug\"\r\n".
892 "# PROP BASE Intermediate_Dir \"Debug\"\r\n".
893 "# PROP BASE Target_Dir \"\"\r\n".
894 "# PROP Use_MFC 0\r\n".
895 "# PROP Use_Debug_Libraries 1\r\n".
896 "# PROP Output_Dir \"Debug\"\r\n".
897 "# PROP Intermediate_Dir \"Debug\"\r\n".
898 "# PROP Ignore_Export_Lib 0\r\n".
899 "# PROP Target_Dir \"\"\r\n".
900 "# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /GZ /c\r\n".
901 "# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /D \"_MBCS\" /YX /FD /GZ /c\r\n".
902 "# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n".
903 "# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32\r\n".
904 "# ADD BASE RSC /l 0x809 /d \"_DEBUG\"\r\n".
905 "# ADD RSC /l 0x809 /d \"_DEBUG\"\r\n".
906 "BSC32=bscmake.exe\r\n".
907 "# ADD BASE BSC32 /nologo\r\n".
908 "# ADD BSC32 /nologo\r\n".
909 "LINK32=link.exe\r\n".
910 "# 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".
911 "# ADD LINK32 $libs /nologo /subsystem:$subsys /debug /machine:I386 /pdbtype:sept\r\n".
912 "# SUBTRACT LINK32 /pdb:none\r\n".
916 "# Begin Target\r\n".
918 "# Name \"$windows_project - Win32 Release\"\r\n".
919 "# Name \"$windows_project - Win32 Debug\"\r\n".
920 "# Begin Group \"Source Files\"\r\n".
922 "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\r\n";
923 foreach $source_file (@source_files) {
925 "# Begin Source File\r\n".
927 "SOURCE=..\\..\\$source_file\r\n";
928 if($source_file =~ /ssh\.c/io) {
929 # Disable 'Edit and continue' as Visual Studio can't handle the macros
932 "!IF \"\$(CFG)\" == \"$windows_project - Win32 Release\"\r\n".
934 "!ELSEIF \"\$(CFG)\" == \"$windows_project - Win32 Debug\"\r\n".
941 print "# End Source File\r\n";
945 "# Begin Group \"Header Files\"\r\n".
947 "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\r\n";
948 foreach $header_file (@header_files) {
950 "# Begin Source File\r\n".
952 "SOURCE=..\\..\\$header_file\r\n".
953 "# End Source File\r\n";
957 "# Begin Group \"Resource Files\"\r\n".
959 "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\r\n";
960 foreach $resource_file (@resources) {
962 "# Begin Source File\r\n".
964 "SOURCE=..\\..\\$resource_file\r\n".
965 "# End Source File\r\n";
971 select STDOUT
; close OUT
;
976 if (defined $makefiles{'gtk'}) {
978 $dirpfx = &dirpfx
($makefiles{'gtk'}, "/");
980 ##-- X/GTK/Unix makefile
981 open OUT
, ">$makefiles{'gtk'}"; select OUT
;
983 "# Makefile for $project_name under X/GTK and Unix.\n".
984 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
985 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
986 # gcc command line option is -D not /D
987 ($_ = $help) =~ s/=\/D/=-D
/gs
;
991 "# You can define this path to point at your tools if you need to\n".
992 "# TOOLPATH = /opt/gcc/bin\n".
993 "CC = \$(TOOLPATH)cc\n".
994 "# You can manually set this to `gtk-config' or `pkg-config gtk+-1.2'\n".
995 "# (depending on what works on your system) if you want to enforce\n".
996 "# building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0'\n".
997 "# if you want to enforce 2.0. The default is to try 2.0 and fall back\n".
998 "# to 1.2 if it isn't found.\n".
999 "GTK_CONFIG = sh -c 'pkg-config gtk+-2.0 \$\$0 2>/dev/null || gtk-config \$\$0'\n".
1001 &splitline
("CFLAGS = -O2 -Wall -Werror -g " .
1002 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
1003 " `\$(GTK_CONFIG) --cflags`")."\n".
1004 "XLDFLAGS = `\$(GTK_CONFIG) --libs`\n".
1006 "INSTALL=install\n",
1007 "INSTALL_PROGRAM=\$(INSTALL)\n",
1008 "INSTALL_DATA=\$(INSTALL)\n",
1009 "prefix=/usr/local\n",
1010 "exec_prefix=\$(prefix)\n",
1011 "bindir=\$(exec_prefix)/bin\n",
1012 "gamesdir=\$(exec_prefix)/games\n",
1013 "mandir=\$(prefix)/man\n",
1014 "man1dir=\$(mandir)/man1\n",
1016 print &splitline
("all:" . join "", map { " $_" } &progrealnames
("X:U"));
1018 foreach $p (&prognames
("X:U")) {
1019 ($prog, $type) = split ",", $p;
1020 $objstr = &objects
($p, "X.o", undef, undef);
1021 print &splitline
($prog . ": " . $objstr), "\n";
1022 $libstr = &objects
($p, undef, undef, "-lX");
1023 print &splitline
("\t\$(CC)" . $mw . " \$(${type}LDFLAGS) -o \$@ " .
1024 $objstr . " $libstr", 69), "\n\n";
1026 foreach $d (&deps
("X.o", undef, $dirpfx, "/")) {
1027 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
1029 $deflist = join "", map { " -D$_" } @
{$d->{defs
}};
1030 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
1031 " -c \$< -o \$\@\n";
1034 print $makefile_extra{'gtk'};
1036 "\trm -f *.o". (join "", map { " $_" } &progrealnames
("X:U")) . "\n";
1037 select STDOUT
; close OUT
;
1040 if (defined $makefiles{'mpw'}) {
1043 open OUT
, ">$makefiles{'mpw'}"; select OUT
;
1045 "# Makefile for $project_name under MPW.\n#\n".
1046 "# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1047 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1048 # MPW command line option is -d not /D
1049 ($_ = $help) =~ s/=\/D/=-d
/gs
;
1052 "ROptions = `Echo \"{VER}\" | StreamEdit -e \"1,\$ replace /=(\xc5)\xa81\xb0/ 'STR=\xb6\xb6\xb6\xb6\xb6\"' \xa81 '\xb6\xb6\xb6\xb6\xb6\"'\"`".
1057 "C_Carbon = {PPCC}\n".
1059 "# -w 35 disables \"unused parameter\" warnings\n".
1060 "COptions = -i : -i :: -i ::charset -w 35 -w err -proto strict -ansi on \xb6\n".
1062 "COptions_68K = {COptions} -model far -opt time\n".
1063 "# Enabling \"-opt space\" for CFM-68K gives me undefined references to\n".
1064 "# _\$LDIVT and _\$LMODT.\n".
1065 "COptions_CFM68K = {COptions} -model cfmSeg -opt time\n".
1066 "COptions_PPC = {COptions} -opt size -traceback\n".
1067 "COptions_Carbon = {COptions} -opt size -traceback -d TARGET_API_MAC_CARBON\n".
1069 "Link_68K = ILink\n".
1070 "Link_CFM68K = ILink\n".
1071 "Link_PPC = PPCLink\n".
1072 "Link_Carbon = PPCLink\n".
1074 "LinkOptions = -c 'pTTY'\n".
1075 "LinkOptions_68K = {LinkOptions} -br 68k -model far -compact\n".
1076 "LinkOptions_CFM68K = {LinkOptions} -br 020 -model cfmseg -compact\n".
1077 "LinkOptions_PPC = {LinkOptions}\n".
1078 "LinkOptions_Carbon = -m __appstart -w {LinkOptions}\n".
1080 "Libs_68K = \"{CLibraries}StdCLib.far.o\" \xb6\n".
1081 " \"{Libraries}MacRuntime.o\" \xb6\n".
1082 " \"{Libraries}MathLib.far.o\" \xb6\n".
1083 " \"{Libraries}IntEnv.far.o\" \xb6\n".
1084 " \"{Libraries}Interface.o\" \xb6\n".
1085 " \"{Libraries}Navigation.far.o\" \xb6\n".
1086 " \"{Libraries}OpenTransport.o\" \xb6\n".
1087 " \"{Libraries}OpenTransportApp.o\" \xb6\n".
1088 " \"{Libraries}OpenTptInet.o\" \xb6\n".
1089 " \"{Libraries}UnicodeConverterLib.far.o\"\n".
1091 "Libs_CFM = \"{SharedLibraries}InterfaceLib\" \xb6\n".
1092 " \"{SharedLibraries}StdCLib\" \xb6\n".
1093 " \"{SharedLibraries}AppearanceLib\" \xb6\n".
1094 " -weaklib AppearanceLib \xb6\n".
1095 " \"{SharedLibraries}NavigationLib\" \xb6\n".
1096 " -weaklib NavigationLib \xb6\n".
1097 " \"{SharedLibraries}TextCommon\" \xb6\n".
1098 " -weaklib TextCommon \xb6\n".
1099 " \"{SharedLibraries}UnicodeConverter\" \xb6\n".
1100 " -weaklib UnicodeConverter\n".
1102 "Libs_CFM68K = {Libs_CFM} \xb6\n".
1103 " \"{CFM68KLibraries}NuMacRuntime.o\"\n".
1105 "Libs_PPC = {Libs_CFM} \xb6\n".
1106 " \"{SharedLibraries}ControlsLib\" \xb6\n".
1107 " -weaklib ControlsLib \xb6\n".
1108 " \"{SharedLibraries}WindowsLib\" \xb6\n".
1109 " -weaklib WindowsLib \xb6\n".
1110 " \"{SharedLibraries}OpenTransportLib\" \xb6\n".
1111 " -weaklib OTClientLib \xb6\n".
1112 " -weaklib OTClientUtilLib \xb6\n".
1113 " \"{SharedLibraries}OpenTptInternetLib\" \xb6\n".
1114 " -weaklib OTInetClientLib \xb6\n".
1115 " \"{PPCLibraries}StdCRuntime.o\" \xb6\n".
1116 " \"{PPCLibraries}PPCCRuntime.o\" \xb6\n".
1117 " \"{PPCLibraries}CarbonAccessors.o\" \xb6\n".
1118 " \"{PPCLibraries}OpenTransportAppPPC.o\" \xb6\n".
1119 " \"{PPCLibraries}OpenTptInetPPC.o\"\n".
1121 "Libs_Carbon = \"{PPCLibraries}CarbonStdCLib.o\" \xb6\n".
1122 " \"{PPCLibraries}StdCRuntime.o\" \xb6\n".
1123 " \"{PPCLibraries}PPCCRuntime.o\" \xb6\n".
1124 " \"{SharedLibraries}CarbonLib\" \xb6\n".
1125 " \"{SharedLibraries}StdCLib\"\n".
1127 print &splitline
("all \xc4 " . join(" ", &progrealnames
("M")), undef, "\xb6");
1129 foreach $p (&prognames
("M")) {
1130 ($prog, $type) = split ",", $p;
1132 print &splitline
("$prog \xc4 $prog.68k $prog.ppc $prog.carbon",
1133 undef, "\xb6"), "\n\n";
1135 $rsrc = &objects
($p, "", "X.rsrc", undef);
1137 foreach $arch (qw(68K CFM68K PPC Carbon
)) {
1138 $objstr = &objects
($p, "X.\L$arch\E.o", "", undef);
1139 print &splitline
("$prog.\L$arch\E \xc4 $objstr $rsrc", undef, "\xb6");
1141 print &splitline
("\tDuplicate -y $rsrc {Targ}", 69, "\xb6"), "\n";
1142 print &splitline
("\t{Link_$arch} -o {Targ} -fragname $prog " .
1143 "{LinkOptions_$arch} " .
1144 $objstr . " {Libs_$arch}", 69, "\xb6"), "\n";
1145 print &splitline
("\tSetFile -a BMi {Targ}", 69, "\xb6"), "\n\n";
1149 foreach $d (&deps
("", "X.rsrc", "::", ":")) {
1150 next unless $d->{obj
};
1151 print &splitline
(sprintf("%s \xc4 %s", $d->{obj
}, join " ", @
{$d->{deps
}}),
1152 undef, "\xb6"), "\n";
1153 print "\tRez ", $d->{deps
}->[0], " -o {Targ} {ROptions}\n\n";
1155 foreach $arch (qw(68K CFM68K
)) {
1156 foreach $d (&deps
("X.\L$arch\E.o", "", "::", ":")) {
1157 next unless $d->{obj
};
1158 print &splitline
(sprintf("%s \xc4 %s", $d->{obj
},
1159 join " ", @
{$d->{deps
}}),
1160 undef, "\xb6"), "\n";
1161 print "\t{C_$arch} ", $d->{deps
}->[0],
1162 " -o {Targ} {COptions_$arch}\n\n";
1165 foreach $arch (qw(PPC Carbon
)) {
1166 foreach $d (&deps
("X.\L$arch\E.o", "", "::", ":")) {
1167 next unless $d->{obj
};
1168 print &splitline
(sprintf("%s \xc4 %s", $d->{obj
},
1169 join " ", @
{$d->{deps
}}),
1170 undef, "\xb6"), "\n";
1171 # The odd stuff here seems to stop afpd getting confused.
1172 print "\techo -n > {Targ}\n";
1173 print "\tsetfile -t XCOF {Targ}\n";
1174 print "\t{C_$arch} ", $d->{deps
}->[0],
1175 " -o {Targ} {COptions_$arch}\n\n";
1178 select STDOUT
; close OUT
;
1181 if (defined $makefiles{'lcc'}) {
1183 $dirpfx = &dirpfx
($makefiles{'lcc'}, "\\");
1186 open OUT
, ">$makefiles{'lcc'}"; select OUT
;
1188 "# Makefile for $project_name under lcc.\n".
1189 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1190 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1191 # lcc command line option is -D not /D
1192 ($_ = $help) =~ s/=\/D/=-D
/gs
;
1196 "# If you rename this file to `Makefile', you should change this line,\n".
1197 "# so that the .rsp files still depend on the correct makefile.\n".
1198 "MAKEFILE = Makefile.lcc\n".
1200 "# C compilation flags\n".
1201 "CFLAGS = -D_WINDOWS " .
1202 (join " ", map {"-I$dirpfx$_"} @srcdirs) .
1205 "# Get include directory for resource compiler\n".
1207 print &splitline
("all:" . join "", map { " $_.exe" } &progrealnames
("G:C"));
1209 foreach $p (&prognames
("G:C")) {
1210 ($prog, $type) = split ",", $p;
1211 $objstr = &objects
($p, "X.obj", "X.res", undef);
1212 print &splitline
("$prog.exe: " . $objstr ), "\n";
1213 $subsystemtype = undef;
1214 if ($type eq "G") { $subsystemtype = "-subsystem windows"; }
1215 my $libss = "shell32.lib wsock32.lib ws2_32.lib winspool.lib winmm.lib imm32.lib";
1216 print &splitline
("\tlcclnk $subsystemtype -o $prog.exe $objstr $libss");
1220 foreach $d (&deps
("X.obj", "X.res", $dirpfx, "\\")) {
1221 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
1223 if ($d->{obj
} =~ /\.res$/) {
1224 print &splitline
("\tlrc \$(FWHACK) \$(RCFL) -r \$*.rc",69)."\n";
1226 $deflist = join "", map { " -D$_" } @
{$d->{defs
}};
1227 print &splitline
("\tlcc -O -p6 \$(COMPAT) \$(FWHACK) \$(CFLAGS)".
1228 " \$(XFLAGS)$deflist ".$d->{deps
}->[0]." -o \$\@",69)."\n";
1232 print $makefile_extra{'lcc'};
1238 select STDOUT
; close OUT
;
1241 if (defined $makefiles{'osx'}) {
1243 $dirpfx = &dirpfx
($makefiles{'osx'}, "/");
1245 ##-- Mac OS X makefile
1246 open OUT
, ">$makefiles{'osx'}"; select OUT
;
1248 "# Makefile for $project_name under Mac OS X.\n".
1249 "#\n# This file was created by `mkfiles.pl' from the `Recipe' file.\n".
1250 "# DO NOT EDIT THIS FILE DIRECTLY; edit Recipe or mkfiles.pl instead.\n";
1251 # gcc command line option is -D not /D
1252 ($_ = $help) =~ s/=\/D/=-D
/gs
;
1255 "CC = \$(TOOLPATH)gcc\n".
1257 &splitline
("CFLAGS = -O2 -Wall -Werror -g " .
1258 (join " ", map {"-I$dirpfx$_"} @srcdirs))."\n".
1259 "LDFLAGS = -framework Cocoa\n".
1260 &splitline
("all:" . join "", map { " $_" } &progrealnames
("MX:U")) .
1262 $makefile_extra{'osx'} .
1264 ".SUFFIXES: .o .c .m\n".
1267 foreach $p (&prognames
("MX")) {
1268 ($prog, $type) = split ",", $p;
1269 $objstr = &objects
($p, "X.o", undef, undef);
1270 $icon = &special
($p, ".icns");
1271 $infoplist = &special
($p, "info.plist");
1272 print "${prog}.app:\n\tmkdir -p \$\@\n";
1273 print "${prog}.app/Contents: ${prog}.app\n\tmkdir -p \$\@\n";
1274 print "${prog}.app/Contents/MacOS: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
1275 $targets = "${prog}.app/Contents/MacOS/$prog";
1276 if (defined $icon) {
1277 print "${prog}.app/Contents/Resources: ${prog}.app/Contents\n\tmkdir -p \$\@\n";
1278 print "${prog}.app/Contents/Resources/${prog}.icns: ${prog}.app/Contents/Resources $icon\n\tcp $icon \$\@\n";
1279 $targets .= " ${prog}.app/Contents/Resources/${prog}.icns";
1281 if (defined $infoplist) {
1282 print "${prog}.app/Contents/Info.plist: ${prog}.app/Contents/Resources $infoplist\n\tcp $infoplist \$\@\n";
1283 $targets .= " ${prog}.app/Contents/Info.plist";
1285 $targets .= " \$(${prog}_extra)";
1286 print &splitline
("${prog}: $targets", 69) . "\n\n";
1287 print &splitline
("${prog}.app/Contents/MacOS/$prog: ".
1288 "${prog}.app/Contents/MacOS " . $objstr), "\n";
1289 $libstr = &objects
($p, undef, undef, "-lX");
1290 print &splitline
("\t\$(CC)" . $mw . " \$(LDFLAGS) -o \$@ " .
1291 $objstr . " $libstr", 69), "\n\n";
1293 foreach $p (&prognames
("U")) {
1294 ($prog, $type) = split ",", $p;
1295 $objstr = &objects
($p, "X.o", undef, undef);
1296 print &splitline
($prog . ": " . $objstr), "\n";
1297 $libstr = &objects
($p, undef, undef, "-lX");
1298 print &splitline
("\t\$(CC)" . $mw . " \$(ULDFLAGS) -o \$@ " .
1299 $objstr . " $libstr", 69), "\n\n";
1301 foreach $d (&deps
("X.o", undef, $dirpfx, "/")) {
1302 print &splitline
(sprintf("%s: %s", $d->{obj
}, join " ", @
{$d->{deps
}})),
1304 $deflist = join "", map { " -D$_" } @
{$d->{defs
}};
1305 if ($d->{deps
}->[0] =~ /\.m$/) {
1306 print "\t\$(CC) -x objective-c \$(COMPAT) \$(FWHACK) \$(CFLAGS)".
1307 " \$(XFLAGS)$deflist -c \$< -o \$\@\n";
1309 print "\t\$(CC) \$(COMPAT) \$(FWHACK) \$(CFLAGS) \$(XFLAGS)$deflist" .
1310 " -c \$< -o \$\@\n";
1314 "\trm -f *.o *.dmg". (join "", map { " $_" } &progrealnames
("U")) . "\n".
1316 select STDOUT
; close OUT
;