Add a CFLAGS_EXTRAS make variable to be able to pass things (like '-DTEST_BLOCK_CAPTURED_VARS') to the compile phase.
Plus add a DYLIB_ONLY make variable that can be used to turn off compilation/building of a.out. Example:
[16:39:21] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $ make clean
rm -rf "a.out" "a.out.dSYM" main.o main.d a.o a.d liba.dylib liba.dylib.dSYM
[16:39:24] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $ make DYLIB_ONLY=YES
clang -gdwarf-2 -O0 -arch x86_64 -c -o a.o a.c
clang -gdwarf-2 -O0 -arch x86_64 a.o -install_name "@executable_path/liba.dylib" -dynamiclib -o "liba.dylib"
[16:39:30] johnny:/Volumes/data/lldb/svn/trunk/test/lang/c/global_variables $
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147821 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/make/Makefile.rules b/test/make/Makefile.rules
index 2f6e40f..80cb409 100644
--- a/test/make/Makefile.rules
+++ b/test/make/Makefile.rules
@@ -42,7 +42,7 @@
# Change any build/tool options needed
#----------------------------------------------------------------------
CFLAGS ?= -gdwarf-2 -O0
-CFLAGS += $(FRAMEWORK_INCLUDES)
+CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
ifeq "$(OS)" "Darwin"
CFLAGS += -arch $(ARCH)
DS := dsymutil
@@ -122,24 +122,36 @@
#----------------------------------------------------------------------
+# DYLIB_ONLY variable can be used to skip the building of a.out.
+# See the sections below regarding dSYM file as well as the building of
+# EXE from all the objects.
+#----------------------------------------------------------------------
+
+#----------------------------------------------------------------------
# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
#----------------------------------------------------------------------
ifeq "$(OS)" "Darwin"
ifneq "$(MAKE_DSYM)" "NO"
+ifeq "$(DYLIB_ONLY)" ""
$(DSYM) : $(EXE)
$(DS) $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
endif
endif
+endif
#----------------------------------------------------------------------
# Compile the executable from all the objects.
#----------------------------------------------------------------------
-ifeq "$(DYLIB_NAME)" ""
-$(EXE) : $(OBJECTS)
- $(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
-else
+ifneq "$(DYLIB_NAME)" ""
+ifeq "$(DYLIB_ONLY)" ""
$(EXE) : $(OBJECTS) $(DYLIB_FILENAME)
$(LD) $(LDFLAGS) $(OBJECTS) -L. -l$(DYLIB_NAME) -o "$(EXE)"
+else
+EXE = $(DYLIB_FILENAME)
+endif
+else
+$(EXE) : $(OBJECTS)
+ $(LD) $(LDFLAGS) $(OBJECTS) -o "$(EXE)"
endif
#----------------------------------------------------------------------