From: Tanzinul Islam Date: Thu, 26 Nov 2020 15:38:40 +0000 (+0000) Subject: Use cmd.exe to export env vars before commands X-Git-Tag: openssl-3.0.0-alpha15~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=583a9f1f6b0d0842f8d63a21c335b24494fc67bc;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/13540) --- diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index d9cc0e53e32..3160984ccc0 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -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";