From: Dr. Matthias St. Pierre Date: Sat, 28 Dec 2019 22:03:29 +0000 (+0100) Subject: nmake: fix install_html_docs target X-Git-Tag: openssl-3.0.0-alpha1~724 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a9e4e3c39eb361ddfb438edb27c754947009eed6;p=oweals%2Fopenssl.git nmake: fix install_html_docs target The nmake rule contains actually two errors: 1. The $< target[1] does not work for regular rules and is expanded to an empty string after issuing the warning NMAKE : warning U4006: special macro undefined : '$<"' Solution: replace $< by $? 2. The substitution regex is not quoted correctly, which leads to the following error message by cmd.exe: 'href' is not recognized as an internal or external command, operable program or batch file. Solution: Quoting arguments for cmd.exe is really a nightmare, but with the help of the excellent description [2] I was able to properly quote the regex. Things were complicated by the fact that a lot of levels of unquoting needed to be considered: * perl (windows-makefile.tmpl -> makefile) * make (reading the makefile) * cmd.exe (executed by make) * perl (scanning command line using CommandLineToArgvW()) The fix works, but the regex has become unmaintainable. It would actually be better to wrap the entire command (including the regex) into a little perl script which can be called by make directly. [1] https://docs.microsoft.com/en-us/cpp/build/reference/filename-macros [2] https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ Fixes #10648 Fixes #10749 [extended tests] Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/10719) --- diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index cc19b31255..83df9f27a9 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -589,8 +589,8 @@ reconfigure reconf: return <<"EOF"; $args{src}: $args{generator}->[0] pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\ - --podpath=man1:man3:man5:man7 "--infile=\$<" "--title=$title" \\ - | \$(PERL) -pe "s|href=\\"http://man\\.he\\.net/(man\d/[^\\"]+)(?:\\.html)?\\"|href=\\"../\$1.html|g;" \\ + --podpath=man1:man3:man5:man7 "--infile=\$?" "--title=$title" \\ + | \$(PERL) -pe ^"s^|href=\\^"http://man\\.he\\.net/^(man\\d/[^^\\^"]+^)^(?:\.html^)?^"^|href=\\^"../\$\$1.html^|g;^" \\ > \$\@ EOF } elsif (platform->isdef($args{src})) {