win32: use tmp file when creating config.sh #20110
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
config_sh.PL
failed then it created an empty '..\config.sh' file.This is unwanted since if make is then re-run it detects a '..\config.sh'
file and skips the target which leads to completely different errors.
After adding a
die "Foobar";
in win32/config_sh.PL:Re-running the make command:
When
gmake
was re-run it started with the '$(CONFIGPM)' target insteadof the '..\config.sh' target.
The fix: instead of creating '..\config.sh' it now first creates '..\config.sh.tmp' and then renames1 it to '..\config.sh'
Tested the GNUmakefile on Windows 10 using GNU Make v4.2.1,
I did not test the Makefile (no nmake installed).
Footnotes
rename
on windows only takes a path in the first argument.That is:
rename ..\config.sh.tmp config.sh
can be consideredthe same as
move ..\config.sh.tmp ..\config.sh
. ↩