Use cmd.exe to export env vars before commands

Microsoft NMake runs the entire command block in a single `cmd.exe`
session, so environment variables exported with `set` are seen by the
following commands. C++Builder's `make.exe` doesn't use `cmd.exe` but
executes each command line separately. While it emulates only certain
shell features itself, `set` isn't one of them.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
This commit is contained in:
Tanzinul Islam 2020-11-26 15:38:40 +00:00 committed by Dmitry Belyavskiy
parent f1ee757daa
commit 583a9f1f6b

View File

@ -415,19 +415,14 @@ all: build_sw build_docs
test: tests
{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils
@{- output_off() if $disabled{tests}; "" -}
set SRCTOP=$(SRCDIR)
set BLDTOP=$(BLDDIR)
set PERL=$(PERL)
set FIPSKEY=$(FIPSKEY)
"$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
cmd /C "set "SRCTOP=$(SRCDIR)" & set "BLDTOP=$(BLDDIR)" & set "PERL=$(PERL)" & set "FIPSKEY=$(FIPSKEY)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)"
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@$(ECHO) "Tests are not supported with your chosen Configure options"
@{- output_on() if !$disabled{tests}; "" -}
list-tests:
@{- output_off() if $disabled{tests}; "" -}
@set SRCTOP=$(SRCDIR)
@"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
@cmd /C "set "SRCTOP=$(SRCDIR)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" list"
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@$(ECHO) "Tests are not supported with your chosen Configure options"
@{- output_on() if !$disabled{tests}; "" -}
@ -711,8 +706,7 @@ EOF
if ($args{src} =~ /\.S$/) {
return <<"EOF";
$target: "$gen0" $deps
set ASM=\$(AS)
$generator \$@.S
cmd /C "set "ASM=\$(AS)" & $generator \$@.S"
\$(CPP) $incs $cppflags $defs \$@.S > \$@.i
move /Y \$@.i \$@
del /Q \$@.S
@ -721,8 +715,7 @@ EOF
# Otherwise....
return <<"EOF";
$target: "$gen0" $deps
set ASM=\$(AS)
$generator \$@
cmd /C "set "ASM=\$(AS)" & $generator \$@"
EOF
}
return <<"EOF";