threads / patch / 64295

patchcontrib/credential: Amend and harmonize Makefiles

Subject: [PATCH] contrib/credential: Amend and harmonize Makefiles

## tl;dr

8 messages between Oct 10, 2025 and Oct 20, 2025. Diffs are folded; open one to read it.

replies: 7people: 2as markdown or json

Thomas Uhle· Oct 10, 2025, 17:30 UTC · lore
Update these Makefiles to be in line with other Makefiles from contrib
such as for contacts or subtree by making the following changes:
* Make the default settings after including config.mak.autogen and
   config.mak.
* Add the missing $(CPPFLAGS) to the compiler command as well as the
   missing $(CFLAGS) to the linker command.
* Use a pattern rule for compilation instead of a dedicated rule for
   each compile unit.
* Add an install target rule.
* Strip @ from $(RM) to let the clean target rule be verbose.
* Define .PHONY for all special targets (all, clean, install).
Signed-off-by: Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de>
---
  contrib/credential/libsecret/Makefile   | 30 ++++++++++++++-------
  contrib/credential/osxkeychain/Makefile | 36 ++++++++++++++++++-------
  2 files changed, 46 insertions(+), 20 deletions(-)
Show changes to 2 files +46 −20

contrib/credential/libsecret/Makefile, contrib/credential/osxkeychain/Makefile

diff --git a/contrib/credential/libsecret/Makefile b/contrib/credential/libsecret/Makefile
index 97ce9c9..8ee6cce 100644
--- a/contrib/credential/libsecret/Makefile
+++ b/contrib/credential/libsecret/Makefile
@@ -1,17 +1,21 @@
  # The default target of this Makefile is...
  all::

-MAIN:=git-credential-libsecret
-all:: $(MAIN)
-
-CC = gcc
-RM = rm -f
-CFLAGS = -g -O2 -Wall
-PKG_CONFIG = pkg-config
-
  -include ../../../config.mak.autogen
  -include ../../../config.mak

+prefix ?= /usr/local
+gitexecdir ?= $(prefix)/libexec/git-core
+
+CC ?= gcc
+CFLAGS ?= -g -O2 -Wall
+PKG_CONFIG ?= pkg-config
+INSTALL ?= install
+RM ?= rm -f
+
+MAIN:=git-credential-libsecret
+all:: $(MAIN)
+
  INCS:=$(shell $(PKG_CONFIG) --cflags libsecret-1 glib-2.0)
  LIBS:=$(shell $(PKG_CONFIG) --libs libsecret-1 glib-2.0)

@@ -22,7 +26,13 @@ OBJS:=$(SRCS:.c=.o)
  	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $@ -c $<

  $(MAIN): $(OBJS)
-	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
+
+install: $(MAIN)
+	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
+	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)

  clean:
-	@$(RM) $(MAIN) $(OBJS)
+	$(RM) $(MAIN) $(OBJS)
+
+.PHONY: all install clean
diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
index 0948297..b1d7c29 100644
--- a/contrib/credential/osxkeychain/Makefile
+++ b/contrib/credential/osxkeychain/Makefile
@@ -1,19 +1,35 @@
  # The default target of this Makefile is...
-all:: git-credential-osxkeychain
-
-CC = gcc
-RM = rm -f
-CFLAGS = -g -O2 -Wall
+all::

  -include ../../../config.mak.autogen
  -include ../../../config.mak

-git-credential-osxkeychain: git-credential-osxkeychain.o
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) \
+prefix ?= /usr/local
+gitexecdir ?= $(prefix)/libexec/git-core
+
+CC ?= gcc
+CFLAGS ?= -g -O2 -Wall
+INSTALL ?= install
+RM ?= rm -f
+
+MAIN:=git-credential-osxkeychain
+all:: $(MAIN)
+
+SRCS:=$(MAIN).c
+OBJS:=$(SRCS:.c=.o)
+
+%.o: %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
+$(MAIN): $(OBJS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) \
  		-framework Security -framework CoreFoundation

