nmake: fix install_html_docs target
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Sat, 28 Dec 2019 22:03:29 +0000 (23:03 +0100)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Wed, 8 Jan 2020 17:01:02 +0000 (18:01 +0100)
commita9e4e3c39eb361ddfb438edb27c754947009eed6
tree9487bc84bf4267a9d2564c1c2775374d18fb7f94
parent03047e7b7f64b054fa85d101e7097af5daf7a865
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 <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10719)
Configurations/windows-makefile.tmpl