[Lldb-commits] [PATCH] D25922: Test infra: expose CFLAGS_NO_ARCH for use by test custom build rules

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 24 13:11:08 PDT 2016


tfiala created this revision.
tfiala added reviewers: jingham, labath.
tfiala added a subscriber: lldb-commits.

The TestUniversal.py test was attempting to build its own CFLAGS unreliably.  Essentially it just wanted the prevailing CFLAGS without the arch spec.

This change does the following:

- introduces a new makefile variable CFLAGS_NO_ARCH, which custom build rules can use to grab the prevailing CFLAGS for the build without the arch-specific flags, and
- uses this new flag in TestUniversal.py's Makefile, eliminating the divergence it had from the CFLAGS used for standard test inferiors.


https://reviews.llvm.org/D25922

Files:
  Python/lldbsuite/test/macosx/universal/Makefile
  Python/lldbsuite/test/make/Makefile.rules


Index: Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- Python/lldbsuite/test/make/Makefile.rules
+++ Python/lldbsuite/test/make/Makefile.rules
@@ -193,13 +193,10 @@
 DEBUG_INFO_FLAG ?= -g
 
 CFLAGS ?= $(DEBUG_INFO_FLAG) -O0 -fno-builtin
-ifeq "$(OS)" "Darwin"
-	CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
-else
-	CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
-endif
+CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS)
+CFLAGS_NO_ARCH := $(CFLAGS)
 
-CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS)
+CFLAGS += $(ARCHFLAG)$(ARCH)
 
 # Use this one if you want to build one part of the result without debug information:
 ifeq "$(OS)" "Darwin"
Index: Python/lldbsuite/test/macosx/universal/Makefile
===================================================================
--- Python/lldbsuite/test/macosx/universal/Makefile
+++ Python/lldbsuite/test/macosx/universal/Makefile
@@ -1,5 +1,14 @@
 CC ?= clang
 
+all: testit
+
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
+
+
 testit: testit.i386 testit.x86_64
 	lipo -create -o testit testit.i386 testit.x86_64
 
@@ -10,10 +19,10 @@
 	$(CC) -arch x86_64 -o testit.x86_64 testit.x86_64.o
 
 testit.i386.o: main.c
-	$(CC) -g -O0 -arch i386 -c -o testit.i386.o main.c
+	$(CC) $(CFLAGS_NO_ARCH) -arch i386 -c -o testit.i386.o main.c
 
 testit.x86_64.o: main.c
-	$(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o main.c
+	$(CC) $(CFLAGS_NO_ARCH) -arch x86_64 -c -o testit.x86_64.o main.c
 
-clean:
+clean::
 	rm -rf $(wildcard testit* *~)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25922.75636.patch
Type: text/x-patch
Size: 1767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161024/efdaf1bd/attachment.bin>


More information about the lldb-commits mailing list