X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Makefile.rules;h=e3a1009b862bc5c4fcae94120ae43a5108335d24;hb=81442c0d832872c8f50ec72aeaf937e06d8f3dfb;hp=2852ac38bfc888a30464c4adc71407444eb1e70f;hpb=eff155349acd73e555a81e7935a9ec4f48ea2bb5;p=oota-llvm.git diff --git a/Makefile.rules b/Makefile.rules index 2852ac38bfc..e3a1009b862 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 @@ -1079,23 +1079,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... @@ -1439,25 +1444,6 @@ endif clean-all-local:: -$(Verb) $(RM) -rf Debug Release Profile -# Build tags database for Emacs/Xemacs: -tags:: TAGS CTAGS - -TAGS: - find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \ - $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \ - $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \ - $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \ - -name '*.cpp' -o -name '*.h' | \ - $(ETAGS) $(ETAGSFLAGS) - - -CTAGS: - find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \ - $(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \ - $(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \ - $(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \ - \( -name '*.cpp' -o -name '*.h' \) -print | \ - ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L - - ############################################################################### # DEPENDENCIES: Include the dependency files if we should @@ -1471,7 +1457,7 @@ ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),) DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d) --include /dev/null $(DependFiles) +-include $(DependFiles) "" endif