diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-05-12 06:35:50 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-05-12 06:35:50 +0000 |
commit | fab3d68852f50207e28d0224b4ae007927badaa6 (patch) | |
tree | a83eda4e046dbf9e3f47234e24fee30a147b8453 /Makefile.rules | |
parent | e2dc4e0639a85b6e7b1e3381d10194a64fc500e9 (diff) |
Refactor dependency generation for .ll files.
- This matches the normal dependency generation code.
- This also fixes the problem that when building a normal and bitcode
archive from the same source, the dependency files would overwrite
one another. Which was bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71542 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r-- | Makefile.rules | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/Makefile.rules b/Makefile.rules index fc22d98068..bcaed80f2d 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -1227,8 +1227,8 @@ ifndef DISABLE_AUTO_DEPENDENCIES DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \ -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d" -# If the build succeeded, move the dependency file over. If it failed, put an -# empty file there. +# If the build succeeded, move the dependency file over, otherwise +# remove it. DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \ else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi @@ -1251,26 +1251,31 @@ $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) # Create .bc files in the ObjDir directory from .cpp .cc and .c files... #--------------------------------------------------------- +BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \ + -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d" + +# If the build succeeded, move the dependency file over, otherwise +# remove it. +BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \ + else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi + $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX) $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \ - $< -o $@ -S -emit-llvm ; \ - then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi + $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \ + $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \ + $(BC_DEPEND_MOVEFILE) $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX) $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \ - $< -o $@ -S -emit-llvm ; \ - then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi + $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \ + $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \ + $(BC_DEPEND_MOVEFILE) $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC) $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" \ - $< -o $@ -S -emit-llvm ; \ - then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \ - else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi + $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \ + $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \ + $(BC_DEPEND_MOVEFILE) # Provide alternate rule sets if dependencies are disabled else @@ -1521,8 +1526,13 @@ ifndef DISABLE_AUTO_DEPENDENCIES ifndef IS_CLEANING_TARGET # Get the list of dependency files -DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) -DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d) +DependSourceFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) +DependFiles := $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d) + +# Include bitcode dependency files if using bitcode libraries +ifdef BYTECODE_LIBRARY +DependFiles += $(DependSourceFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.bc.d) +endif -include $(DependFiles) "" |