aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/clang/libclang/Makefile6
-rw-r--r--usr.bin/clang/Makefile4
-rw-r--r--usr.bin/clang/clang-scan-deps/Makefile26
-rw-r--r--usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp18
4 files changed, 54 insertions, 0 deletions
diff --git a/lib/clang/libclang/Makefile b/lib/clang/libclang/Makefile
index 5e20b37c1183..9b9e0cbadcd7 100644
--- a/lib/clang/libclang/Makefile
+++ b/lib/clang/libclang/Makefile
@@ -842,6 +842,11 @@ SRCS_MIN+= Tooling/ArgumentsAdjusters.cpp
SRCS_MIN+= Tooling/CommonOptionsParser.cpp
SRCS_MIN+= Tooling/CompilationDatabase.cpp
SRCS_MIN+= Tooling/Core/Replacement.cpp
+SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningFilesystem.cpp
+SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningService.cpp
+SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningTool.cpp
+SRCS_MIN+= Tooling/DependencyScanning/DependencyScanningWorker.cpp
+SRCS_MIN+= Tooling/DependencyScanning/ModuleDepCollector.cpp
SRCS_MIN+= Tooling/ExpandResponseFilesCompilationDatabase.cpp
SRCS_MIN+= Tooling/FileMatchTrie.cpp
SRCS_MIN+= Tooling/GuessTargetAndModeCompilationDatabase.cpp
@@ -849,6 +854,7 @@ SRCS_MIN+= Tooling/Inclusions/HeaderIncludes.cpp
SRCS_MIN+= Tooling/Inclusions/IncludeStyle.cpp
SRCS_MIN+= Tooling/InterpolatingCompilationDatabase.cpp
SRCS_MIN+= Tooling/JSONCompilationDatabase.cpp
+SRCS_MIN+= Tooling/LocateToolCompilationDatabase.cpp
SRCS_MIN+= Tooling/Refactoring.cpp
SRCS_MIN+= Tooling/RefactoringCallbacks.cpp
SRCS_MIN+= Tooling/Tooling.cpp
diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile
index 30ec1ab65e0f..d883048b7ed9 100644
--- a/usr.bin/clang/Makefile
+++ b/usr.bin/clang/Makefile
@@ -6,6 +6,10 @@ SUBDIR+= clang
.endif
.if !defined(TOOLS_PREFIX)
+.if ${MK_CLANG} != "no"
+SUBDIR+= clang-scan-deps
+.endif
+
# LLVM binutils are needed to support features such as LTO, so we build them
# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them
# as the default binutils (ar,nm,addr2line, etc.).
diff --git a/usr.bin/clang/clang-scan-deps/Makefile b/usr.bin/clang/clang-scan-deps/Makefile
new file mode 100644
index 000000000000..16fecdb88867
--- /dev/null
+++ b/usr.bin/clang/clang-scan-deps/Makefile
@@ -0,0 +1,26 @@
+.include <src.opts.mk>
+
+PROG_CXX= clang-scan-deps
+MAN=
+
+SRCDIR= clang/tools/clang-scan-deps
+SRCS+= ClangScanDeps.cpp \
+ clang-scan-deps-driver.cpp
+
+.include "${SRCTOP}/lib/clang/clang.pre.mk"
+
+CFLAGS+= -I${.OBJDIR}
+TDFILE= Opts.td
+INCFILE= ${TDFILE:.td=.inc}
+GENOPT= -gen-opt-parser-defs
+
+${INCFILE}: ${TDFILE}
+ ${LLVM_TBLGEN} ${GENOPT} -I ${LLVM_SRCS}/include -d ${.TARGET:C/$/.d/} \
+ -o ${.TARGET} ${.ALLSRC}
+TGHDRS+= ${INCFILE}
+
+DEPENDFILES+= ${TGHDRS:C/$/.d/}
+DPSRCS+= ${TGHDRS}
+CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/}
+
+.include "../clang.prog.mk"
diff --git a/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp
new file mode 100644
index 000000000000..f941cc434ff6
--- /dev/null
+++ b/usr.bin/clang/clang-scan-deps/clang-scan-deps-driver.cpp
@@ -0,0 +1,18 @@
+//===-- driver-template.cpp -----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/LLVMDriver.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/InitLLVM.h"
+
+int clang_scan_deps_main(int argc, char **, const llvm::ToolContext &);
+
+int main(int argc, char **argv) {
+ llvm::InitLLVM X(argc, argv);
+ return clang_scan_deps_main(argc, argv, {argv[0], nullptr, false});
+}