Add a new make option (LINK_COMPONENTS) which tools can use to specify what

libraries they need.  This uses llvm-config to link the tools.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-09-04 04:47:21 +00:00
parent 87b5101248
commit ef0d0f12f0

View File

@ -297,6 +297,7 @@ ifndef TBLGEN
TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT) TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT)
endif endif
endif endif
LLVM_CONFIG := $(LLVMToolDir)/llvm-config
ifndef GCCAS ifndef GCCAS
GCCAS := $(LLVMToolDir)/gccas$(EXEEXT) GCCAS := $(LLVMToolDir)/gccas$(EXEEXT)
endif endif
@ -629,7 +630,6 @@ endif
# JIT support for a library or a tool that runs JIT. # JIT support for a library or a tool that runs JIT.
#--------------------------------------------------------- #---------------------------------------------------------
ifeq ($(firstword $(LLVMLIBS)),config) ifeq ($(firstword $(LLVMLIBS)),config)
LLVM_CONFIG := $(LLVM_SRC_ROOT)/utils/llvm-config/llvm-config
LLVMLIBS := $(shell $(LLVM_CONFIG) --libnames $(wordlist 2,9999,$(LLVMLIBS))) LLVMLIBS := $(shell $(LLVM_CONFIG) --libnames $(wordlist 2,9999,$(LLVMLIBS)))
LLVMLIBS := $(patsubst lib%.a,%.a,$(LLVMLIBS)) LLVMLIBS := $(patsubst lib%.a,%.a,$(LLVMLIBS))
LLVMLIBS := $(patsubst %.o,%,$(LLVMLIBS)) LLVMLIBS := $(patsubst %.o,%,$(LLVMLIBS))
@ -690,17 +690,27 @@ endif
# Define various command line options pertaining to the # Define various command line options pertaining to the
# libraries needed when linking. There are "Proj" libs # libraries needed when linking. There are "Proj" libs
# (defined by the user's project) and "LLVM" libs (defined # (defined by the user's project) and "LLVM" libs (defined
# by the # LLVM project). # by the LLVM project).
#--------------------------------------------------------- #---------------------------------------------------------
ifdef USEDLIBS
ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
endif
ifdef LLVMLIBS
LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS))) LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions)) LLVMLibsOptions := $(patsubst %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions))
ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS)))
ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs))
LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs))
endif
ifdef LINK_COMPONENTS
ProjLibsOptions := $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
ProjLibsPaths := $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
endif
############################################################################### ###############################################################################
# Library Build Rules: Four ways to build a library # Library Build Rules: Four ways to build a library