Skip to content

Commit 3e9cc24

Browse files
KojiNakamarugitster
authored andcommitted
osxkeychain: define build targets in the top-level Makefile.
The fix for git-credential-osxkeychain in 4580bcd (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 864f55e because several macOS-specific refinements were applied to the top-level Makefile and config.mak.uname, such as: - 363837a (macOS: make Homebrew use configurable, 2025-12-24) - cee341e (macOS: use iconv from Homebrew if needed and present, 2025-12-24) - d281241 (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. Helped-by: Junio C Hamano <gitster@pobox.com> Reported-by: D. Ben Knoble <ben.knoble@gmail.com> Helped-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 67ad421 commit 3e9cc24

2 files changed

Lines changed: 27 additions & 59 deletions

File tree

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,10 @@ objects: $(OBJECTS)
28742874
dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
28752875
dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))
28762876

2877+
ifeq ($(uname_S),Darwin)
2878+
dep_dirs += $(addsuffix .depend,$(sort $(dir contrib/credential/osxkeychain/git-credential-osxkeychain.o)))
2879+
endif
2880+
28772881
ifeq ($(COMPUTE_HEADER_DEPENDENCIES),yes)
28782882
$(dep_dirs):
28792883
@mkdir -p $@
@@ -4058,3 +4062,20 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
40584062

40594063
contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
40604064
$(AR) $(ARFLAGS) $@ $^
4065+
4066+
contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS
4067+
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
4068+
$(filter %.o,$^) $(LIB_FILE) $(EXTLIBS) -framework Security -framework CoreFoundation
4069+
4070+
contrib/credential/osxkeychain/git-credential-osxkeychain.o: contrib/credential/osxkeychain/git-credential-osxkeychain.c GIT-CFLAGS
4071+
$(QUIET_LINK)$(CC) -o $@ -c $(dep_args) $(compdb_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<
4072+
4073+
install-git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain
4074+
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
4075+
$(INSTALL) $(INSTALL_STRIP) $< '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
4076+
4077+
.PHONY: clean-git-credential-osxkeychain
4078+
clean-git-credential-osxkeychain:
4079+
$(RM) \
4080+
contrib/credential/osxkeychain/git-credential-osxkeychain \
4081+
contrib/credential/osxkeychain/git-credential-osxkeychain.o
Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,13 @@
11
# The default target of this Makefile is...
22
all:: git-credential-osxkeychain
33

4-
include ../../../config.mak.uname
5-
-include ../../../config.mak.autogen
6-
-include ../../../config.mak
4+
git-credential-osxkeychain:
5+
$(MAKE) -C ../../.. contrib/credential/osxkeychain/git-credential-osxkeychain
76

8-
ifdef ZLIB_NG
9-
BASIC_CFLAGS += -DHAVE_ZLIB_NG
10-
ifdef ZLIB_NG_PATH
11-
BASIC_CFLAGS += -I$(ZLIB_NG_PATH)/include
12-
EXTLIBS += $(call libpath_template,$(ZLIB_NG_PATH)/$(lib))
13-
endif
14-
EXTLIBS += -lz-ng
15-
else
16-
ifdef ZLIB_PATH
17-
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
18-
EXTLIBS += $(call libpath_template,$(ZLIB_PATH)/$(lib))
19-
endif
20-
EXTLIBS += -lz
21-
endif
22-
ifndef NO_ICONV
23-
ifdef NEEDS_LIBICONV
24-
ifdef ICONVDIR
25-
BASIC_CFLAGS += -I$(ICONVDIR)/include
26-
ICONV_LINK = $(call libpath_template,$(ICONVDIR)/$(lib))
27-
else
28-
ICONV_LINK =
29-
endif
30-
ifdef NEEDS_LIBINTL_BEFORE_LIBICONV
31-
ICONV_LINK += -lintl
32-
endif
33-
EXTLIBS += $(ICONV_LINK) -liconv
34-
endif
35-
endif
36-
ifndef LIBC_CONTAINS_LIBINTL
37-
EXTLIBS += -lintl
38-
endif
39-
40-
prefix ?= /usr/local
41-
gitexecdir ?= $(prefix)/libexec/git-core
42-
43-
CC ?= gcc
44-
CFLAGS ?= -g -O2 -Wall -I../../.. $(BASIC_CFLAGS)
45-
LDFLAGS ?= $(BASIC_LDFLAGS) $(EXTLIBS)
46-
INSTALL ?= install
47-
RM ?= rm -f
48-
49-
%.o: %.c
50-
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
51-
52-
git-credential-osxkeychain: git-credential-osxkeychain.o ../../../libgit.a
53-
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) \
54-
-framework Security -framework CoreFoundation
55-
56-
install: git-credential-osxkeychain
57-
$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
58-
$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)
59-
60-
../../../libgit.a:
61-
cd ../../..; make libgit.a
7+
install:
8+
$(MAKE) -C ../../.. install-git-credential-osxkeychain
629

6310
clean:
64-
$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
11+
$(MAKE) -C ../../.. clean-git-credential-osxkeychain
6512

66-
.PHONY: all install clean
13+
.PHONY: all git-credential-osxkeychain install clean

0 commit comments

Comments
 (0)