llvm-config: Fixup r197380, tweak for cross compilation. SYSTEM_LIBS should be --host's in BuildTools/llvm-config.

FIXME: Host's llvm-config is not generated. It's for target's.
Host tools, aka "BuildTools", in utils, do not require llvm-config to build.

For example with --host=i686-pc-mingw32 --build=linux,

  $ BuildTools/Release+Asserts/bin/llvm-config --libs support
  -lLLVMSupport
  -lpthread -lshell32 -lpsapi -limagehlp -lm

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197382 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2013-12-16 13:09:06 +00:00
parent 56c390e709
commit 64f5838550
2 changed files with 10 additions and 1 deletions

View File

@ -126,6 +126,7 @@ cross-compile-build-tools:
SDKROOT= \
TARGET_NATIVE_ARCH="$(TARGET_NATIVE_ARCH)" \
TARGETS_TO_BUILD="$(TARGETS_TO_BUILD)" \
TARGET_LIBS="$(LIBS)" \
ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
ENABLE_PROFILING=$(ENABLE_PROFILING) \
ENABLE_COVERAGE=$(ENABLE_COVERAGE) \

View File

@ -30,6 +30,14 @@ SUB_CPPFLAGS := ${CPP.BaseFlags}
SUB_CFLAGS := ${CPP.BaseFlags} ${C.Flags}
SUB_CXXFLAGS := ${CPP.BaseFlags} ${CXX.Flags}
# Override LIBS with TARGET's LIBS for cross compilation.
# FIXME: Host's llvm-config is not generated. It's for target's.
ifneq ($(TARGET_LIBS), )
LLVM_SYSTEM_LIBS := $(TARGET_LIBS)
else
LLVM_SYSTEM_LIBS := $(LIBS)
endif
# This is blank for now. We need to be careful about adding stuff here:
# LDFLAGS tend not to be portable, and we don't currently require the
# user to use libtool when linking against LLVM.
@ -51,7 +59,7 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
>> temp.sed
$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
>> temp.sed
$(Verb) $(ECHO) 's/@LLVM_SYSTEM_LIBS@/$(subst /,\/,$(LIBS))/' \
$(Verb) $(ECHO) 's/@LLVM_SYSTEM_LIBS@/$(subst /,\/,$(LLVM_SYSTEM_LIBS))/' \
>> temp.sed
$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
>> temp.sed