]> granicus.if.org Git - clang/commitdiff
Build system changes to use TableGen to generate the various
authorDouglas Gregor <dgregor@apple.com>
Mon, 16 Mar 2009 23:06:59 +0000 (23:06 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 16 Mar 2009 23:06:59 +0000 (23:06 +0000)
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:

  - We don't remove or use the current ".def" files. Instead, for now,
    we just make sure that we're building the ".inc" files.
  - Fixed CMake makefiles to run TableGen and build the ".inc" files
    when needed. Tested with both the Xcode and Makefile generators
    provided by CMake, so it should be solid.
  - Fixed normal makefiles to handle out-of-source builds that involve
    the ".inc" files.

I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67058 91177308-0d34-0410-b5e6-96231b3b80d8

26 files changed:
CMakeLists.txt
Driver/Makefile
Makefile
include/CMakeLists.txt [new file with mode: 0644]
include/Makefile [new file with mode: 0644]
include/clang/Basic/CMakeLists.txt [new file with mode: 0644]
include/clang/Basic/Makefile [new file with mode: 0644]
include/clang/CMakeLists.txt [new file with mode: 0644]
include/clang/Makefile [new file with mode: 0644]
lib/AST/CMakeLists.txt
lib/AST/Makefile
lib/Analysis/CMakeLists.txt
lib/Analysis/Makefile
lib/Basic/CMakeLists.txt
lib/Basic/Makefile
lib/CodeGen/Makefile
lib/Driver/Makefile
lib/Frontend/Makefile
lib/Lex/CMakeLists.txt
lib/Lex/Makefile
lib/Parse/CMakeLists.txt
lib/Parse/Makefile
lib/Rewrite/Makefile
lib/Sema/CMakeLists.txt
lib/Sema/Makefile
tools/driver/Makefile

index 3575d883919c58b3fd842d9c766c95d022de39d1..6a46c5a78526f801902be4a7ebd443fef909563c 100644 (file)
@@ -12,6 +12,7 @@ macro(add_clang_library name)
   if( LLVM_COMMON_DEPENDS )
     add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
   endif( LLVM_COMMON_DEPENDS )
+  add_dependencies(${name} ClangDiagnosticCommon)
   if(MSVC)
     get_target_property(cflag ${name} COMPILE_FLAGS)
     if(NOT cflag)
@@ -38,6 +39,7 @@ endmacro(add_clang_executable)
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}/include
+  ${CMAKE_CURRENT_BINARY_DIR}/include
   )
 
 install(DIRECTORY include
@@ -47,6 +49,7 @@ install(DIRECTORY include
 
 add_definitions( -D_GNU_SOURCE )
 
+add_subdirectory(include)
 add_subdirectory(lib)
 add_subdirectory(Driver)
 
index 84a484ed0f2183f3d82a2bb2ab933539ba48bce0..962e3fd1bb1b6198bd0c76770a4f30cdb47dc0de 100644 (file)
@@ -1,6 +1,6 @@
 LEVEL = ../../..
 TOOLNAME = clang
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../include -I$(PROJ_OBJ_DIR)/../include
 CXXFLAGS = -fno-rtti
 
 # Clang has no plugins, optimize startup time.
index 72bfaa78e65d12270d7dd1e0f224e519f136c679..660f0e922bef0d826c8cec0059c4ac71f9d4ee1d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 LEVEL = ../..
-DIRS := lib Driver docs tools
+DIRS := include lib Driver docs tools
 
 include $(LEVEL)/Makefile.common
 
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644 (file)
index 0000000..253a09b
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory(clang)
diff --git a/include/Makefile b/include/Makefile
new file mode 100644 (file)
index 0000000..47daabc
--- /dev/null
@@ -0,0 +1,4 @@
+LEVEL = ../../..
+DIRS := clang
+
+include $(LEVEL)/Makefile.common
diff --git a/include/clang/Basic/CMakeLists.txt b/include/clang/Basic/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9d6e14f
--- /dev/null
@@ -0,0 +1,16 @@
+macro(clang_diag_gen component)
+  tablegen(Diagnostic${component}Kinds.inc 
+          -gen-clang-diags-defs -clang-component=${component})
+  add_custom_target(ClangDiagnostic${component}
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Diagnostic${component}Kinds.inc)
+endmacro(clang_diag_gen)
+
+set(LLVM_TARGET_DEFINITIONS Diagnostic.td)
+clang_diag_gen(Analysis)
+clang_diag_gen(AST)
+clang_diag_gen(Common)
+clang_diag_gen(Driver)
+clang_diag_gen(Frontend)
+clang_diag_gen(Lex)
+clang_diag_gen(Parse)
+clang_diag_gen(Sema)
\ No newline at end of file
diff --git a/include/clang/Basic/Makefile b/include/clang/Basic/Makefile
new file mode 100644 (file)
index 0000000..3919311
--- /dev/null
@@ -0,0 +1,9 @@
+LEVEL = ../../../../..
+BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
+       DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
+       DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
+       DiagnosticParseKinds.inc DiagnosticSemaKinds.inc
+
+CLANG_BUILD_DIAGNOSTICS_INC = 1
+
+include $(LEVEL)/Makefile.common
diff --git a/include/clang/CMakeLists.txt b/include/clang/CMakeLists.txt
new file mode 100644 (file)
index 0000000..39e3698
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory(Basic)
diff --git a/include/clang/Makefile b/include/clang/Makefile
new file mode 100644 (file)
index 0000000..82a16d5
--- /dev/null
@@ -0,0 +1,4 @@
+LEVEL = ../../../..
+DIRS := Basic
+
+include $(LEVEL)/Makefile.common
index 9687f34be8efe0dc60617bafc287d62462e2b9a3..48b19711127ba3abea19ad93c1617ec2522d26c3 100644 (file)
@@ -29,3 +29,5 @@ add_clang_library(clangAST
   Type.cpp
   TypeSerialization.cpp
   )
+
+add_dependencies(clangAST ClangDiagnosticAST)
index cdfc64cacaf6631b019ee9d3ddb41b8972e2ed3f..f7d4e9f62d5f2aff8ac9048aa5f889afa6d8165c 100644 (file)
@@ -16,7 +16,7 @@ LIBRARYNAME := clangAST
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 64aa3a499f9b4beee5fcec65fc9e257ba3895517..72bc3aea4a6dad629f7b80b34ed0ad613e72a1ea 100644 (file)
@@ -31,3 +31,5 @@ add_clang_library(clangAnalysis
   SymbolManager.cpp
   UninitializedValues.cpp
   )
+
+add_dependencies(clangAnalysis ClangDiagnosticAnalysis)
index b1d9178182365e68a5c76db6045b4b88bdd9ad90..c597254fd2d73aa12831a8ccfc0f38e3465a830e 100644 (file)
@@ -16,7 +16,7 @@ LIBRARYNAME := clangAnalysis
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 37fa210df85dff8143635074e0de7d08921f714e..26568598f61e52140cceace4a1547acc3c5b7305 100644 (file)
@@ -11,3 +11,13 @@ add_clang_library(clangBasic
   Targets.cpp
   TokenKinds.cpp
   )
+
+add_dependencies(clangBasic 
+                 ClangDiagnosticAnalysis
+                 ClangDiagnosticAST
+                 ClangDiagnosticCommon
+                 ClangDiagnosticDriver
+                 ClangDiagnosticFrontend
+                 ClangDiagnosticLex
+                 ClangDiagnosticParse
+                 ClangDiagnosticSema)
index e95d6dbfa35c230279eeb0b9e9024a84d687adf3..3fd6c2c153842174a832da6dd26f6c68f8773703 100644 (file)
@@ -16,7 +16,7 @@ LIBRARYNAME := clangBasic
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 4d7828ef67a09e1f72945bc019565ef8a320e80d..e716fe78bc60962e6ac53f52c2f467286e98fae1 100644 (file)
@@ -17,7 +17,7 @@ LIBRARYNAME := clangCodeGen
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index a43033acbe898b52fe5e503887db19e1465cf8b9..fb437d2644cf4bfec44ba0c6871c3b68d5c5f037 100644 (file)
@@ -12,7 +12,7 @@ LIBRARYNAME := clangDriver
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 70edfd5230ad3c7fad94da1f15143849c3d00023..8d708475783f576182167e9fe6ead6ef15934eeb 100644 (file)
@@ -12,7 +12,7 @@ LIBRARYNAME := clangFrontend
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 6347142adaa29f21acd5be0c6a095e738bf48a3b..a7237a7b76f6cc0ceafb01c4244bfd921c8b1efd 100644 (file)
@@ -22,3 +22,5 @@ add_clang_library(clangLex
   TokenLexer.cpp
   TokenConcatenation.cpp
   )
+
+add_dependencies(clangLex ClangDiagnosticLex)
index 187448c992284c434ee4ed89d8a9102976f00e15..a2437da812bdbefec1008c04ecfec0390bbd21ec 100644 (file)
@@ -22,7 +22,7 @@ ifeq ($(ARCH),PowerPC)
 CXXFLAGS += -maltivec
 endif
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 91355844e7b74dc4e89a943dc4c5899d25229feb..8fb7cd23b89a4db6fcee76ae16fd88492971b80a 100644 (file)
@@ -17,3 +17,5 @@ add_clang_library(clangParse
   ParseTentative.cpp
   ParseTemplate.cpp
   )
+
+add_dependencies(clangParse ClangDiagnosticParse)
index b5d2653bb09af2b069af273503188f31eadb11ef..5d69029edc1afd15da2cbb8408d9966e042c5984 100644 (file)
@@ -16,7 +16,7 @@ LIBRARYNAME := clangParse
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 3c0b5a572744bb1cfee2fac6fce4fcae5eb90720..61fdf4006f86b2a6d7eb000924899b701b385813 100644 (file)
@@ -16,7 +16,7 @@ LIBRARYNAME := clangRewrite
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index 23809b9309d2371ec49bae3d2ed5699593953755..e90c7e30c229e971aab54fb0d423d779becff808 100644 (file)
@@ -24,3 +24,5 @@ add_clang_library(clangSema
   SemaTemplateInstantiate.cpp
   SemaType.cpp
   )
+
+add_dependencies(clangSema ClangDiagnosticSema)
index 9193a546ca75884e22e3f3d49dec90b112325fac..0f4c7965dca260f7b762f91859fd8816e238a9e4 100644 (file)
@@ -17,7 +17,7 @@ LIBRARYNAME := clangSema
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
index ca2253a9b00715cbf99a60aed2468755336946f4..0ba65e516b9f09a8138dafd766169bcbaeaa1f26 100644 (file)
@@ -9,7 +9,7 @@
 LEVEL = ../../../..
 
 TOOLNAME = clang-driver
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 CXXFLAGS = -fno-rtti
 
 # FIXME: It is unfortunate we need to pull in the bitcode reader and