X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Makefile.rules;h=b6ad1b56ad4aa14b7cff5be6010c340dfcb1eab8;hb=5c2aa0a4d819039a8f31d04041f6c8056cd10fb7;hp=88fa992c51178cc28c08c46eb5eed16c19617362;hpb=99655e16a6b0eafc8e18e73efe3ab27d2faf0a4a;p=oota-llvm.git diff --git a/Makefile.rules b/Makefile.rules index 88fa992c511..b6ad1b56ad4 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -73,6 +73,7 @@ PreConditions := $(ConfigStatusScript) $(ObjMakefiles) ifneq ($(MakefileCommonIn),) PreConditions += $(MakefileCommon) endif + ifneq ($(MakefileConfigIn),) PreConditions += $(MakefileConfig) endif @@ -239,9 +240,9 @@ else endif # IF REQUIRES_EH=1 is specified then don't disable exceptions -#ifndef REQUIRES_EH -# CXX.Flags += -fno-exceptions -#endif +ifndef REQUIRES_EH + CXX.Flags += -fno-exceptions +endif # If DISABLE_ASSERTIONS=1 is specified (make command line or configured), # then disable assertions by defining the appropriate preprocessor symbols. @@ -254,7 +255,7 @@ else C.Flags += -D_DEBUG endif -CXX.Flags += $(CXXFLAGS) +CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual C.Flags += $(CFLAGS) CPP.BaseFlags += $(CPPFLAGS) LD.Flags += $(LDFLAGS) @@ -297,13 +298,14 @@ ifndef TBLGEN TBLGEN := $(LLVMToolDir)/tblgen$(EXEEXT) endif endif +LLVM_CONFIG := $(LLVMToolDir)/llvm-config ifndef GCCAS GCCAS := $(LLVMToolDir)/gccas$(EXEEXT) endif ifndef GCCLD GCCLD := $(LLVMToolDir)/gccld$(EXEEXT) endif -ifndef LDIS +ifndef LLVMDIS LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT) endif ifndef LLI @@ -623,83 +625,43 @@ endif # Set up variables for building libararies ############################################################################### -#--------------------------------------------------------- -# Handle the special "JIT" value for LLVM_LIBS which is a -# shorthand for a bunch of libraries that get the correct -# JIT support for a library or a tool that runs JIT. -#--------------------------------------------------------- -ifeq ($(firstword $(LLVMLIBS)),config) -LLVM_CONFIG := $(LLVM_SRC_ROOT)/utils/llvm-config/llvm-config -LLVMLIBS := $(shell $(LLVM_CONFIG) --libnames $(wordlist 2,9999,$(LLVMLIBS))) -LLVMLIBS := $(patsubst lib%.a,%.a,$(LLVMLIBS)) -LLVMLIBS := $(patsubst %.o,%,$(LLVMLIBS)) -endif - -ifeq ($(LLVMLIBS),JIT) - -# Make sure we can get our own symbols in the tool -Link += -dlopen self - -# Generic JIT libraries -JIT_LIBS := LLVMInterpreter LLVMJIT LLVMSelectionDAG.a LLVMCodeGen.a \ - LLVMExecutionEngine - -# You can enable the X86 JIT on a non-X86 host by setting the flag -# ENABLE_X86_JIT on the make command line. If not, it will still be -# enabled automagically on an X86 host. -ifeq ($(ARCH), x86) - ENABLE_X86_JIT = 1 -endif - -# What the X86 JIT requires -ifdef ENABLE_X86_JIT - JIT_LIBS += LLVMX86 -endif - -# You can enable the PowerPC JIT on a non-PowerPC host by setting the flag -# ENABLE_PPC_JIT on the make command line. If not, it will still be -# enabled automagically on an PowerPC host. -ifeq ($(ARCH), PowerPC) - ENABLE_PPC_JIT = 1 -endif - -# What the PowerPC JIT requires -ifdef ENABLE_PPC_JIT - JIT_LIBS += LLVMPowerPC -endif - -# You can enable the Alpha JIT on a non-Alpha host by setting the flag -# ENABLE_ALPHA_JIT on the make command line. If not, it will still be -# enabled automagically on an Alpha host. -ifeq ($(ARCH), Alpha) - ENABLE_ALPHA_JIT = 1 -endif - -# What the Alpha JIT requires -ifdef ENABLE_ALPHA_JIT - JIT_LIBS += LLVMAlpha -endif - -LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts.a LLVMTransformUtils.a LLVMAnalysis.a \ - LLVMBCReader.a LLVMTarget.a LLVMCore.a LLVMSupport.a LLVMbzip2.a \ - LLVMSystem.a $(PLATFORMLIBDL) -endif - #--------------------------------------------------------- # Define various command line options pertaining to the # libraries needed when linking. There are "Proj" libs # (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 %.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 %.o, $(LLVMLibDir)/%.o, $(LLVMLibsOptions)) -ProjUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) LLVMUsedLibs := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(LLVMLIBS))) -ProjLibsPaths := $(addprefix $(LibDir)/,$(ProjUsedLibs)) LLVMLibsPaths := $(addprefix $(LLVMLibDir)/,$(LLVMUsedLibs)) +endif + +ifeq ($(strip $(filter clean clean-local dist-clean,$(MAKECMDGOALS))),) +ifdef LINK_COMPONENTS + +# If LLVM_CONFIG doesn't exist, build it. This can happen if you do a make +# clean in tools, then do a make in tools (instead of at the top level). +$(LLVM_CONFIG): + @echo "*** llvm-config doesn't exist - rebuilding it." + @$(MAKE) -C $(PROJ_OBJ_ROOT)/tools/llvm-config + +$(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG) + +ProjLibsOptions = $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS)) +ProjLibsPaths = $(LLVM_CONFIG) \ + $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS)) +endif +endif ############################################################################### # Library Build Rules: Four ways to build a library @@ -976,13 +938,6 @@ else ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT) endif -#--------------------------------------------------------- -# Tell make that we need to rebuild subdirectories before -# we can link the tool. This affects things like LLI which -# has library subdirectories. -#--------------------------------------------------------- -$(ToolBuildPath): $(addsuffix /.makeall, $(PARALLEL_DIRS)) - #--------------------------------------------------------- # Provide targets for building the tools #--------------------------------------------------------- @@ -1404,7 +1359,7 @@ CTAGS: ifndef DISABLE_AUTO_DEPENDENCIES # If its not one of the cleaning targets -ifneq ($strip($(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),) +ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),) # Get the list of dependency files DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))