On platforms with $X, make removes any leftover scripts 'a' from earlier builds if a new binary 'a.exe' is now built. However, on cygwin 1.7.0, 'git' and 'git.exe' now consistently name the same file. Test for file equality before attempting a remove, in order to avoid nuking just-built binaries.
Signed-off-by: Eric Blake <ebb9@byu.net> ---
On cygwin 1.5.x, a script 'a' and binary 'a.exe' could co-exist in the same directory, and exec'ing 'a' tended to favor the script over the binary - problematic for the case where incremental building in an existing git checkout picks up a switch from a script to a builtin. Likewise, 'rm -f a' refused to remove 'a.exe', so it was a no-op if there was no script 'a', hence the addition of a $X-specific rule to nuke those stale scripts.
But the .exe handling will change in cygwin 1.7.0 (to be released later this year), where it is much harder to create 'a' and 'a.exe' as distinct files ('a' is automatically removed if 'a.exe' is created); and 'rm -f a' now succeeds at removing 'a.exe' if there is no 'a'. But this means Makefile's $X-specific rule to kill old scripts now nukes the just built binary files:
$ make
...
BUILTIN git-status.exe
BUILTIN git-whatchanged.exe
rm -f 'git-fast-import'; ... rm -f 'git-status'; rm -f 'git-whatchanged';
rm -f 'git';
SUBDIR git-gui
...
$ ls git
ls: cannot access git: No such file or directoryand all the hard work of building is lost, on every attempt to build. All platforms that have $X should have a test(1) that understands -ef.
Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile index fcff2a4..ca418fc 100644 --- a/Makefile +++ b/Makefile @@ -1071,7 +1071,7 @@ SHELL = $(SHELL_PATH) all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS ifneq (,$X) - $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$p';) + $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';) endif all::
-- 1.5.6.4