From 4359ff87e03138bdc9d5992ca0dfb58cc1ba2861 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Tue, 28 Jan 2014 10:48:19 +0100 Subject: [PATCH] Replace cc, c++ & cpp with symlinks In case of installation of both clang and GCC, we want to be able to switch which one is the default by adapting the cc, c++ & cpp symlinks. The default behaviour implemented here is to prefer clang over gcc if they are both installed. Change-Id: Ic14720cd876d2bf934d345a955cb5789378209e6 --- distrib/sets/lists/minix/mi | 3 +++ external/bsd/llvm/bin/clang/Makefile | 6 ++++++ external/gpl3/gcc/usr.bin/cpp/Makefile | 12 ++++++++++++ external/gpl3/gcc/usr.bin/g++/Makefile | 6 ++++++ external/gpl3/gcc/usr.bin/gcc/Makefile | 6 ++++++ 5 files changed, 33 insertions(+) diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index 470c2bee9..cab97b873 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -234,10 +234,12 @@ ./usr/bin/bzip2 minix-sys ./usr/bin/bzip2recover minix-sys ./usr/bin/c++ minix-sys gcccmds +./usr/bin/c++ minix-sys llvm ./usr/bin/cal minix-sys ./usr/bin/calendar minix-sys ./usr/bin/cawf minix-sys ./usr/bin/cc minix-sys gcccmds +./usr/bin/cc minix-sys llvm ./usr/bin/cc1 minix-sys gcccmds ./usr/bin/cc1obj minix-sys gcccmds ./usr/bin/cc1plus minix-sys gcccmds @@ -266,6 +268,7 @@ ./usr/bin/compress minix-sys ./usr/bin/cpio minix-sys ./usr/bin/cpp minix-sys gcccmds +./usr/bin/cpp minix-sys llvm ./usr/bin/cprofalyze minix-sys ./usr/bin/crc minix-sys ./usr/bin/cron minix-sys diff --git a/external/bsd/llvm/bin/clang/Makefile b/external/bsd/llvm/bin/clang/Makefile index 7f9e276a7..f39ad2bf7 100644 --- a/external/bsd/llvm/bin/clang/Makefile +++ b/external/bsd/llvm/bin/clang/Makefile @@ -6,6 +6,12 @@ NOMAN= yes .if !defined(HOSTPROG) SYMLINKS+= clang ${BINDIR}/clang++ SYMLINKS+= clang ${BINDIR}/clang-cpp + +# if defined(__MINIX) +SYMLINKS+= clang ${BINDIR}/cc +SYMLINKS+= clang ${BINDIR}/c++ +SYMLINKS+= clang ${BINDIR}/cpp +# endif # defined(__MINIX) .endif .include diff --git a/external/gpl3/gcc/usr.bin/cpp/Makefile b/external/gpl3/gcc/usr.bin/cpp/Makefile index 6e3fd224a..62016304e 100644 --- a/external/gpl3/gcc/usr.bin/cpp/Makefile +++ b/external/gpl3/gcc/usr.bin/cpp/Makefile @@ -3,7 +3,13 @@ # For ../Makefile.inc and bsd.own.mk .include +.if defined(__MINIX) +# In case of installation of both clang and GCC, we want to be able to +# switch which one is the default by adapting the cc, c++ & cpp symlinks +PROG= gcpp +.else PROG= cpp +.endif # defined(__MINIX) SRCS= gcc.c cppspec.c prefix.c version.c # XXX @@ -26,7 +32,13 @@ CPPFLAGS.gcc.c+= -I${GCCARCH} -I${BACKENDOBJ} -I. \ -DDEFAULT_TARGET_MACHINE=\"${MACHINE_GNU_PLATFORM}\" \ -DCONFIGURE_SPECS="\"\"" +.if defined(__MINIX) +.if ${HAVE_LLVM:Uno} == "no" +SYMLINKS= gcpp ${BINDIR}/cpp +.endif # ${HAVE_LLVM:Uno} == "no" +.else LINKS= ${BINDIR}/cpp ${BINDIR}/gcpp +.endif # defined(__MINIX) TEXINFO= cpp.texi INFOFLAGS= -I${DIST}/gcc/doc -I${DIST}/gcc/doc/include -I. diff --git a/external/gpl3/gcc/usr.bin/g++/Makefile b/external/gpl3/gcc/usr.bin/g++/Makefile index 8029c7145..e95ceeeae 100644 --- a/external/gpl3/gcc/usr.bin/g++/Makefile +++ b/external/gpl3/gcc/usr.bin/g++/Makefile @@ -10,7 +10,13 @@ NOMAN= # defined CPPFLAGS+= -I${BACKENDOBJ} +.if defined(__MINIX) +.if ${HAVE_LLVM:Uno} == "no" +SYMLINKS+= g++ ${BINDIR}/c++ +.endif # ${HAVE_LLVM:Uno} == "no" +.else LINKS+= ${BINDIR}/g++ ${BINDIR}/c++ +.endif # defined(__MINIX) .include "../Makefile.frontend" diff --git a/external/gpl3/gcc/usr.bin/gcc/Makefile b/external/gpl3/gcc/usr.bin/gcc/Makefile index 44bd2c2a5..5ad4c7e7b 100644 --- a/external/gpl3/gcc/usr.bin/gcc/Makefile +++ b/external/gpl3/gcc/usr.bin/gcc/Makefile @@ -7,7 +7,13 @@ SRCS= gccspec.c CPPFLAGS+= -I${BACKENDOBJ} +.if defined(__MINIX) +.if ${HAVE_LLVM:Uno} == "no" +SYMLINKS+= gcc ${BINDIR}/cc +.endif # ${HAVE_LLVM:Uno} == "no" +.else LINKS+= ${BINDIR}/gcc ${BINDIR}/cc +.endif # defined(__MINIX) MAN= gcc.1 MLINKS= gcc.1 cc.1 gcc.1 g++.1 gcc.1 c++.1 -- 2.44.0