-git-credential-osxkeychain.o: git-credential-osxkeychain.c
-	$(CC) -c $(CFLAGS) $<
+install: $(MAIN)
+	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
+	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)

  clean:
-	$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
+	$(RM) $(MAIN) $(OBJS)
+
+.PHONY: all install clean

base-commit: 60f3f52f17cceefa5299709b189ce6fe2d181e7b
-- 
2.47.3
Junio C Hamano· Oct 10, 2025, 19:45 UTC · re: Thomas Uhle · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
Show 50 quoted lines
> diff --git a/contrib/credential/libsecret/Makefile b/contrib/credential/libsecret/Makefile
> index 97ce9c9..8ee6cce 100644
> --- a/contrib/credential/libsecret/Makefile
> +++ b/contrib/credential/libsecret/Makefile
> @@ -1,17 +1,21 @@
>   # The default target of this Makefile is...
>   all::
>
> -MAIN:=git-credential-libsecret
> -all:: $(MAIN)
> -
> -CC = gcc
> -RM = rm -f
> -CFLAGS = -g -O2 -Wall
> -PKG_CONFIG = pkg-config
> -
>   -include ../../../config.mak.autogen
>   -include ../../../config.mak
>
> +prefix ?= /usr/local
> +gitexecdir ?= $(prefix)/libexec/git-core
> +
> +CC ?= gcc
> +CFLAGS ?= -g -O2 -Wall
> +PKG_CONFIG ?= pkg-config
> +INSTALL ?= install
> +RM ?= rm -f
> +
> +MAIN:=git-credential-libsecret
> +all:: $(MAIN)
> +
>   INCS:=$(shell $(PKG_CONFIG) --cflags libsecret-1 glib-2.0)
>   LIBS:=$(shell $(PKG_CONFIG) --libs libsecret-1 glib-2.0)
>
> @@ -22,7 +26,13 @@ OBJS:=$(SRCS:.c=.o)
>   	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $@ -c $<
>
>   $(MAIN): $(OBJS)
> -	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
> +
> +install: $(MAIN)
> +	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
> +	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)
>
>   clean:
> -	@$(RM) $(MAIN) $(OBJS)
> +	$(RM) $(MAIN) $(OBJS)
> +
> +.PHONY: all install clean
Show 7 quoted lines
> diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
> index 0948297..b1d7c29 100644
> --- a/contrib/credential/osxkeychain/Makefile
> +++ b/contrib/credential/osxkeychain/Makefile
> @@ -1,19 +1,35 @@
>   # The default target of this Makefile is...
> -all:: git-credential-osxkeychain

Having the primary target name on this line very early in the file has documentation value.

Show 20 quoted lines
> -CC = gcc
> -RM = rm -f
> -CFLAGS = -g -O2 -Wall
> +all::
>
>   -include ../../../config.mak.autogen
>   -include ../../../config.mak
>
> -git-credential-osxkeychain: git-credential-osxkeychain.o
> -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) \
> +prefix ?= /usr/local
> +gitexecdir ?= $(prefix)/libexec/git-core
> +
> +CC ?= gcc
> +CFLAGS ?= -g -O2 -Wall
> +INSTALL ?= install
> +RM ?= rm -f
> +
> +MAIN:=git-credential-osxkeychain
> +all:: $(MAIN)

What's the point of an extra $(MAIN) definition (not just here but in the other Makefile as well)? It may be slightly convenient to write while the thing is simple and stays one-source-one-binary, but programs including Makefiles are more often read than written, so we should optimize them for readers. I personally think this extra indirection is hurting readability more than helping.

Other than that, yes, it is great to make these three or four Makefiles look similar to allow readers compare and spot differences.

