git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Samuel John <mail@samueljohn.de>, git@vger.kernel.org
Subject: Re: contrib/credential/osxkeychain: Makefile should allow to set CFLAGS
Date: Wed, 23 May 2012 13:36:53 -0400	[thread overview]
Message-ID: <20120523173653.GA29458@sigill.intra.peff.net> (raw)
In-Reply-To: <7vtxz82ap6.fsf@alter.siamese.dyndns.org>

On Tue, May 22, 2012 at 02:00:05PM -0700, Junio C Hamano wrote:

> It however seems to me that git-credential-osxkeychain.o does honor
> $(CFLAGS), either from the user "make CFLAGS=..." or the default the
> Makefile in question supplies.
> 
> The line you quoted is not using $(CC) as the compiler, but is using it to
> link the final build product.  It may not hurt to have $(CFLAGS) on that
> line, but shouldn't the line also have $(LDFLAGS) on it?

I think so. Why don't we do this?

-- >8 --
Subject: osxkeychain: pull make config from top-level directory

The default compiler and cflags were mostly "works for me"
when I built the original version. We need to be much less
careful here than usual, because we know we are building
only on OS X.  But it's only polite to at least respect the
CFLAGS and CC definitions that the user may have provided
earlier.

While we're at it, let's update our definitions and rules to
be more like the top-level Makefile; default our CFLAGS to
include -O2, and make sure we use CFLAGS and LDFLAGS when
linking.

Signed-off-by: Jeff King <peff@peff.net>
---
 contrib/credential/osxkeychain/Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/contrib/credential/osxkeychain/Makefile b/contrib/credential/osxkeychain/Makefile
index 75c07f8..4b3a08a 100644
--- a/contrib/credential/osxkeychain/Makefile
+++ b/contrib/credential/osxkeychain/Makefile
@@ -2,10 +2,13 @@ all:: git-credential-osxkeychain
 
 CC = gcc
 RM = rm -f
-CFLAGS = -g -Wall
+CFLAGS = -g -O2 -Wall
+
+-include ../../../config.mak.autogen
+-include ../../../config.mak
 
 git-credential-osxkeychain: git-credential-osxkeychain.o
-	$(CC) -o $@ $< -Wl,-framework -Wl,Security
+	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -Wl,-framework -Wl,Security
 
 git-credential-osxkeychain.o: git-credential-osxkeychain.c
 	$(CC) -c $(CFLAGS) $<
-- 
1.7.9.7.35.gbeaaf11

  reply	other threads:[~2012-05-23 17:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 20:25 contrib/credential/osxkeychain: Makefile should allow to set CFLAGS Samuel John
2012-05-22 21:00 ` Junio C Hamano
2012-05-23 17:36   ` Jeff King [this message]
2012-05-24 17:35     ` Junio C Hamano
2012-05-24 17:51       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120523173653.GA29458@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mail@samueljohn.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).