threads / patch / 29217

patchMakefile: Change the default compiler from "gcc" to "cc"

Subject: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"

## tl;dr

5 messages between Dec 20, 2011 and Feb 12, 2012. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Ævar Arnfjörð Bjarmason· Dec 20, 2011, 23:40 UTC · lore

Ever since the very first commit to git.git we've been setting CC to "gcc". Presumably this is behavior that Linus copied from the Linux Makefile.

However unlike Linux Git is written in ANSI C and supports a multitude of compilers, including Clang, Sun Studio, xlc etc. On my Linux box "cc" is a symlink to clang, and on a Solaris box I have access to "cc" is Sun Studio's CC.

Both of these are perfectly capable of compiling Git, and it's annoying to have to specify CC=cc on the command-line when compiling Git when that's the default behavior of most other portable programs.

So change the default to "cc". Users who want to compile with GCC can still add "CC=gcc" to the make(1) command-line, but those users who don't have GCC as their "cc" will see expected behavior, and as a bonus we'll be more likely to smoke out new compilation warnings from our distributors since they'll me using a more varied set of compilers by default.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index 9470a10..958c6e6 100644
--- a/Makefile
+++ b/Makefile
@@ -336,7 +336,7 @@ pathsep = :
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = gcc
+CC = cc
 AR = ar
 RM = rm -f
 DIFF = diff
-- 
1.7.7.3
Junio C Hamano· Dec 21, 2011, 00:01 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 8 quoted lines
> However unlike Linux Git is written in ANSI C and supports a multitude
> of compilers, including Clang, Sun Studio, xlc etc. On my Linux box
> "cc" is a symlink to clang, and on a Solaris box I have access to "cc"
> is Sun Studio's CC.
>
> Both of these are perfectly capable of compiling Git, and it's
> annoying to have to specify CC=cc on the command-line when compiling
> Git when that's the default behavior of most other portable programs.
Would this affect folks in BSD land negatively?
Ævar Arnfjörð Bjarmason· Dec 21, 2011, 01:06 UTC · re: Junio C Hamano · lore

Re: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"

On Wed, Dec 21, 2011 at 01:01, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> However unlike Linux Git is written in ANSI C and supports a multitude
>> of compilers, including Clang, Sun Studio, xlc etc. On my Linux box
>> "cc" is a symlink to clang, and on a Solaris box I have access to "cc"
>> is Sun Studio's CC.
>>
>> Both of these are perfectly capable of compiling Git, and it's
>> annoying to have to specify CC=cc on the command-line when compiling
>> Git when that's the default behavior of most other portable programs.
>
> Would this affect folks in BSD land negatively?
Linus Torvalds· Dec 21, 2011, 01:33 UTC · re: Junio C Hamano · lore

Re: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"

On Tue, Dec 20, 2011 at 4:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Would this affect folks in BSD land negatively?
Probably not.

The people who might notice are the old=time crappy commercial unixes, but they are all dead by now. The kinds where 'cc' isn't even ANSI C, it's K&R and you needed to pay extra for the "real" compiler.

But if those people still exist, they probably haven't figured out CVS yet, and still use RCS or SCCS. Their brains would explode messily if they tried to use git.

                           Linus
Ævar Arnfjörð Bjarmason· Feb 12, 2012, 00:05 UTC · re: Junio C Hamano · lore

Re: [PATCH] Makefile: Change the default compiler from "gcc" to "cc"

On Wed, Dec 21, 2011 at 01:01, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> However unlike Linux Git is written in ANSI C and supports a multitude
>> of compilers, including Clang, Sun Studio, xlc etc. On my Linux box
>> "cc" is a symlink to clang, and on a Solaris box I have access to "cc"
>> is Sun Studio's CC.
>>
>> Both of these are perfectly capable of compiling Git, and it's
>> annoying to have to specify CC=cc on the command-line when compiling
>> Git when that's the default behavior of most other portable programs.
>
> Would this affect folks in BSD land negatively?

I see my mail back it December didn't include a reply to that for some reason.

Anyway like Linus said probably not, also the BSD's I use have cc as a symlink to whatever the default compiler is, which is usually gcc.

I've recently been hacking git on Solaris again and keep getting bit by this, I'd like to propose it for inclusion again, the patch still applies.

← back to recent threads