Thanks.
Show 24 quoted lines
> +
> +SRCS:=$(MAIN).c
> +OBJS:=$(SRCS:.c=.o)
> +
> +%.o: %.c
> +	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
> +
> +$(MAIN): $(OBJS)
> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) \
>   		-framework Security -framework CoreFoundation
>
> -git-credential-osxkeychain.o: git-credential-osxkeychain.c
> -	$(CC) -c $(CFLAGS) $<
> +install: $(MAIN)
> +	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
> +	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)
>
>   clean:
> -	$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
> +	$(RM) $(MAIN) $(OBJS)
> +
> +.PHONY: all install clean
>
> base-commit: 60f3f52f17cceefa5299709b189ce6fe2d181e7b
Thomas Uhle· Oct 10, 2025, 21:03 UTC · re: Junio C Hamano · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

On Fri, 10 Oct 2025, Junio C Hamano wrote:
Show 64 quoted lines
> Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
>
>> diff --git a/contrib/credential/libsecret/Makefile b/contrib/credential/libsecret/Makefile
>> index 97ce9c9..8ee6cce 100644
>> --- a/contrib/credential/libsecret/Makefile
>> +++ b/contrib/credential/libsecret/Makefile
>> @@ -1,17 +1,21 @@
>>   # The default target of this Makefile is...
>>   all::
>>
>> -MAIN:=git-credential-libsecret
>> -all:: $(MAIN)
>> -
>> -CC = gcc
>> -RM = rm -f
>> -CFLAGS = -g -O2 -Wall
>> -PKG_CONFIG = pkg-config
>> -
>>   -include ../../../config.mak.autogen
>>   -include ../../../config.mak
>>
>> +prefix ?= /usr/local
>> +gitexecdir ?= $(prefix)/libexec/git-core
>> +
>> +CC ?= gcc
>> +CFLAGS ?= -g -O2 -Wall
>> +PKG_CONFIG ?= pkg-config
>> +INSTALL ?= install
>> +RM ?= rm -f
>> +
>> +MAIN:=git-credential-libsecret
>> +all:: $(MAIN)
>> +
>>   INCS:=$(shell $(PKG_CONFIG) --cflags libsecret-1 glib-2.0)
>>   LIBS:=$(shell $(PKG_CONFIG) --libs libsecret-1 glib-2.0)
>>
>> @@ -22,7 +26,13 @@ OBJS:=$(SRCS:.c=.o)
>>   	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $@ -c $<
>>
>>   $(MAIN): $(OBJS)
>> -	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
>> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
>> +
>> +install: $(MAIN)
>> +	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
>> +	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)
>>
>>   clean:
>> -	@$(RM) $(MAIN) $(OBJS)
>> +	$(RM) $(MAIN) $(OBJS)
>> +
>> +.PHONY: all install clean
>
>
>> diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
>> index 0948297..b1d7c29 100644
>> --- a/contrib/credential/osxkeychain/Makefile
>> +++ b/contrib/credential/osxkeychain/Makefile
>> @@ -1,19 +1,35 @@
>>   # The default target of this Makefile is...
>> -all:: git-credential-osxkeychain
>
> Having the primary target name on this line very early in the file
> has documentation value.

I understand your point. I guess it has not been done like this in the other three Makefiles because a variable ($MAIN here) was used instead of the executable file name itself and this variable is yet defined down below.

Show 23 quoted lines
>> -CC = gcc
>> -RM = rm -f
>> -CFLAGS = -g -O2 -Wall
>> +all::
>>
>>   -include ../../../config.mak.autogen
>>   -include ../../../config.mak
>>
>> -git-credential-osxkeychain: git-credential-osxkeychain.o
>> -	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) \
>> +prefix ?= /usr/local
>> +gitexecdir ?= $(prefix)/libexec/git-core
>> +
>> +CC ?= gcc
>> +CFLAGS ?= -g -O2 -Wall
>> +INSTALL ?= install
>> +RM ?= rm -f
>> +
>> +MAIN:=git-credential-osxkeychain
>> +all:: $(MAIN)
>
> What's the point of an extra $(MAIN) definition (not just here but
> in the other Makefile as well)?

