Build system changes to use TableGen to generate the various
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
diff --git a/lib/AST/CMakeLists.txt b/lib/AST/CMakeLists.txt
index 9687f34..48b1971 100644
--- a/lib/AST/CMakeLists.txt
+++ b/lib/AST/CMakeLists.txt
@@ -29,3 +29,5 @@
   Type.cpp
   TypeSerialization.cpp
   )
+
+add_dependencies(clangAST ClangDiagnosticAST)
diff --git a/lib/AST/Makefile b/lib/AST/Makefile
index cdfc64c..f7d4e9f 100644
--- a/lib/AST/Makefile
+++ b/lib/AST/Makefile
@@ -16,7 +16,7 @@
 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
 
diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt
index 64aa3a4..72bc3ae 100644
--- a/lib/Analysis/CMakeLists.txt
+++ b/lib/Analysis/CMakeLists.txt
@@ -31,3 +31,5 @@
   SymbolManager.cpp
   UninitializedValues.cpp
   )
+
+add_dependencies(clangAnalysis ClangDiagnosticAnalysis)
diff --git a/lib/Analysis/Makefile b/lib/Analysis/Makefile
index b1d9178..c597254 100644
--- a/lib/Analysis/Makefile
+++ b/lib/Analysis/Makefile
@@ -16,7 +16,7 @@
 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
 
diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt
index 37fa210..2656859 100644
--- a/lib/Basic/CMakeLists.txt
+++ b/lib/Basic/CMakeLists.txt
@@ -11,3 +11,13 @@
   Targets.cpp
   TokenKinds.cpp
   )
+
+add_dependencies(clangBasic 
+                 ClangDiagnosticAnalysis
+                 ClangDiagnosticAST
+                 ClangDiagnosticCommon
+                 ClangDiagnosticDriver
+                 ClangDiagnosticFrontend
+                 ClangDiagnosticLex
+                 ClangDiagnosticParse
+                 ClangDiagnosticSema)
diff --git a/lib/Basic/Makefile b/lib/Basic/Makefile
index e95d6db..3fd6c2c 100644
--- a/lib/Basic/Makefile
+++ b/lib/Basic/Makefile
@@ -16,7 +16,7 @@
 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
 
diff --git a/lib/CodeGen/Makefile b/lib/CodeGen/Makefile
index 4d7828e..e716fe7 100644
--- a/lib/CodeGen/Makefile
+++ b/lib/CodeGen/Makefile
@@ -17,7 +17,7 @@
 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
 
diff --git a/lib/Driver/Makefile b/lib/Driver/Makefile
index a43033a..fb437d2 100644
--- a/lib/Driver/Makefile
+++ b/lib/Driver/Makefile
@@ -12,7 +12,7 @@
 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
 
diff --git a/lib/Frontend/Makefile b/lib/Frontend/Makefile
index 70edfd5..8d70847 100644
--- a/lib/Frontend/Makefile
+++ b/lib/Frontend/Makefile
@@ -12,7 +12,7 @@
 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
 
diff --git a/lib/Lex/CMakeLists.txt b/lib/Lex/CMakeLists.txt
index 6347142..a7237a7 100644
--- a/lib/Lex/CMakeLists.txt
+++ b/lib/Lex/CMakeLists.txt
@@ -22,3 +22,5 @@
   TokenLexer.cpp
   TokenConcatenation.cpp
   )
+
+add_dependencies(clangLex ClangDiagnosticLex)
diff --git a/lib/Lex/Makefile b/lib/Lex/Makefile
index 187448c..a2437da 100644
--- a/lib/Lex/Makefile
+++ b/lib/Lex/Makefile
@@ -22,7 +22,7 @@
 CXXFLAGS += -maltivec
 endif
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
 
 include $(LEVEL)/Makefile.common
 
diff --git a/lib/Parse/CMakeLists.txt b/lib/Parse/CMakeLists.txt
index 9135584..8fb7cd2 100644
--- a/lib/Parse/CMakeLists.txt
+++ b/lib/Parse/CMakeLists.txt
@@ -17,3 +17,5 @@
   ParseTentative.cpp
   ParseTemplate.cpp
   )
+
+add_dependencies(clangParse ClangDiagnosticParse)
diff --git a/lib/Parse/Makefile b/lib/Parse/Makefile
index b5d2653..5d69029 100644
--- a/lib/Parse/Makefile
+++ b/lib/Parse/Makefile
@@ -16,7 +16,7 @@
 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
 
diff --git a/lib/Rewrite/Makefile b/lib/Rewrite/Makefile
index 3c0b5a5..61fdf40 100644
--- a/lib/Rewrite/Makefile
+++ b/lib/Rewrite/Makefile
@@ -16,7 +16,7 @@
 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
 
diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt
index 23809b9..e90c7e3 100644
--- a/lib/Sema/CMakeLists.txt
+++ b/lib/Sema/CMakeLists.txt
@@ -24,3 +24,5 @@
   SemaTemplateInstantiate.cpp
   SemaType.cpp
   )
+
+add_dependencies(clangSema ClangDiagnosticSema)
diff --git a/lib/Sema/Makefile b/lib/Sema/Makefile
index 9193a54..0f4c796 100644
--- a/lib/Sema/Makefile
+++ b/lib/Sema/Makefile
@@ -17,7 +17,7 @@
 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