X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Makefile.rules;h=a7a4879910995f71ae4f3751ff4300c93bb2d8a4;hb=328da65bd14045d3e229cbc5549835cebf6ff703;hp=13efb39ffa216c2cf9294389183ebd69263fda97;hpb=8475ec068c213d0bf73f7686d82491a8f12e3b32;p=oota-llvm.git diff --git a/Makefile.rules b/Makefile.rules index 13efb39ffa2..a7a48799109 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -2,8 +2,8 @@ # # The LLVM Compiler Infrastructure # -# This file was developed by the LLVM research group and is distributed under -# the University of Illinois Open Source License. See LICENSE.TXT for details. +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. # #===------------------------------------------------------------------------===# # @@ -23,7 +23,7 @@ RecursiveTargets := all clean clean-all install uninstall install-bytecode LocalTargets := all-local clean-local clean-all-local check-local \ install-local printvars uninstall-local \ install-bytecode-local -TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \ +TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \ dist-zip UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets) InternalTargets := preconditions distdir dist-hook @@ -38,7 +38,7 @@ InternalTargets := preconditions distdir dist-hook VPATH=$(PROJ_SRC_DIR) #-------------------------------------------------------------------- -# Reset the list of suffixes we know how to build +# Reset the list of suffixes we know how to build. #-------------------------------------------------------------------- .SUFFIXES: .SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot .ll @@ -159,7 +159,7 @@ endif #------------------------------------------------------------------------ ifneq ($(PROJ_OBJ_DIR),$(PROJ_SRC_DIR)) -Makefile: $(PROJ_SRC_DIR)/Makefile +Makefile: $(PROJ_SRC_DIR)/Makefile $(ExtraMakefiles) $(Echo) "Updating Makefile" $(Verb) $(MKDIR) $(@D) $(Verb) $(CP) -f $< $@ @@ -171,11 +171,11 @@ $(PROJ_OBJ_DIR)/Makefile% : $(PROJ_SRC_DIR)/Makefile% @case '$?' in \ *Makefile.rules) ;; \ *.in) ;; \ - *) $(Echo) "Updating $(@F)" ; \ + *) $(EchoCmd) "Updating $(@F)" ; \ $(MKDIR) $(@D) ; \ $(CP) -f $< $@ ;; \ esac - + endif #------------------------------------------------------------------------ @@ -199,6 +199,7 @@ install-bytecode:: install-bytecode-local # Variables derived from configuration we are building #-------------------------------------------------------------------- +CPP.Defines := # OPTIMIZE_OPTION - The optimization level option we want to build LLVM with # this can be overridden on the make command line. ifneq ($(OS),MingW) @@ -209,9 +210,10 @@ endif ifdef ENABLE_PROFILING BuildMode := Profile - CXX.Flags := $(OPTIMIZE_OPTION) -pg -g - C.Flags := $(OPTIMIZE_OPTION) -pg -g - LD.Flags := $(OPTIMIZE_OPTION) -pg -g + CXX.Flags += $(OPTIMIZE_OPTION) -pg -g + C.Flags += $(OPTIMIZE_OPTION) -pg -g + LD.Flags += $(OPTIMIZE_OPTION) -pg -g + KEEP_SYMBOLS := 1 else ifeq ($(ENABLE_OPTIMIZED),1) BuildMode := Release @@ -224,17 +226,17 @@ else # Darwin requires -fstrict-aliasing to be explicitly enabled. ifeq ($(OS),Darwin) - EXTRA_OPTIONS += -fstrict-aliasing + EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing endif - CXX.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer) - C.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer) - LD.Flags := $(OPTIMIZE_OPTION) + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) + C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) + LD.Flags += $(OPTIMIZE_OPTION) else BuildMode := Debug - CXX.Flags := -g - C.Flags := -g - LD.Flags := -g + CXX.Flags += -g + C.Flags += -g + LD.Flags += -g KEEP_SYMBOLS := 1 endif endif @@ -244,15 +246,26 @@ ifndef REQUIRES_EH CXX.Flags += -fno-exceptions endif +# IF REQUIRES_RTTI=1 is specified then don't disable run-time type id +ifndef REQUIRES_RTTI +# CXX.Flags += -fno-rtti +endif + # If DISABLE_ASSERTIONS=1 is specified (make command line or configured), # then disable assertions by defining the appropriate preprocessor symbols. ifdef DISABLE_ASSERTIONS BuildMode := $(BuildMode)-Asserts - CXX.Flags += -DNDEBUG - C.Flags += -DNDEBUG + CPP.Defines += -DNDEBUG else - CXX.Flags += -D_DEBUG - C.Flags += -D_DEBUG + CPP.Defines += -D_DEBUG +endif + +# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or +# configured), then enable expensive checks by defining the +# appropriate preprocessor symbols. +ifdef ENABLE_EXPENSIVE_CHECKS + BuildMode := $(BuildMode)+Checks + CPP.Defines += -D_GLIBCXX_DEBUG endif ifeq ($(ENABLE_PIC),1) @@ -262,7 +275,8 @@ endif CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual C.Flags += $(CFLAGS) -CPP.BaseFlags += $(CPPFLAGS) +CPP.Defines += $(CPPFLAGS) +CPP.BaseFlags += $(CPP.Defines) LD.Flags += $(LDFLAGS) AR.Flags := cru LibTool.Flags := --tag=CXX @@ -437,15 +451,18 @@ ifdef UNIVERSAL DISABLE_AUTO_DEPENDENCIES=1 endif +ifeq ($(OS),SunOS) +CPP.BaseFlags += -include llvm/System/Solaris.h +endif + LD.Flags += -L$(LibDir) -L$(LLVMLibDir) CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS # All -I flags should go here, so that they don't confuse llvm-config. -CPP.Flags += -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ - -I$(PROJ_OBJ_ROOT)/include \ - -I$(PROJ_SRC_ROOT)/include \ - -I$(LLVM_OBJ_ROOT)/include \ - -I$(LLVM_SRC_ROOT)/include \ - $(CPP.BaseFlags) +CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ + $(patsubst %,-I%/include,\ + $(PROJ_OBJ_ROOT) $(PROJ_SRC_ROOT) \ + $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \ + $(CPP.BaseFlags) Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C) @@ -469,8 +486,14 @@ LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \ ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 ScriptInstall = $(INSTALL) -m 0755 DataInstall = $(INSTALL) -m 0644 -TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) -I$(PROJ_SRC_ROOT)/include \ - -I $(PROJ_SRC_ROOT)/lib/Target + +# When compiling under Mingw/Cygwin, the tblgen tool expects Windows +# paths. In this case, the SYSPATH function (defined in +# Makefile.config) transforms Unix paths into Windows paths. +TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \ + -I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \ + -I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target) + Archive = $(AR) $(AR.Flags) LArchive = $(LLVMToolDir)/llvm-ar rcsf ifdef RANLIB @@ -682,7 +705,7 @@ ifdef LINK_COMPONENTS $(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)) @@ -709,7 +732,7 @@ $(warning Modules require llvm-gcc but no llvm-gcc is available ****) else Module := $(LibDir)/$(MODULE_NAME).bc -LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) +LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r ifdef EXPORTED_SYMBOL_FILE @@ -786,7 +809,7 @@ SharedLibKindMessage := "Loadable Module" else SharedLibKindMessage := "Shared Library" endif -$(LibName.LA): $(ObjectsLO) $(LibDir)/.dir +$(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ $(LIBRARYNAME)$(SHLIBEXT) $(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \ @@ -1065,23 +1088,28 @@ ifndef DISABLE_AUTO_DEPENDENCIES # Create .lo files in the ObjDir directory from the .cpp and .c files... #--------------------------------------------------------- +DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \ + -MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d" + +# If the build succeeded, move the dependency file over. If it failed, put an +# empty file there. +DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \ + else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi + $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\ - then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi + $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(DEPEND_MOVEFILE) $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\ - then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi + $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(DEPEND_MOVEFILE) $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) - $(Verb) if $(MAYBE_PIC_Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \ - then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi + $(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ + $(DEPEND_MOVEFILE) #--------------------------------------------------------- # Create .bc files in the ObjDir directory from .cpp .cc and .c files... @@ -1229,57 +1257,62 @@ $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \ $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir $(Echo) "Building $( $(PROJ_SRC_DIR)/$*.cpp - -# IFF the .l file has changed since it was last checked into CVS, copy the .l + +# IFF the .l file has changed since it was last checked into SVN, copy the .l # file to .l.cvs and the generated .cpp file to .cpp.cvs. We use this mechanism # so that people without flex can build LLVM by copying the .cvs files to the # source location and building them. @@ -1354,17 +1387,14 @@ all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs) %.h: %.y # Rule for building the bison based parsers... -$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y ifneq ($(BISON),) +$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y $(Echo) "Bisoning $*.y" $(Verb) $(BISON) -v -d -p $(