I am only guessing. git-credential-libsecret was renamed from git-credential-gnome-keyring somewhere in the past when the Gnome developers decided to dump libgnome-keyring in favour of libsecret. So it could have been convenient to change only one line in the Makefile.

Show 5 quoted lines
> It may be slightly convenient to write while the thing is simple and
> stays one-source-one-binary, but programs including Makefiles are more
> often read than written, so we should optimize them for readers.  I
> personally think this extra indirection is hurting readability more
> than helping.

I was just using $(MAIN) as a variable name because this is the variable used in the other Makefile git-credential-libsecret. Would $(GIT_CREDENTIAL_HELPER) be a better variable name?

> Other than that, yes, it is great to make these three or four
> Makefiles look similar to allow readers compare and spot
> differences.

My initial reason was just to add an install target rule because it is obviously missing. And I wanted it to do in a similar way like the other two Makefiles (for git-subtree and git-contacts). So I then ended up to reorder the lines.

> Thanks.
Thank you for the review.
Show 24 quoted lines
>> +
>> +SRCS:=$(MAIN).c
>> +OBJS:=$(SRCS:.c=.o)
>> +
>> +%.o: %.c
>> +	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
>> +
>> +$(MAIN): $(OBJS)
>> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) \
>>   		-framework Security -framework CoreFoundation
>>
>> -git-credential-osxkeychain.o: git-credential-osxkeychain.c
>> -	$(CC) -c $(CFLAGS) $<
>> +install: $(MAIN)
>> +	$(INSTALL) -d -m 755 $(DESTDIR)$(gitexecdir)
>> +	$(INSTALL) -m 755 $< $(DESTDIR)$(gitexecdir)
>>
>>   clean:
>> -	$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
>> +	$(RM) $(MAIN) $(OBJS)
>> +
>> +.PHONY: all install clean
>>
>> base-commit: 60f3f52f17cceefa5299709b189ce6fe2d181e7b
Junio C Hamano· Oct 10, 2025, 21:25 UTC · re: Thomas Uhle · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
>> Content-Type: text/plain; format=flowed; charset="US-ASCII"

Please make sure your MUA does not corrupt whitespaces by sending your e-mails with "format=flowed"

$ git am ./+tu-credential-install
warning: Patch sent with format=flowed; space at the end of lines might be lost.
Applying: contrib/credential: Amend and harmonize Makefiles
Thomas Uhle· Oct 11, 2025, 12:45 UTC · re: Junio C Hamano · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

On Fri, 10 Oct 2025, Junio C Hamano wrote:
Show 6 quoted lines
> Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
>
> >> Content-Type: text/plain; format=flowed; charset="US-ASCII"
>
> Please make sure your MUA does not corrupt whitespaces by sending
> your e-mails with "format=flowed"

Shall I simply resend the patch unchanged without "format=flowed" or has it to be a v2 patch then?

Should I also rename $(MAIN) to $(GIT_CREDENTIAL_HELPER)?
Best regards,
Thomas Uhle
Junio C Hamano· Oct 11, 2025, 17:57 UTC · re: Thomas Uhle · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
Show 11 quoted lines
> On Fri, 10 Oct 2025, Junio C Hamano wrote:
>
>> Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> writes:
>>
>> >> Content-Type: text/plain; format=flowed; charset="US-ASCII"
>>
>> Please make sure your MUA does not corrupt whitespaces by sending
>> your e-mails with "format=flowed"
>
> Shall I simply resend the patch unchanged without "format=flowed" or has 
> it to be a v2 patch then?

That was more to remind you before you actually need to send a second version (or another topic). Of course, sending an email to yourself as practice to make sure it won't come as flowed text would be a good idea, but straight resend is probably not needed. Please fetch from my 'seen' branch from any of the public mirrors, and check what is queued as ac6152f0 (contrib/credential: Amend and harmonize Makefiles, 2025-10-10) is what you expected me to have without your mailer corrupting the patch contents.

