Skip to contentSkip to conversation

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

PATCH In review Ævar Arnfjörð Bjarmason 3 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Change the default compiler from "gcc" to "cc"

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.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 9470a10..958c6e6 100644
@@ -336,7 +336,7 @@ pathsep = :
 
 export prefix bindir sharedir sysconfdir gitwebdir localedir
 
-CC = gcc
+CC = cc
 AR = ar
 RM = rm -f
 DIFF = diff
Signature · 1 line
1.7.7.3
#1 lore raw
Quoted 8 lines · Ævar Arnfjörð Bjarmason

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?

#2 lore raw
Quoted 12 lines · Junio C Hamano
Quoted 8 lines · Ævar Arnfjörð Bjarmason

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?

#3 lore raw
In reply to Junio C Hamano
Quoted 2 lines · Junio C Hamano

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

#4 lore raw
In reply to Junio C Hamano
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Ævar Arnfjörð Bjarmason

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.

Quoted 5 lines
Quoted 3 lines

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.