On Sun, Jan 22, 2017 at 01:42:19PM +1000, Patrick Wildt wrote:
> Hi,
> 
> in architectures which use clang by default we should provide clang as
> cc, c++ and cpp as well.  Also lld should be called ld.
> 
> ok?
> 
> Patrick
> 

Of course it needs to be guarded with COMPILER_VERSION on lld as well.

diff --git a/gnu/usr.bin/clang/clang/Makefile b/gnu/usr.bin/clang/clang/Makefile
index b16aaa5e67c..104f7c593f1 100644
--- a/gnu/usr.bin/clang/clang/Makefile
+++ b/gnu/usr.bin/clang/clang/Makefile
@@ -1,7 +1,10 @@
 # $OpenBSD: Makefile,v 1.2 2017/01/14 20:12:41 patrick Exp $
 
+.include <bsd.own.mk>
+
 PROG=  clang
 BINDIR=        /usr/bin
+LIBEXECDIR=/usr/libexec
 SRCS=  driver.cpp \
        cc1_main.cpp \
        cc1as_main.cpp
@@ -14,6 +17,15 @@ LINKS=       ${BINDIR}/clang ${BINDIR}/clang++ \
 MLINKS=        clang.1 clang++.1 \
        clang.1 clang-cpp.1
 
+.if ${COMPILER_VERSION:L} == "clang"
+LINKS+=        ${BINDIR}/clang ${BINDIR}/cc \
+       ${BINDIR}/clang ${BINDIR}/c++ \
+       ${BINDIR}/clang ${LIBEXECDIR}/cpp
+MLINKS=        clang.1 cc.1 \
+       clang.1 c++.1 \
+       clang.1 cpp.1
+.endif
+
 CPPFLAGS+=     -I${.CURDIR}/../../../llvm/tools/clang/include
 
 .PATH: ${.CURDIR}/../../../llvm/tools/clang/tools/driver
diff --git a/gnu/usr.bin/clang/lld/Makefile b/gnu/usr.bin/clang/lld/Makefile
index ae43c25ff6e..b8f63f94f8f 100644
--- a/gnu/usr.bin/clang/lld/Makefile
+++ b/gnu/usr.bin/clang/lld/Makefile
@@ -1,5 +1,7 @@
 # $OpenBSD: Makefile,v 1.1 2017/01/22 03:13:07 patrick Exp $
 
+.include <bsd.own.mk>
+
 PROG=  lld
 BINDIR=        /usr/bin
 SRCS=  lld.cpp
@@ -8,6 +10,10 @@ NOMAN=
 LDADD+=        -ltermlib
 DPADD+=        ${LIBTERMLIB}
 
+.if ${COMPILER_VERSION:L} == "clang"
+LINKS= ${BINDIR}/lld ${BINDIR}/ld
+.endif
+
 CPPFLAGS+=     ${CLANG_INCLUDES}
 CPPFLAGS+=     -I${.CURDIR}/../../../llvm/tools/lld/include
 

Reply via email to