> Should I also rename $(MAIN) to $(GIT_CREDENTIAL_HELPER)?
I do not think such a change would add any value.  

If the original did not use such an intermediate macro, adding to use it may or may not have added value for "not having to repeat", but it meant that now you have to repeat MAIN over and over, need to still make sure you do not mistype it as MIAN, burdening the readers to hold in their head what $(MAIN) exactly referred to while reading the file. Makefile language does not offer warnings when you refer to an undefined macros, so using $(GIT_CREDENTIAL_HELPER) that is more prone to mistyping than $(MAIN), while it makes it slightly easier to readers to follow, would not protect you from typos. Not using a macro at all and saying "git-credential-helper" when you mean it would have the same effect.

So it smells that viable choices are only three:
 * if the original did not use $(MAIN), leave them as-is and spell
   the values (like "git-credential-osxkeychain") out.
 * if the original did use $(MAIN), leave them as-is, without rename
   it to a longer and more typo-prone $(GIT_CREDENTIAL_HELPER).  Or
 * if the original did use $(MAIN), spell the values out instead.

I prefer to do "clean-up" patches and "functional" patches separately, and introduction of the install target is the latter, so perhaps leave all the changes to Makefile macro trick out of this patch and concentrate only on the new "install" target? And then do "clean-up" using Makefile macro if you want, with merit of such a change defended separately.

Thanks.
Thomas Uhle· Oct 11, 2025, 19:18 UTC · re: Junio C Hamano · lore

Re: [PATCH] contrib/credential: Amend and harmonize Makefiles

On Sat, 11 Oct 2025, Junio C Hamano wrote:
Show 5 quoted lines
> [...]  Please
> fetch from my 'seen' branch from any of the public mirrors, and
> check what is queued as ac6152f0 (contrib/credential: Amend and
> harmonize Makefiles, 2025-10-10) is what you expected me to have
> without your mailer corrupting the patch contents.
Yes, it is correct.
Show 9 quoted lines
> [...]  So it smells that viable choices are only three:
>
> * if the original did not use $(MAIN), leave them as-is and spell
>   the values (like "git-credential-osxkeychain") out.
>
> * if the original did use $(MAIN), leave them as-is, without rename
>   it to a longer and more typo-prone $(GIT_CREDENTIAL_HELPER).  Or
>
> * if the original did use $(MAIN), spell the values out instead.

So the combination of the first and last option seems best to not keep these differences within the same context (contrib/credential). Do you agree?

Show 6 quoted lines
> I prefer to do "clean-up" patches and "functional" patches
> separately, and introduction of the install target is the latter, so
> perhaps leave all the changes to Makefile macro trick out of this
> patch and concentrate only on the new "install" target?  And then do
> "clean-up" using Makefile macro if you want, with merit of such a
> change defended separately.

Doesn't it make sense to clean up first and then add the install target rule in another patch if you prefer to split this patch? That way I could keep the first line of the commit message intact and the name of the branch you have chosen would still match. Moreover, it seems to me that we are not that far from agreeing on a "clean-up" version.

> Thanks.
Thanks for your comprehensive feedback.
Best regards,
Thomas Uhle
Thomas Uhle· Oct 20, 2025, 18:20 UTC · re: Thomas Uhle · lore

[PATCH v2] contrib/credential: Amend and harmonize Makefiles

Update these Makefiles to be in line with other Makefiles from contrib
such as for contacts or subtree by making the following changes:
* Make the default settings after including config.mak.autogen and
  config.mak.
* Add the missing $(CPPFLAGS) to the compiler command as well as the
  missing $(CFLAGS) to the linker command.
* Use a pattern rule for compilation instead of a dedicated rule for
  each compile unit.
* Get rid of $(MAIN), $(SRCS) and $(OBJS) and simply use their values
  such as git-credential-libsecret and git-credential-libsecret.o.
