Fix the Cygwin RCFLAGS in the light of recent changes.
[sgt/puzzles] / mkfiles.pl
index c81d64d..4aa7f20 100755 (executable)
@@ -131,11 +131,22 @@ readinput: while (1) {
       $type = substr($i,1,(length $i)-2);
     } else {
       if ($i =~ /\?$/) {
-       # Source files with a trailing question mark are optional:
+       # Object files with a trailing question mark are optional:
        # the build can proceed fine without them, so we only use
-       # them if they're present.
+       # them if their primary source files are present.
        $i =~ s/\?$//;
        $i = undef unless defined &finddep($i);
+      } elsif ($i =~ /\|/) {
+       # Object file descriptions containing a vertical bar are
+       # lists of choices: we use the _first_ one whose primary
+       # source file is present.
+       @options = split /\|/, $i;
+       $j = undef;
+       foreach $k (@options) {
+         $j=$k, last if defined &finddep($k);
+       }
+       die "no alternative found for $i\n" unless defined $j;
+       $i = $j;
       }
       if (defined $i) {
        push @$listref, $i;
@@ -481,7 +492,8 @@ if (defined $makefiles{'cygwin'}) {
               "\n".
     "LDFLAGS = -mno-cygwin -s\n".
     &splitline("RCFLAGS = \$(RCINC) --define WIN32=1 --define _WIN32=1".
-      " --define WINVER=0x0400 --define MINGW32_FIX=1")."\n".
+      " --define WINVER=0x0400 --define MINGW32_FIX=1 " .
+       (join " ", map {"--include $dirpfx$_"} @srcdirs) )."\n".
     "\n";
     print &splitline("all:" . join "", map { " $_.exe" } &progrealnames("G:C"));
     print "\n\n";