Subject: | build does not succeed using gmake |
We recently switched our build on Windows from nmake to gmake. The Makefile generated for Win32-API failed to build with the following error:
LINK : fatal error LNK1181: cannot open input file 'resource.res'
gmake[4]: *** [blib\arch\auto\Win32\Setupsup\Setupsup.dll] Error 1181
The 'resource.res' file wasn't generated because 'gmake' (at least our build of gmake) doesn't have the predefined rule for generating '.res' files from '.rc' files that 'nmake' has. (https://docs.microsoft.com/en-us/cpp/build/reference/predefined-rules?view=vs-2019)
By updating the Makefile.PL to add the rule and mangling the Makefile to include '.res' and '.rc' on the'.SUFFIXES' list, the the build completed successfully using gmake.
elsif ($Config{cc} =~ /^cl\b/i && $Config{make} =~ /^gmake/i) {
no warnings 'once';
*MY::postamble = sub {
return <<'MAKE_FRAG';
RC=rc
.rc.res:
$(RC) $(RFLAGS) /r $<
MAKE_FRAG
}
}
$(PERL) -pi.orig -e "s/^\.SUFFIXES : /\.SUFFIXES : .rc .res /m" Win32-Setupsup/Makefile