[Lldb-commits] [lldb] 9decf04 - [lldb/test] Simplify Makefile rules for .d files

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 20 06:53:38 PDT 2020


Author: Pavel Labath
Date: 2020-07-20T15:53:19+02:00
New Revision: 9decf0405fe1bd79325ca47dba15d8914608e242

URL: https://github.com/llvm/llvm-project/commit/9decf0405fe1bd79325ca47dba15d8914608e242
DIFF: https://github.com/llvm/llvm-project/commit/9decf0405fe1bd79325ca47dba15d8914608e242.diff

LOG: [lldb/test] Simplify Makefile rules for .d files

The sed line in the rules was adding the .d file as a target to the
dependency rules -- to ensure the file gets rebuild when the sources
change. The same thing can be achieved more elegantly with some -M
flags.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index b9a6937650d0..43352b620b16 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -727,28 +727,16 @@ endif
 # and the -MM option will list all non-system dependencies.
 #----------------------------------------------------------------------
 %.d: %.c
-	@rm -f $@
-	@$(CC) -M $(CFLAGS) $< > $@.tmp && \
-	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@
-	@rm -f $@.tmp
+	$(CC) -M $(CFLAGS) $< -MF $@ -MT $@ -MT $*.o
 
 %.d: %.cpp
-	@rm -f $@
-	@$(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
-	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@
-	@rm -f $@.tmp
+	@$(CXX) -M $(CXXFLAGS) $< -MF $@ -MT $@ -MT $*.o
 
 %.d: %.m
-	@rm -f $@
-	@$(CC) -M $(CFLAGS) $< > $@.tmp && \
-	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@
-	@rm -f $@.tmp
+	@$(CC) -M $(CFLAGS) $< -MF $@ -MT $@ -MT $*.o
 
 %.d: %.mm
-	@rm -f $@
-	@$(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
-	sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@
-	@rm -f $@.tmp
+	@$(CXX) -M $(CXXFLAGS) $< -MF $@ -MT $@ -MT $*.o
 
 #----------------------------------------------------------------------
 # Include all of the makefiles for each source file so we don't have


        


More information about the lldb-commits mailing list