X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Makefile.rules;h=7dfb2b415079010c9e08b3635dfcb2b3d4057b47;hb=b942a3dd5f9318b2c57f137d2991440c2f0262ad;hp=fc4e7a8857b95bec5687f522634b5f49680d6510;hpb=1a9a69c59636859c9dbb980a52850278f7ebd71c;p=oota-llvm.git diff --git a/Makefile.rules b/Makefile.rules index fc4e7a8857b..7dfb2b41507 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -275,6 +275,9 @@ endif ifndef LLI LLI := $(LLVMToolDir)/lli$(EXEEXT) endif +ifndef LLC +LLC := $(LLVMToolDir)/llc$(EXEEXT) +endif ifndef LOPT LOPT := $(LLVMToolDir)/opt$(EXEEXT) endif @@ -305,7 +308,6 @@ ifdef TOOL_VERBOSE C.Flags += -v CXX.Flags += -v LD.Flags += -v - Install.Flags += -v VERBOSE := 1 endif @@ -323,7 +325,7 @@ endif ifndef KEEP_SYMBOLS Strip := $(PLATFORMSTRIPOPTS) StripWarnMsg := "(without symbols)" - Install.Flags += -s + Install.StripFlag += -s endif # Adjust linker flags for building an executable @@ -341,6 +343,10 @@ endif CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused +ifeq ($(OS),HP-UX) + CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE +endif + LD.Flags += -L$(LibDir) -L$(LLVMLibDir) CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ -I$(PROJ_OBJ_ROOT)/include \ @@ -363,7 +369,8 @@ Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \ $(CompileCommonOpts) LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ $(Install.Flags) -Install = $(INSTALL) $(Install.Flags) +ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 +DataInstall = $(INSTALL) -m 0644 Burg = $(BURG) -I $(PROJ_SRC_DIR) TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) Archive = $(AR) $(AR.Flags) @@ -416,17 +423,10 @@ endif # in the file so they get built before dependencies #--------------------------------------------------------- -$(PROJ_bindir): - $(Verb) $(MKDIR) $(PROJ_bindir) - -$(PROJ_libdir): - $(Verb) $(MKDIR) $(PROJ_libdir) - -$(PROJ_includedir): - $(Verb) $(MKDIR) $(PROJ_includedir) - -$(PROJ_etcdir): - $(Verb) $(MKDIR) $(PROJ_etcdir) +$(PROJ_bindir): $(PROJ_bindir)/.dir +$(PROJ_libdir): $(PROJ_libdir)/.dir +$(PROJ_includedir): $(PROJ_includedir)/.dir +$(PROJ_etcdir): $(PROJ_etcdir)/.dir # To create other directories, as needed, and timestamp their creation %/.dir: @@ -530,9 +530,9 @@ install-local:: $(PROJ_etcdir) $(CONFIG_FILES) $(Echo) Installing Configuration Files To $(PROJ_etcdir) $(Verb)for file in $(CONFIG_FILES); do \ if test -f $(PROJ_OBJ_DIR)/$${file} ; then \ - $(Install) -D -m 0644 $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \ + $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \ elif test -f $(PROJ_SRC_DIR)/$${file} ; then \ - $(Install) -D -m 0644 $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \ + $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \ else \ $(ECHO) Error: cannot find config file $${file}. ; \ fi \ @@ -546,6 +546,100 @@ uninstall-local:: 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 ($(LLVMLIBS),JIT) + +# Make sure we can get our own symbols in the tool +Link += -dlopen self + +# Generic JIT libraries +JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen 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 LLVMSelectionDAG +endif + +# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag +# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be +# enabled automagically on an SparcV9 host. +ifeq ($(ARCH), Sparc) + ENABLE_SPARCV9_JIT = 1 +endif + +# What the Sparc JIT requires +ifdef ENABLE_SPARCV9_JIT + JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \ + LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \ + LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \ + LLVMDataStructure.a LLVMSparcV9RegAlloc +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 LLVMSelectionDAG +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 LLVMSelectionDAG +endif + +LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \ + LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \ + 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). +#--------------------------------------------------------- +# Some versions of gcc on Alpha produce too many symbols, so use a .a file +ifeq ($(ARCH),Alpha) +USEDLIBS := $(subst LLVMCore, LLVMCore.a, $(USEDLIBS)) +LLVMLIBS := $(subst LLVMCore, LLVMCore.a, $(LLVMLIBS)) +endif + +ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) +ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) +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)) + ############################################################################### # Library Build Rules: Four ways to build a library ############################################################################### @@ -560,7 +654,7 @@ endif ifdef MODULE_NAME ifeq ($(strip $(LLVMGCC)),) -$(warning Modules require llvm-gcc but no llvm-gcc is available) +$(warning Modules require llvm-gcc but no llvm-gcc is available ****) else Module := $(LibDir)/$(MODULE_NAME).bc @@ -571,7 +665,7 @@ LinkModule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) endif $(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD) - $(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@) + $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@) $(Verb) $(LinkModule) -o $@ $(ObjectsBC) all-local:: $(Module) @@ -594,7 +688,7 @@ install-local:: $(DestModule) $(DestModule): $(ModuleDestDir) $(Module) $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule) - $(Verb) $(Install) -D $(Module) $@ + $(Verb) $(DataInstall) $(Module) $(DestModule) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule) @@ -627,10 +721,18 @@ ifdef SHARED_LIBRARY all-local:: $(LibName.LA) +ifdef LINK_LIBS_IN_SHARED +$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir + $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT) + $(Verb) $(Link) -o $@ $(ObjectsLO) \ + $(ProjLibsOptions) $(LLVMLibsOptions) + $(Verb) $(LTInstall) $@ $(LibDir) +else $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT) $(Verb) $(Link) -o $@ $(ObjectsLO) $(Verb) $(LTInstall) $@ $(LibDir) +endif clean-local:: ifneq ($(strip $(LibName.LA)),) @@ -660,7 +762,7 @@ endif #--------------------------------------------------------- ifdef BYTECODE_LIBRARY ifeq ($(strip $(LLVMGCC)),) -$(warning Bytecode libraries require llvm-gcc which could not be found) +$(warning Bytecode libraries require llvm-gcc which could not be found ****) else # make the C and C++ compilers strip debug info out of bytecode libraries. @@ -708,7 +810,7 @@ install-local:: $(DestBytecodeLib) $(DestBytecodeLib): $(BytecodeDestDir) $(LibName.BCA) $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib) - $(Verb) $(Install) -D $(LibName.BCA) $@ + $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib) uninstall-local:: $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib) @@ -793,79 +895,14 @@ endif ifdef TOOLNAME -#--------------------------------------------------------- -# 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 tool that runs JIT. -#--------------------------------------------------------- -ifeq ($(LLVMLIBS),JIT) - -# Make sure we can get our own symbols in the tool -Link += -dlopen self - -# Generic JIT libraries -JIT_LIBS := LLVMInterpreter LLVMJIT LLVMCodeGen 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 LLVMSelectionDAG -endif - -# You can enable the SparcV9 JIT on a non-SparcV9 host by setting the flag -# ENABLE_SPARCV9_JIT on the make command line. If not, it will still be -# enabled automagically on an SparcV9 host. -ifeq ($(ARCH), Sparc) - ENABLE_SPARCV9_JIT = 1 -endif - -# What the Sparc JIT requires -ifdef ENABLE_SPARCV9_JIT - JIT_LIBS += LLVMSparcV9 LLVMSparcV9ModuloSched LLVMSparcV9InstrSched \ - LLVMSparcV9LiveVar LLVMInstrumentation.a LLVMProfilePaths \ - LLVMBCWriter LLVMTransforms.a LLVMipo.a LLVMipa.a \ - LLVMDataStructure.a LLVMSparcV9RegAlloc -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 - -LLVMLIBS := $(JIT_LIBS) LLVMScalarOpts LLVMAnalysis.a LLVMTransformUtils.a \ - LLVMBCReader LLVMCore LLVMSupport.a LLVMTarget.a LLVMbzip2 \ - LLVMSystem.a $(PLATFORMLIBDL) -endif - #--------------------------------------------------------- # Set up variables for building a tool. #--------------------------------------------------------- ifdef EXAMPLE_TOOL -ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT) +ToolBuildPath := $(ExmplDir)/$(strip $(TOOLNAME))$(EXEEXT) else -ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT) +ToolBuildPath := $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT) endif -ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS))) -ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions)) -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)) #--------------------------------------------------------- # Tell make that we need to rebuild subdirectories before @@ -902,7 +939,7 @@ install-local:: $(DestTool) $(DestTool): $(PROJ_bindir) $(ToolBuildPath) $(Echo) Installing $(BuildMode) $(DestTool) - $(Verb) $(Install) -D $(ToolBuildPath) $(DestTool) + $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool) uninstall-local:: $(Echo) Uninstalling $(BuildMode) $(DestTool) @@ -1347,7 +1384,7 @@ dist-check:: $(DistTarGZip) gunzip -c $(DistTarGZip) | $(TAR) xf - && \ cd build && \ ../$(DistName)/configure --prefix="$(DistCheckDir)/install" \ - --srcdir=../$(DistName) && \ + --srcdir=../$(DistName) $(DIST_CHECK_CONFIG_OPTIONS) && \ $(MAKE) all && \ $(MAKE) check && \ $(MAKE) install && \ @@ -1413,9 +1450,16 @@ $(DistDir)/.makedistdir: $(DistSources) if test -d "$$from_dir/$$file"; then \ if test -d "$(PROJ_SRC_DIR)/$$file" && \ test "$$from_dir" != "$(PROJ_SRC_DIR)" ; then \ - $(CP) -pR "$(PROJ_SRC_DIR)/$$file" "$$to_dir" || exit 1; \ + cd $(PROJ_SRC_DIR) ; \ + $(TAR) cf - $$file --exclude .svn --exclude CVS | \ + ( cd $$to_dir ; $(TAR) xf - ) ; \ + cd $(PROJ_OBJ_DIR) ; \ + else \ + cd $$from_dir ; \ + $(TAR) cf - $$file --exclude .svn --exclude CVS | \ + ( cd $$to_dir ; $(TAR) xf - ) ; \ + cd $(PROJ_OBJ_DIR) ; \ fi; \ - $(CP) -pR $$from_dir/$$file $$to_dir || exit 1; \ elif test -f "$$from_dir/$$file" ; then \ $(CP) -p "$$from_dir/$$file" "$(DistDir)/$$file" || exit 1; \ elif test -L "$$from_dir/$$file" ; then \ @@ -1436,8 +1480,8 @@ $(DistDir)/.makedistdir: $(DistSources) fi; \ done $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ - $(EchoCmd) Eliminating CVS directories from distribution ; \ - $(RM) -rf `find $(TopDistDir) -type d -name CVS -print` ;\ + $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \ + $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o -name .svn \) -print` ;\ $(MAKE) dist-hook ; \ $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \ -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \ @@ -1465,17 +1509,22 @@ ifeq ($(LEVEL),.) install-local:: $(Echo) Installing include files $(Verb) $(MKDIR) $(PROJ_includedir) - $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \ + $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \ cd $(PROJ_SRC_ROOT)/include && \ for hdr in `find . -type f '!' '(' -name '*~' -o -name '.cvsignore' \ -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS ` ; do \ - $(Install) -D -m 0644 $$hdr $(PROJ_includedir)/$$hdr ; \ + instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \ + if test \! -d "$$instdir" ; then \ + $(EchoCmd) Making install directory $$instdir ; \ + $(MKDIR) $$instdir ;\ + fi ; \ + $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ done ; \ fi - $(Verb) if [ -d "$(PROJ_OBJ_ROOT)/include" ] ; then \ + $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \ cd $(PROJ_OBJ_ROOT)/include && \ for hdr in `find . -type f -print` ; do \ - $(Install) -D -m 0644 $$hdr $(PROJ_includedir)/$$hdr ; \ + $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \ done ; \ fi @@ -1520,7 +1569,7 @@ printvars:: $(Echo) "TDFiles : " '$(TDFiles)' $(Echo) "INCFiles : " '$(INCFiles)' $(Echo) "INCTMPFiles : " '$(INCTMPFiles)' - $(Echo) "Preconditions: " '$(Preconditions)' + $(Echo) "PreConditions: " '$(PreConditions)' $(Echo) "Compile.CXX : " '$(Compile.CXX)' $(Echo) "Compile.C : " '$(Compile.C)' $(Echo) "Archive : " '$(Archive)'