From 7f95ebc0bf2bda1d7d71421fd1a7c3669a0e5c7a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 29 Nov 2015 08:39:50 +0000 Subject: [PATCH] Use nmake's inline file creation to automate .rsp files. This is noticeably faster than a sequence of 'echo' commands, because the file gets created all in one go. The most natural approach to this job would also hide the file's contents, but doing it this way with a 'type' command lets me see the file on nmake's standard output, so that the build log should still contain everything useful for debugging build problems. --- mkfiles.pl | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mkfiles.pl b/mkfiles.pl index 59ecfdc4..683f4b1d 100755 --- a/mkfiles.pl +++ b/mkfiles.pl @@ -648,27 +648,25 @@ if (defined $makefiles{'vc'}) { foreach $p (&prognames("G:C")) { ($prog, $type) = split ",", $p; $objstr = &objects($p, "X.obj", "X.res", undef); - print &splitline("$prog.exe: " . $objstr . " $prog.rsp"), "\n"; - print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:$prog.exe -map:$prog.map \@$prog.rsp\n\n"; - } - foreach $p (&prognames("G:C")) { - ($prog, $type) = split ",", $p; - print $prog, ".rsp: \$(MAKEFILE)\n"; + print &splitline("$prog.exe: " . $objstr), "\n"; + $objstr = &objects($p, "X.obj", "X.res", "X.lib"); + $subsys = ($type eq "G") ? "windows" : "console"; + $inlinefilename = "link_$prog"; + print "\ttype <<$inlinefilename\n"; @objlist = split " ", $objstr; @objlines = (""); foreach $i (@objlist) { - if (length($objlines[$#objlines] . " $i") > 50) { + if (length($objlines[$#objlines] . " $i") > 72) { push @objlines, ""; } $objlines[$#objlines] .= " $i"; } - $subsys = ($type eq "G") ? "windows" : "console"; - print "\techo /nologo /subsystem:$subsys > $prog.rsp\n"; for ($i=0; $i<=$#objlines; $i++) { - print "\techo$objlines[$i] >> $prog.rsp\n"; + print "$objlines[$i]\n"; } - print "\n"; + print "<<\n"; + print "\tlink \$(LFLAGS) \$(XLFLAGS) -out:$prog.exe -map:$prog.map -nologo -subsystem:$subsys \@$inlinefilename\n\n"; } foreach $d (&deps("X.obj", "X.res", $dirpfx, "\\", "vc")) { $extradeps = $forceobj{$d->{obj_orig}} ? ["*.c","*.h","*.rc"] : [];