diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index 525c27faccc9..d17f77b0a878 100644 --- a/clang/Driver/clang.cpp +++ b/clang/Driver/clang.cpp @@ -1090,14 +1090,21 @@ void InitializeIncludePaths(const char *Argv0, HeaderSearch &Headers, Init.AddDefaultEnvVarPaths(Lang); - // Add the clang headers, which are relative to the clang driver. + // Add the clang headers, which are relative to the clang binary. llvm::sys::Path MainExecutablePath = llvm::sys::Path::GetMainExecutable(Argv0, (void*)(intptr_t)InitializeIncludePaths); if (!MainExecutablePath.isEmpty()) { MainExecutablePath.eraseComponent(); // Remove /clang from foo/bin/clang MainExecutablePath.eraseComponent(); // Remove /bin from foo/bin - MainExecutablePath.appendComponent("Headers"); // Get foo/Headers + + // Get foo/lib/clang/1.0/include + // + // FIXME: Don't embed version here. + MainExecutablePath.appendComponent("lib"); + MainExecutablePath.appendComponent("clang"); + MainExecutablePath.appendComponent("1.0"); + MainExecutablePath.appendComponent("include"); // We pass true to ignore sysroot so that we *always* look for clang headers // relative to our executable, never relative to -isysroot. diff --git a/clang/lib/Headers/Makefile b/clang/lib/Headers/Makefile index 98b82c398033..77eb96dc4dc4 100644 --- a/clang/lib/Headers/Makefile +++ b/clang/lib/Headers/Makefile @@ -10,7 +10,8 @@ LEVEL = ../../../.. include $(LEVEL)/Makefile.common -HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/Headers +# FIXME: Get version from a common place. +HeaderDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/lib/clang/1.0/include HEADERS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.h)) @@ -19,16 +20,12 @@ OBJHEADERS := $(addprefix $(HeaderDir)/, $(HEADERS)) $(OBJHEADERS): $(HeaderDir)/%.h: $(PROJ_SRC_DIR)/%.h $(HeaderDir)/.dir $(Verb) cp $< $@ - @echo Copying $(notdir $<) to build dir - -printit: - echo $(OBJHEADERS) - echo $(PROJ_SRC_DIR) - + $(Echo) Copying $(notdir $<) to build dir + # Hook into the standard Makefile rules. all-local:: $(OBJHEADERS) -PROJ_headers := $(DESTDIR)$(PROJ_prefix)/Headers +PROJ_headers := $(DESTDIR)$(PROJ_prefix)/lib/clang/1.0/include INSTHEADERS := $(addprefix $(PROJ_headers)/, $(HEADERS)) @@ -37,6 +34,7 @@ $(PROJ_headers): $(INSTHEADERS): $(PROJ_headers)/%.h: $(HeaderDir)/%.h | $(PROJ_headers) $(Verb) $(DataInstall) $< $(PROJ_headers) + $(Echo) Installing compiler include file: $(notdir $<) install-local:: $(INSTHEADERS)