[Lldb-commits] [lldb] 546f8f4 - [lldb/testsuite] Modernize 2 test Makefiles

Fred Riss via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 17 21:01:20 PST 2020


Author: Fred Riss
Date: 2020-01-17T20:56:28-08:00
New Revision: 546f8f426463c7c22a3a8731803a501ff044ba20

URL: https://github.com/llvm/llvm-project/commit/546f8f426463c7c22a3a8731803a501ff044ba20
DIFF: https://github.com/llvm/llvm-project/commit/546f8f426463c7c22a3a8731803a501ff044ba20.diff

LOG: [lldb/testsuite] Modernize 2 test Makefiles

Those old Makefiles used completely ad-hoc rules for building files,
which means they didn't obey the test harness' variants.

They were somewhat tricky to update as they use very peculiar build
flags for some files. For this reason I was careful to compare the
build commands before and after the change, which is how I found the
discrepancy fixed by the previous commit.

While some of the make syntax used here might not be easy to grasp for
newcomers (per-target variable overrides), it seems better than to
have to repliacte the Makefile.rules logic for the test variants and
platform support.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
    lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
index 769920c28336..c39743d999da 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
@@ -1,33 +1,22 @@
-CXX_SOURCES = main.cpp length.cpp a.cpp
-
-CFLAGS_LIMIT = -c $(CXXFLAGS)
-CFLAGS_NO_LIMIT = -c $(CXXFLAGS)
-
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_LIMIT += -flimit-debug-info
-  CFLAGS_NO_LIMIT += -fno-limit-debug-info
-endif
+CXX_SOURCES := length.cpp a.o main.o
+EXE := nolimit
 
 all: limit nolimit
 
-limit: main.o length_limit.o a.o
-	$(CXX) main.o length_limit.o a.o -o limit $(LDFLAGS)
-
-nolimit: main.o length_nolimit.o a.o
-	$(CXX) main.o length_nolimit.o a.o -o nolimit $(LDFLAGS)
-
-main.o: main.cpp
-	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/main.cpp -o main.o
-
-length_limit.o: length.cpp
-	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/length.cpp -o length_limit.o
+include Makefile.rules
 
-length_nolimit.o: length.cpp
-	$(CXX) $(CFLAGS_NO_LIMIT) $(SRCDIR)/length.cpp -o length_nolimit.o
+# Force a.cpp to be built with no debug inforamtion
+a.o: CFLAGS = $(CFLAGS_NO_DEBUG)
 
-a.o: a.cpp
-	$(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/a.cpp -o a.o
+# The default testsuite setup forces -fno-limit-debug-info. Let's not rely on
+# CFLAGS_EXTRAS being passed after the default arguments. This rule makes
+# sure the variable used by Makefile.rules for this argument is cleared.
+main.o: NO_LIMIT_DEBUG_INFO_FLAGS = ""
+main.o: CFLAGS_EXTRAS = -flimit-debug-info
 
-clean: OBJECTS += limit nolimit length_limit.o length_nolimit.o length_limit.dwo length_nolimit.dwo
+limit: a.o main.o
+	mkdir -p build_limit
+	$(MAKE) -C $(BUILDDIR)/build_limit -f $(MAKEFILE_RULES) \
+		EXE=../limit CXX_SOURCES="length.cpp ../a.o ../main.o" \
+		CFLAGS_EXTRAS=-flimit-debug-info NO_LIMIT_DEBUG_INFO_FLAGS=""
 
-include Makefile.rules

diff  --git a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
index ba7e23acabab..5d920f442136 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
@@ -1,13 +1,8 @@
-CFLAGS := -g -O0
-CFLAGS_NO_DEBUG = 
+OBJC_SOURCES := myclass.m repro.m
+LD_EXTRAS := -framework Foundation
 
-all: aout
-
-aout: 
-	$(CC) $(CFLAGS_NO_DEBUG) $(SRCDIR)/myclass.m -c -o myclass.o
-	$(CC) $(CFLAGS) myclass.o $(SRCDIR)/repro.m -framework Foundation
+include Makefile.rules
 
-clean::
-	rm -f myclass.o
+# Force myclass.m to be compiled without debug info
+myclass.o: CFLAGS = $(CFLAGS_NO_DEBUG)
 
-include Makefile.rules


        


More information about the lldb-commits mailing list