* Strip @ from $(RM) to let the clean target rule be verbose.
* Define .PHONY for all special targets (all, clean).
Signed-off-by: Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de>
---
Changes in v2:
* Revert the changes in contrib/credentials/osxkeychain/Makefile that
  have introduced $(MAIN), $(SRCS) and $(OBJS) as placeholders for
  git-credential-osxkeychain, git-credential-osxkeychain.c and
  git-credential-osxkeychain.o similar to
  contrib/credential/libsecret/Makefile.  Instead replace $(MAIN),
  $(SRCS) and $(OBJS) in contrib/credential/libsecret/Makefile.
* Remove install target rule again to send this change as a separate
  patch later as requested.
* Adapt commit message.
* Link to v1: https://lore.kernel.org/git/48d92664-41af-bb59-1844-7bb57f21924f@mailbox.tu-dresden.de/
 contrib/credential/libsecret/Makefile   | 29 ++++++++++++-------------
 contrib/credential/osxkeychain/Makefile | 21 +++++++++++-------
 2 files changed, 27 insertions(+), 23 deletions(-)
Show changes to 2 files +27 −23

contrib/credential/libsecret/Makefile, contrib/credential/osxkeychain/Makefile

diff --git a/contrib/credential/libsecret/Makefile b/contrib/credential/libsecret/Makefile
index 97ce9c9..7cacc57 100644
--- a/contrib/credential/libsecret/Makefile
+++ b/contrib/credential/libsecret/Makefile
@@ -1,28 +1,27 @@
 # The default target of this Makefile is...
-all::
-
-MAIN:=git-credential-libsecret
-all:: $(MAIN)
-
-CC = gcc
-RM = rm -f
-CFLAGS = -g -O2 -Wall
-PKG_CONFIG = pkg-config
+all:: git-credential-libsecret

 -include ../../../config.mak.autogen
 -include ../../../config.mak

+prefix ?= /usr/local
+gitexecdir ?= $(prefix)/libexec/git-core
+
+CC ?= gcc
+CFLAGS ?= -g -O2 -Wall
+PKG_CONFIG ?= pkg-config
+RM ?= rm -f
+
 INCS:=$(shell $(PKG_CONFIG) --cflags libsecret-1 glib-2.0)
 LIBS:=$(shell $(PKG_CONFIG) --libs libsecret-1 glib-2.0)

-SRCS:=$(MAIN).c
-OBJS:=$(SRCS:.c=.o)
-
 %.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $@ -c $<

-$(MAIN): $(OBJS)
-	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
+git-credential-libsecret: git-credential-libsecret.o
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)

 clean:
-	@$(RM) $(MAIN) $(OBJS)
+	$(RM) git-credential-libsecret git-credential-libsecret.o
+
+.PHONY: all clean
diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
index 0948297..c7d9121 100644
--- a/contrib/credential/osxkeychain/Makefile
+++ b/contrib/credential/osxkeychain/Makefile
@@ -1,19 +1,24 @@
 # The default target of this Makefile is...
 all:: git-credential-osxkeychain

-CC = gcc
-RM = rm -f
-CFLAGS = -g -O2 -Wall
-
 -include ../../../config.mak.autogen
 -include ../../../config.mak

+prefix ?= /usr/local
+gitexecdir ?= $(prefix)/libexec/git-core
+
+CC ?= gcc
+CFLAGS ?= -g -O2 -Wall
+RM ?= rm -f
+
+%.o: %.c
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
 git-credential-osxkeychain: git-credential-osxkeychain.o
-	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) \
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) \
 		-framework Security -framework CoreFoundation

-git-credential-osxkeychain.o: git-credential-osxkeychain.c
-	$(CC) -c $(CFLAGS) $<
-
 clean:
 	$(RM) git-credential-osxkeychain git-credential-osxkeychain.o
+
+.PHONY: all clean

base-commit: 60f3f52f17cceefa5299709b189ce6fe2d181e7b
-- 
2.47.3

← back to recent threads