git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Makefile: building git in cygwin 1.7.0

From
Eric Blake <ebb9@byu.net>
Date
Aug 15, 2008, 15:01 UTC
Message-ID
<loom.20080815T143926-715@post.gmane.org>

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 directory

and 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(-)
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
Message 1 of 1 in “Makefile: building git in cygwin 1.7.0”
  1. Makefile: building git in cygwin 1.7.0Eric Blake, Aug 15, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.