osxkeychain: define build targets in the top-level Makefile.
PATCH 1/1 osxkeychain: define build targets in the top-level Makefile.
From: Koji Nakamaru <[email protected]>
The fix for git-credential-osxkeychain in 4580bcd235 (osxkeychain: avoid incorrectly skipping store operation) introduced linkage with libgit.a, and its Makefile was adjusted accordingly. However, the build fails as of 864f55e190 because several macOS-specific refinements were applied to the top-level Makefile and config.mak.uname, such as:
- 363837afe7 (macOS: make Homebrew use configurable, 2025-12-24)
- cee341e9dd (macOS: use iconv from Homebrew if needed and present,
2025-12-24)
- d281241518 (utf8.c: enable workaround for iconv under macOS 14/15,
2026-01-12)Since libgit.a and its corresponding header files depend on many flags defined in the top-level Makefile, these flags must be consistently defined when building git-credential-osxkeychain. Continuing to manually adjust the git-credential-osxkeychain Makefile is cumbersome and fragile.
Define the build targets for git-credential-osxkeychain in the top-level Makefile and modify its local Makefile to simply rely on those targets.
---
osxkeychain: define build targets in the top-level Makefile.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2046%2FKojiNakamaru%2Ffix%2Fosxkeychain-makefile-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2046
Makefile | 17 +++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 23 insertions(+), 59 deletions(-)
Makefile +17 -0
@@ -4060,3 +4060,20 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT) $(AR) $(ARFLAGS) $@ $^ + +contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \ + $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation + +contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< + +install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + $(INSTALL) $(INSTALL_STRIP) $< '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + +.PHONY: clean-git-credential-osxkeychain +clean-git-credential-osxkeychain: + $(RM) \ + contrib/credential/osxkeychain/git-credential-osxkeychain \ + contrib/credential/osxkeychain/git-credential-osxkeychain.o
contrib/credential/osxkeychain/Makefile +6 -59
72 lines not on this page · raw message
base-commit: 864f55e1906897b630333675a52874c0fec2a45c
Signature · 1 line
gitgitgadget
Quoted 3 lines · Koji Nakamaru via GitGitGadget
Makefile | 17 +++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 23 insertions(+), 59 deletions(-)
Nice simplification overall.
contrib/credential/osxkeychain/Makefile line 5
Quoted 13 lines
contrib/credential/osxkeychain/Makefile +2
-3@@ -1,66 +1,13 @@ # The default target of this Makefile is... all:: git-credential-osxkeychain -include ../../../config.mak.uname --include ../../../config.mak.autogen --include ../../../config.mak +git-credential-osxkeychain: + cd ../../..; make contrib/credential/osxkeychain/git-credential-osxkeychain
Let's not write "make", but stick to $(MAKE), perhaps like
$(MAKE) -C ../../.. contrib/credential/osxkeychain/$@
contrib/credential/osxkeychain/Makefile line 11
Quoted 6 lines
contrib/credential/osxkeychain/Makefile +3
-1+install: + cd ../../..; make install-git-credential-osxkeychain clean: - $(RM) git-credential-osxkeychain git-credential-osxkeychain.o + cd ../../..; make clean-git-credential-osxkeychain
Likewise.
Quoted 27 lines · Junio C Hamano
Quoted 3 lines · Koji Nakamaru via GitGitGadget
Makefile | 17 +++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 23 insertions(+), 59 deletions(-)Nice simplification overall.
contrib/credential/osxkeychain/Makefile line 5
Quoted 13 lines
contrib/credential/osxkeychain/Makefile +2
-3@@ -1,66 +1,13 @@ # The default target of this Makefile is... all:: git-credential-osxkeychain -include ../../../config.mak.uname --include ../../../config.mak.autogen --include ../../../config.mak +git-credential-osxkeychain: + cd ../../..; make contrib/credential/osxkeychain/git-credential-osxkeychainLet's not write "make", but stick to $(MAKE), perhaps like
$(MAKE) -C ../../.. contrib/credential/osxkeychain/$@
Quoted 8 lines
contrib/credential/osxkeychain/Makefile line 11
Quoted 6 lines
contrib/credential/osxkeychain/Makefile +3
-1+install: + cd ../../..; make install-git-credential-osxkeychain clean: - $(RM) git-credential-osxkeychain git-credential-osxkeychain.o + cd ../../..; make clean-git-credential-osxkeychainLikewise.
Thank you for the review. I'll apply these changes and submit the next iteration soon.
--
Koji Nakamaru
PATCH v2 1/1 osxkeychain: define build targets in the top-level Makefile.
In reply to Koji Nakamaru via GitGitGadgetFrom: Koji Nakamaru <[email protected]>
The fix for git-credential-osxkeychain in 4580bcd235 (osxkeychain: avoid incorrectly skipping store operation) introduced linkage with libgit.a, and its Makefile was adjusted accordingly. However, the build fails as of 864f55e190 because several macOS-specific refinements were applied to the top-level Makefile and config.mak.uname, such as:
- 363837afe7 (macOS: make Homebrew use configurable, 2025-12-24)
- cee341e9dd (macOS: use iconv from Homebrew if needed and present,
2025-12-24)
- d281241518 (utf8.c: enable workaround for iconv under macOS 14/15,
2026-01-12)Since libgit.a and its corresponding header files depend on many flags defined in the top-level Makefile, these flags must be consistently defined when building git-credential-osxkeychain. Continuing to manually adjust the git-credential-osxkeychain Makefile is cumbersome and fragile.
Define the build targets for git-credential-osxkeychain in the top-level Makefile and modify its local Makefile to simply rely on those targets.
---
osxkeychain: define build targets in the top-level Makefile.
Changes since v1:
* Use $(MAKE) -C to build targets in the top-level Makefile.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2046%2FKojiNakamaru%2Ffix%2Fosxkeychain-makefile-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2046
Range-diff vs v1:
1: 0aa80d1d17 ! 1: 8c5d75f0c6 osxkeychain: define build targets in the top-level Makefile.
@@ Commit message
Define the build targets for git-credential-osxkeychain in the top-level
Makefile and modify its local Makefile to simply rely on those targets.
+ Helped-by: Junio C Hamano <[email protected]>
Signed-off-by: Koji Nakamaru <[email protected]>
## Makefile ##
@@ contrib/credential/osxkeychain/Makefile
--include ../../../config.mak.autogen
--include ../../../config.mak
+git-credential-osxkeychain:
-+ cd ../../..; make contrib/credential/osxkeychain/git-credential-osxkeychain
++ $(MAKE) -C ../../.. contrib/credential/osxkeychain/git-credential-osxkeychain
-ifdef ZLIB_NG
- BASIC_CFLAGS += -DHAVE_ZLIB_NG
@@ contrib/credential/osxkeychain/Makefile
-../../../libgit.a:
- cd ../../..; make libgit.a
+install:
-+ cd ../../..; make install-git-credential-osxkeychain
++ $(MAKE) -C ../../.. install-git-credential-osxkeychain
clean:
- $(RM) git-credential-osxkeychain git-credential-osxkeychain.o
-+ cd ../../..; make clean-git-credential-osxkeychain
++ $(MAKE) -C ../../.. clean-git-credential-osxkeychain
-.PHONY: all install clean
+.PHONY: all git-credential-osxkeychain install cleanMakefile | 17 +++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 23 insertions(+), 59 deletions(-)
Makefile +17 -0
@@ -4060,3 +4060,20 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT) $(AR) $(ARFLAGS) $@ $^ + +contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \ + $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation + +contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< + +install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + $(INSTALL) $(INSTALL_STRIP) $< '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + +.PHONY: clean-git-credential-osxkeychain +clean-git-credential-osxkeychain: + $(RM) \ + contrib/credential/osxkeychain/git-credential-osxkeychain \ + contrib/credential/osxkeychain/git-credential-osxkeychain.o
contrib/credential/osxkeychain/Makefile +6 -59
72 lines not on this page · raw message
base-commit: 864f55e1906897b630333675a52874c0fec2a45c
Signature · 1 line
gitgitgadget
Quoted 2 lines · Koji Nakamaru via GitGitGadget
-+ cd ../../..; make install-git-credential-osxkeychain
++ $(MAKE) -C ../../.. install-git-credential-osxkeychainWill replace and mark for 'next'. Will squash the double spaces after "-C" into one while doing so.
Thanks.
Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Koji Nakamaru via GitGitGadget
-+ cd ../../..; make install-git-credential-osxkeychain
++ $(MAKE) -C ../../.. install-git-credential-osxkeychainWill replace and mark for 'next'. Will squash the double spaces after "-C" into one while doing so.
Thank you again for the squash and for marking it for 'next'.
--
Koji Nakamaru
Quoted 8 lines · Koji Nakamaru
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Koji Nakamaru via GitGitGadget
-+ cd ../../..; make install-git-credential-osxkeychain
++ $(MAKE) -C ../../.. install-git-credential-osxkeychain
Quoted 8 lines
Quoted 2 lines
Will replace and mark for 'next'. Will squash the double spaces after "-C" into one while doing so.
Thank you again for the squash and for marking it for 'next'.
--
Koji Nakamaru
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
Signature · 1 line
D. Ben Knoble
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1
I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
Quoted 28 lines · Koji Nakamaru
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source git
Quoted 5 lines
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build from source. So just
brew upgrade git
built 2.53.0 + patches from source. "brew --version" says I have "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line, so I'm not sure off-hand if that includes the core tap version or not anymore.
I ended up having to use brew upgrade --debug git, fix the build error ("mkdir …") and manually perform a few steps when it arose, etc.
Signature · 1 line
D. Ben Knoble
Quoted 39 lines · D. Ben Knoble
Quoted 28 lines · Koji Nakamaru
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source gitQuoted 5 lines
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build from source. So just
Quoted 6 lines
brew upgrade git
built 2.53.0 + patches from source. "brew --version" says I have "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line, so I'm not sure off-hand if that includes the core tap version or not anymore.
To rule out differing versions, I also diff'd the Homebrew formula from GitHub against "brew edit git", and the only difference is the bottle stanza on GitHub.
Quoted 2 lines
I ended up having to use
brew upgrade --debug git, fix the build error ("mkdir …") and manually perform a few steps when it arose, etc.
Signature · 1 line
D. Ben Knoble
Quoted 43 lines · D. Ben Knoble
Quoted 41 lines · D. Ben Knoble
Quoted 28 lines · Koji Nakamaru
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source gitQuoted 5 lines
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build from source. So just
brew upgrade git
Quoted 11 lines
Quoted 4 lines
built 2.53.0 + patches from source. "brew --version" says I have "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line, so I'm not sure off-hand if that includes the core tap version or not anymore.
To rule out differing versions, I also diff'd the Homebrew formula from GitHub against "brew edit git", and the only difference is the bottle stanza on GitHub.
Quoted 2 lines
I ended up having to use
brew upgrade --debug git, fix the build error ("mkdir …") and manually perform a few steps when it arose, etc.
Thank you for the details. The current Makefile rule performs the following to generate dependency files
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
$(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
where the compiler implicitly creates contrib/credential/osxkeychain/.depend/ if it doesn't exist. This behavior seems to be supported at least since Apple clang 15.0.0. The following should work for older versions of clang that might not support this behavior.
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
@mkdir -p contrib/credential/osxkeychain/.depend $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Can you try this modification in your environment? You can confirm whether this works as below.
git clone https://github.com/git/git.git
cd git
git checkout v2.53.0
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
| patch
# The next should fail in your environment.
make contrib/credential/osxkeychain/git-credential-osxkeychain
# Please edit Makefile as described and try again. This should
# succeed. make contrib/credential/osxkeychain/git-credential-osxkeychain
--
Koji Nakamaru
Quoted 60 lines · Koji Nakamaru
Quoted 43 lines · D. Ben Knoble
Quoted 41 lines · D. Ben Knoble
Quoted 28 lines · Koji Nakamaru
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source gitQuoted 5 lines
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build from source. So just
brew upgrade git
Quoted 11 lines
Quoted 4 lines
built 2.53.0 + patches from source. "brew --version" says I have "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line, so I'm not sure off-hand if that includes the core tap version or not anymore.
To rule out differing versions, I also diff'd the Homebrew formula from GitHub against "brew edit git", and the only difference is the bottle stanza on GitHub.
Quoted 2 lines
I ended up having to use
brew upgrade --debug git, fix the build error ("mkdir …") and manually perform a few steps when it arose, etc.Thank you for the details. The current
Makefilerule performs the following to generate dependency files
Quoted 8 lines
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.cGIT-CFLAGS$(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
where the compiler implicitly creates contrib/credential/osxkeychain/.depend/ if it doesn't exist. This behavior seems to be supported at least since Apple clang 15.0.0.
Aha! I have clang 13. That probably explains it.
Quoted 10 lines
The
following should work for older versions of clang that might not support this behavior.
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.cGIT-CFLAGS
@mkdir -p contrib/credential/osxkeychain/.depend $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
Quoted 8 lines
Can you try this modification in your environment? You can confirm whether this works as below.
git clone https://github.com/git/git.git
cd git
git checkout v2.53.0
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
| patch
Using git-am worked (patch doesn't apply it)
Quoted 2 lines
# The next should fail in your environment.
make contrib/credential/osxkeychain/git-credential-osxkeychain
Fails as stated.
Quoted 3 lines
# Please edit
Makefileas described and try again. This should# succeed. make contrib/credential/osxkeychain/git-credential-osxkeychain
With the (now obvious!) proposal, indeed succeeds.
Thanks!
Signature · 1 line
D. Ben Knoble
Quoted 99 lines · D. Ben Knoble
Quoted 60 lines · Koji Nakamaru
Quoted 43 lines · D. Ben Knoble
Quoted 41 lines · D. Ben Knoble
Quoted 28 lines · Koji Nakamaru
Quoted 7 lines · D. Ben Knoble
...
Homebrew picked this patch on top of 2.53.0, and on a recent build on older macOS I needed to
mkdir contrib/credential/osxkeychain/.depend
Quoted 8 lines
in order to make their build work, since otherwise:
error: error opening
'contrib/credential/osxkeychain/.depend/git-credential-osxkeychain.o.d':
No such file or directory
1 error generated.
make[1]: ***
[contrib/credential/osxkeychain/git-credential-osxkeychain.o] Error 1I tried to reproduce this using the current Homebrew formula for git [1] on macOS 15.7.4 and 14.8.4 (both relatively newer) with the following steps:
brew tap --force homebrew/core cd "$(brew --repository homebrew/core)" git checkout -B main origin/main git pull HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall --build-from-source gitQuoted 5 lines
In my environment, the build finished successfully. The patch doesn't seem to trigger any issues during a local "make" either. How exactly are you performing your build?
macOS 12.7.6 ;) hence tier 3 Homebrew support + all packages build from source. So just
brew upgrade git
Quoted 11 lines
Quoted 4 lines
built 2.53.0 + patches from source. "brew --version" says I have "Homebrew 5.0.14-59-g45db1ce"; it doesn't print a homebrew-core line, so I'm not sure off-hand if that includes the core tap version or not anymore.
To rule out differing versions, I also diff'd the Homebrew formula from GitHub against "brew edit git", and the only difference is the bottle stanza on GitHub.
Quoted 2 lines
I ended up having to use
brew upgrade --debug git, fix the build error ("mkdir …") and manually perform a few steps when it arose, etc.Thank you for the details. The current
Makefilerule performs the following to generate dependency filesQuoted 8 lines
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.cGIT-CFLAGS$(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
where the compiler implicitly creates contrib/credential/osxkeychain/.depend/ if it doesn't exist. This behavior seems to be supported at least since Apple clang 15.0.0.
Aha! I have clang 13. That probably explains it.
Quoted 10 lines
The
following should work for older versions of clang that might not support this behavior.
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.cGIT-CFLAGS
@mkdir -p contrib/credential/osxkeychain/.depend $(QUIET_CC)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<Quoted 8 lines
Can you try this modification in your environment? You can confirm whether this works as below.
git clone https://github.com/git/git.git
cd git
git checkout v2.53.0
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/46d746f92167fd0559af22f4ccb79c9ff35fbe33/Patches/git/2.53.0-osxkeychain-top-level-makefile.patch
| patchUsing git-am worked (patch doesn't apply it)
Quoted 2 lines
# The next should fail in your environment.
make contrib/credential/osxkeychain/git-credential-osxkeychainFails as stated.
Quoted 7 lines
Quoted 3 lines
# Please edit
Makefileas described and try again. This should# succeed. make contrib/credential/osxkeychain/git-credential-osxkeychainWith the (now obvious!) proposal, indeed succeeds.
Thanks!
Thank you for testing the modification. I'll submit an updated patch later and also submit it to homebrew (for the current 2.53.0).
--
Koji Nakamaru
PATCH v3 1/1 osxkeychain: define build targets in the top-level Makefile.
In reply to Koji Nakamaru via GitGitGadgetFrom: Koji Nakamaru <[email protected]>
The fix for git-credential-osxkeychain in 4580bcd235 (osxkeychain: avoid incorrectly skipping store operation) introduced linkage with libgit.a, and its Makefile was adjusted accordingly. However, the build fails as of 864f55e190 because several macOS-specific refinements were applied to the top-level Makefile and config.mak.uname, such as:
- 363837afe7 (macOS: make Homebrew use configurable, 2025-12-24)
- cee341e9dd (macOS: use iconv from Homebrew if needed and present,
2025-12-24)
- d281241518 (utf8.c: enable workaround for iconv under macOS 14/15,
2026-01-12)Since libgit.a and its corresponding header files depend on many flags defined in the top-level Makefile, these flags must be consistently defined when building git-credential-osxkeychain. Continuing to manually adjust the git-credential-osxkeychain Makefile is cumbersome and fragile.
Define the build targets for git-credential-osxkeychain in the top-level Makefile and modify its local Makefile to simply rely on those targets.
---
osxkeychain: define build targets in the top-level Makefile.
Changes since v2:
* Squash the double spaces after "-C" into one white.
* Add explicit mkdir -p contrib/credential/osxkeychain/.depend for older versions of clang.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2046%2FKojiNakamaru%2Ffix%2Fosxkeychain-makefile-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/2046
Range-diff vs v2:
1: 8c5d75f0c6 ! 1: 25a66e1b7d osxkeychain: define build targets in the top-level Makefile.
@@ Commit message
Makefile and modify its local Makefile to simply rely on those targets.
Helped-by: Junio C Hamano <[email protected]>
+ Reported-by: D. Ben Knoble <[email protected]>
Signed-off-by: Koji Nakamaru <[email protected]>
## Makefile ##
@@ Makefile: $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
+ $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation
+
+contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
++ @mkdir -p contrib/credential/osxkeychain/.depend
+ $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
+
+install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain
@@ contrib/credential/osxkeychain/Makefile
--include ../../../config.mak.autogen
--include ../../../config.mak
+git-credential-osxkeychain:
-+ $(MAKE) -C ../../.. contrib/credential/osxkeychain/git-credential-osxkeychain
++ $(MAKE) -C ../../.. contrib/credential/osxkeychain/git-credential-osxkeychain
-ifdef ZLIB_NG
- BASIC_CFLAGS += -DHAVE_ZLIB_NG
@@ contrib/credential/osxkeychain/Makefile
-../../../libgit.a:
- cd ../../..; make libgit.a
+install:
-+ $(MAKE) -C ../../.. install-git-credential-osxkeychain
++ $(MAKE) -C ../../.. install-git-credential-osxkeychain
clean:
- $(RM) git-credential-osxkeychain git-credential-osxkeychain.o
-+ $(MAKE) -C ../../.. clean-git-credential-osxkeychain
++ $(MAKE) -C ../../.. clean-git-credential-osxkeychain
-.PHONY: all install clean
+.PHONY: all git-credential-osxkeychain install cleanMakefile | 18 +++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 24 insertions(+), 59 deletions(-)
Makefile +18 -0
@@ -4060,3 +4060,21 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT) $(AR) $(ARFLAGS) $@ $^ + +contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \ + $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation + +contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + @mkdir -p contrib/credential/osxkeychain/.depend + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< + +install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + $(INSTALL) $(INSTALL_STRIP) $< '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + +.PHONY: clean-git-credential-osxkeychain +clean-git-credential-osxkeychain: + $(RM) \ + contrib/credential/osxkeychain/git-credential-osxkeychain \ + contrib/credential/osxkeychain/git-credential-osxkeychain.o
contrib/credential/osxkeychain/Makefile +6 -59
72 lines not on this page · raw message
base-commit: 864f55e1906897b630333675a52874c0fec2a45c
Signature · 1 line
gitgitgadget
Quoted 4 lines · Koji Nakamaru via GitGitGadget
From: Koji Nakamaru <[email protected]>
The fix for git-credential-osxkeychain in
4580bcd235(osxkeychain: avoid incorrectly skipping store operation) introduced linkage with libgit.a,
Nitpick: Commit references should have the date:
4580bcd235 (osxkeychain: avoid incorrectly skipping store operation, 2025-11-14)
Like the rest of the commits you reference here.
Quoted 10 lines
and its
Makefilewas adjusted accordingly. However, the build fails as of864f55e190because several macOS-specific refinements were applied to the top-levelMakefileand config.mak.uname, such as:-
363837afe7(macOS: make Homebrew use configurable, 2025-12-24)
-cee341e9dd(macOS: use iconv from Homebrew if needed and present,2025-12-24) - d281241518 (utf8.c: enable workaround for iconv under macOS 14/15, 2026-01-12)[snip]
Quoted 4 lines · Kristoffer Haugsbakk
Quoted 2 lines · Koji Nakamaru via GitGitGadget
From: Koji Nakamaru <[email protected]>
Quoted 19 lines
Quoted 2 lines
The fix for git-credential-osxkeychain in
4580bcd235(osxkeychain: avoid incorrectly skipping store operation) introduced linkage with libgit.a,Nitpick: Commit references should have the date:
4580bcd235 (osxkeychain: avoid incorrectly skipping store operation, 2025-11-14)Like the rest of the commits you reference here.
Quoted 10 lines
and its
Makefilewas adjusted accordingly. However, the build fails as of864f55e190because several macOS-specific refinements were applied to the top-levelMakefileand config.mak.uname, such as:-
363837afe7(macOS: make Homebrew use configurable, 2025-12-24)
-cee341e9dd(macOS: use iconv from Homebrew if needed and present,2025-12-24) - d281241518 (utf8.c: enable workaround for iconv under macOS 14/15, 2026-01-12)[snip]
I see. I'll fix the commit message in the next reroll.
--
Koji Nakamaru
Makefile $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) · line 4070
Quoted 3 lines · Koji Nakamaru via GitGitGadget
Makefile +3
-0+contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + @mkdir -p contrib/credential/osxkeychain/.depend + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
I notice that many other places in the Makefile we seem to use $(call mkdir_p_parent_template). Do we want to do so here, too?
Other than that, looking good. Thanks for updating.
Quoted 11 lines · Junio C Hamano
Makefile $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) · line 4070
Quoted 3 lines · Koji Nakamaru via GitGitGadget
Makefile +3
-0+contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + @mkdir -p contrib/credential/osxkeychain/.depend + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<I notice that many other places in the
Makefilewe seem to use $(callmkdir_p_parent_template). Do we want to do so here, too?Other than that, looking good. Thanks for updating.
$(call mkdir_p_parent_tempate) seems to be used for creating the target's parent directory (e.g., creating po/build/locale/bg/LC_MESSAGES/ for po/build/locale/bg/LC_MESSAGES/git.mo).
Since .depend directories are handled via dep_dirs in this Makefile, how about the following change for consistency?
diff --git a/Makefile b/Makefile index 1c2019a4cb..47485004d8 100644 --- a/Makefile +++ b/Makefile @@ -2876,6 +2876,10 @@ objects: $(OBJECTS) dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
+ifeq ($(uname_S),Darwin)
+ dep_dirs += $(addsuffix .depend,$(sort $(dircontrib/credential/osxkeychain/git-credential-osxkeychain.o)))
+endif
+
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes) $(dep_dirs):
@mkdir -p $@
@@ -4066,7 +4070,6 @@
contrib/credential/osxkeychain/git-credential-osxkeychain:
contrib/credential/os
$(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security-framework CoreFoundation
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
- @mkdir -p contrib/credential/osxkeychain/.depend
$(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args)
$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
install-git-credential-osxkeychain:
contrib/credential/osxkeychain/git-credential-osxkeychain
--
Koji Nakamaru
Quoted 2 lines · Koji Nakamaru
Since .depend directories are handled via
dep_dirsin thisMakefile, how about the following change for consistency?
Sounds good. Thanks for spotting.
Quoted 34 lines
diff --git a/Makefile b/Makefile index 1c2019a4cb..47485004d8 100644 --- a/Makefile +++ b/Makefile @@ -2876,6 +2876,10 @@ objects: $(OBJECTS) dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))+ifeq ($(uname_S),Darwin)
+dep_dirs+= $(addsuffix .depend,$(sort $(dircontrib/credential/osxkeychain/git-credential-osxkeychain.o)))
+endif
+
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes) $(dep_dirs):@mkdir -p $@ @@ -4066,7 +4070,6 @@ contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/os $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security-framework CoreFoundation
contrib/credential/osxkeychain/git-credential-osxkeychain.o:contrib/credential/osxkeychain/git-credential-osxkeychain.cGIT-CFLAGS
- @mkdir -p contrib/credential/osxkeychain/.depend$(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args)$(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
install-git-credential-osxkeychain:
contrib/credential/osxkeychain/git-credential-osxkeychain--
Koji Nakamaru
PATCH v4 1/1 osxkeychain: define build targets in the top-level Makefile.
In reply to Koji Nakamaru via GitGitGadgetFrom: Koji Nakamaru <[email protected]>
The fix for git-credential-osxkeychain in 4580bcd235 (osxkeychain: avoid incorrectly skipping store operation, 2025-11-14) introduced linkage with libgit.a, and its Makefile was adjusted accordingly. However, the build fails as of 864f55e190 because several macOS-specific refinements were applied to the top-level Makefile and config.mak.uname, such as:
- 363837afe7 (macOS: make Homebrew use configurable, 2025-12-24)
- cee341e9dd (macOS: use iconv from Homebrew if needed and present,
2025-12-24)
- d281241518 (utf8.c: enable workaround for iconv under macOS 14/15,
2026-01-12)Since libgit.a and its corresponding header files depend on many flags defined in the top-level Makefile, these flags must be consistently defined when building git-credential-osxkeychain. Continuing to manually adjust the git-credential-osxkeychain Makefile is cumbersome and fragile.
Define the build targets for git-credential-osxkeychain in the top-level Makefile and modify its local Makefile to simply rely on those targets.
---
osxkeychain: define build targets in the top-level Makefile.
Changes since v3:
* Add missing commit reference date.
* Use dep_dirs to create contrib/credential/osxkeychain/.depend.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2046%2FKojiNakamaru%2Ffix%2Fosxkeychain-makefile-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2046/KojiNakamaru/fix/osxkeychain-makefile-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/2046
Range-diff vs v3:
1: 25a66e1b7d ! 1: 3c36804348 osxkeychain: define build targets in the top-level Makefile.
@@ Commit message
osxkeychain: define build targets in the top-level Makefile.
The fix for git-credential-osxkeychain in 4580bcd235 (osxkeychain: avoid
- incorrectly skipping store operation) introduced linkage with libgit.a,
- and its Makefile was adjusted accordingly. However, the build fails as
- of 864f55e190 because several macOS-specific refinements were applied to
- the top-level Makefile and config.mak.uname, such as:
+ incorrectly skipping store operation, 2025-11-14) introduced linkage
+ with libgit.a, and its Makefile was adjusted accordingly. However, the
+ build fails as of 864f55e190 because several macOS-specific refinements
+ were applied to the top-level Makefile and config.mak.uname, such as:
- 363837afe7 (macOS: make Homebrew use configurable, 2025-12-24)
- cee341e9dd (macOS: use iconv from Homebrew if needed and present,
@@ Commit message
+ Helped-by: Kristoffer Haugsbakk <[email protected]>
## Makefile ##
+@@ Makefile: objects: $(OBJECTS)
+ dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
+ dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS)))) +
++ifeq ($(uname_S),Darwin)
++ dep_dirs += $(addsuffix .depend,$(sort $(dir contrib/credential/osxkeychain/git-credential-osxkeychain.o)))
++endif
++
+ ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
+ $(dep_dirs):
+ @mkdir -p $@
@@ Makefile: $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
@@ Makefile: $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
+ $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation
+
+contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
-+ @mkdir -p contrib/credential/osxkeychain/.depend
+ $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
+
+install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain
Makefile | 21 ++++++++ contrib/credential/osxkeychain/Makefile | 65 +++---------------------- 2 files changed, 27 insertions(+), 59 deletions(-)
Makefile +21 -0
@@ -2876,6 +2876,10 @@ objects: $(OBJECTS) dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS)))) +ifeq ($(uname_S),Darwin) + dep_dirs += $(addsuffix .depend,$(sort $(dir contrib/credential/osxkeychain/git-credential-osxkeychain.o))) +endif + ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes) $(dep_dirs): @mkdir -p $@
@@ -4060,3 +4064,20 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT) contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT) $(AR) $(ARFLAGS) $@ $^ + +contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \ + $(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation + +contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS + $(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $< + +install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + $(INSTALL) $(INSTALL_STRIP) $< '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' + +.PHONY: clean-git-credential-osxkeychain +clean-git-credential-osxkeychain: + $(RM) \ + contrib/credential/osxkeychain/git-credential-osxkeychain \ + contrib/credential/osxkeychain/git-credential-osxkeychain.o
contrib/credential/osxkeychain/Makefile +6 -59
72 lines not on this page · raw message
base-commit: 864f55e1906897b630333675a52874c0fec2a45c
Signature · 1 line
gitgitgadget