Install c-index-test and clang-c/Index.h as internal files. rdar://10217046

Specify that these files should be installed to the optional internal
install location as specified by configure's --with-internal-prefix.
If that option is not used, they'll be installed to the default prefix
as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145235 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang-c/Makefile b/include/clang-c/Makefile
index 98ea719..3f3ae58 100644
--- a/include/clang-c/Makefile
+++ b/include/clang-c/Makefile
@@ -3,21 +3,23 @@
 
 include $(CLANG_LEVEL)/Makefile
 
+IntIncludeDir = $(DESTDIR)$(PROJ_internal_prefix)/include
+
 install-local::
 	$(Echo) Installing Clang C API include files
-	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
+	$(Verb) $(MKDIR) $(IntIncludeDir)
 	$(Verb) if test -d "$(PROJ_SRC_ROOT)/tools/clang/include/clang-c" ; then \
 	  cd $(PROJ_SRC_ROOT)/tools/clang/include && \
 	  for  hdr in `find clang-c -type f '!' '(' -name '*~' \
 	      -o -name '.#*' -o -name '*.in' -o -name '*.txt' \
 	      -o -name 'Makefile' -o -name '*.td' ')' -print \
               | grep -v CVS | grep -v .svn | grep -v .dir` ; do \
-	    instdir=$(DESTDIR)`dirname "$(PROJ_includedir)/$$hdr"` ; \
+	    instdir=`dirname "$(IntIncludeDir)/$$hdr"` ; \
 	    if test \! -d "$$instdir" ; then \
 	      $(EchoCmd) Making install directory $$instdir ; \
 	      $(MKDIR) $$instdir ;\
 	    fi ; \
-	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+	    $(DataInstall) $$hdr $(IntIncludeDir)/$$hdr ; \
 	  done ; \
 	fi
 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
@@ -25,7 +27,7 @@
 	  cd $(PROJ_OBJ_ROOT)/tools/clang/include && \
 	  for hdr in `find clang-c -type f '!' '(' -name 'Makefile' ')' -print \
             | grep -v CVS | grep -v .tmp | grep -v .dir` ; do \
-	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
+	    $(DataInstall) $$hdr $(IntIncludeDir)/$$hdr ; \
 	  done ; \
 	fi
 endif
diff --git a/tools/c-index-test/Makefile b/tools/c-index-test/Makefile
index c21b327..471ce91 100644
--- a/tools/c-index-test/Makefile
+++ b/tools/c-index-test/Makefile
@@ -10,6 +10,10 @@
 
 TOOLNAME = c-index-test
 
+# If a separate install prefix was specified for internal tools, use it
+# when installing c-index-test.
+INTERNAL_TOOL = 1
+
 # No plugins, optimize startup time.
 TOOL_NO_EXPORTS = 1