summaryrefslogtreecommitdiffstats
path: root/clang-query
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2014-02-18 19:46:01 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2014-02-18 19:46:01 +0000
commitda776c0cf273b8ab78b1ecb22868a457bb94728e (patch)
treec8fc9a6bb28656491cd4a412fc437cc8e2a424b9 /clang-query
parentdde204472066033e6de2bf6814897ede4db12dd7 (diff)
Add a makefile for clang-query. Patch by Alex Horn!
While at it, have cmake build and test the tool if libedit is not installed, as this dependency is now optional. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@201599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-query')
-rw-r--r--clang-query/Makefile2
-rw-r--r--clang-query/tool/CMakeLists.txt17
-rw-r--r--clang-query/tool/Makefile39
3 files changed, 48 insertions, 10 deletions
diff --git a/clang-query/Makefile b/clang-query/Makefile
index 4d739665..13903b98 100644
--- a/clang-query/Makefile
+++ b/clang-query/Makefile
@@ -11,4 +11,6 @@ CLANG_LEVEL := ../../..
LIBRARYNAME := clangQuery
include $(CLANG_LEVEL)/../../Makefile.config
+DIRS = tool
+
include $(CLANG_LEVEL)/Makefile
diff --git a/clang-query/tool/CMakeLists.txt b/clang-query/tool/CMakeLists.txt
index f54c4e67..2b58bf6d 100644
--- a/clang-query/tool/CMakeLists.txt
+++ b/clang-query/tool/CMakeLists.txt
@@ -1,11 +1,8 @@
-if(HAVE_LIBEDIT)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
- add_clang_executable(clang-query ClangQuery.cpp)
- target_link_libraries(clang-query
- edit
- clangFrontend
- clangQuery
- clangTooling
- )
-endif()
+add_clang_executable(clang-query ClangQuery.cpp)
+target_link_libraries(clang-query
+ clangFrontend
+ clangQuery
+ clangTooling
+ )
diff --git a/clang-query/tool/Makefile b/clang-query/tool/Makefile
new file mode 100644
index 00000000..9da754a9
--- /dev/null
+++ b/clang-query/tool/Makefile
@@ -0,0 +1,39 @@
+##===- tools/extra/clang-query/tool/Makefile ---------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+CLANG_LEVEL := ../../../..
+include $(CLANG_LEVEL)/../../Makefile.config
+
+TOOLNAME = clang-query
+
+# No plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+SOURCES = ClangQuery.cpp
+
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc mcparser option
+USEDLIBS = clangQuery.a clangDynamicASTMatchers.a clangFormat.a clangTooling.a \
+ clangFrontend.a clangSerialization.a clangDriver.a clangRewriteFrontend.a \
+ LLVMLineEditor.a clangRewriteCore.a clangParse.a clangSema.a clangAnalysis.a \
+ clangAST.a clangASTMatchers.a clangEdit.a clangLex.a clangBasic.a
+
+include $(CLANG_LEVEL)/Makefile
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/..
+
+# BUILT_SOURCES gets used as a prereq for many top-level targets. However, at
+# the point those targets are defined, $(ObjDir) hasn't been defined and so the
+# directory to create becomes /<name>/ which is not what we want. So instead,
+# this .objdir recipe is defined at at point where $(ObjDir) is defined and
+# it's specialized to $(ObjDir) to ensure it only works on targets we want it
+# to.
+$(ObjDir)/%.objdir:
+ $(Verb) $(MKDIR) $(ObjDir)/$* > /dev/null
+ $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
+