From f1deff716ea30b28693c16f8e48ba1a369e2e922 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Thu, 31 Jul 2014 18:36:24 +0200 Subject: [PATCH] Improve default HOST_CC / CC settings Instead of blindly defaulting to cc, try to find the actual compiler installed on the system, and as a last resort Change-Id: I114780b8e4bb54fab72dbd80466266126d6574a5 --- share/mk/bsd.sys.mk | 9 +++++++++ share/mk/sys.mk | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 7c18cb12c..8afe3e565 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -7,7 +7,16 @@ _BSD_SYS_MK_=1 .if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" HOST_LDFLAGS?= -static + +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +HOST_CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +HOST_CC?= gcc .endif +.endif # ${HOST_OSTYPE:C/\-.*//:U} == "Minix" .if ${MKREPRO:Uno} == "yes" CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 1f1398e52..ae407b1bb 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -21,6 +21,15 @@ unix?= We run MINIX. CPPFLAGS+= -DNDEBUG DBG= -Os .endif + +#LSC: Be a bit smarter about the default compiler +.if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang) +CC?= clang +.endif + +.if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc) +CC?= gcc +.endif .endif # defined(__MINIX) .LIBS: .a -- 2.44.0