CFLAGS ?= -g -O0
CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+CFLAGS += -include $(THIS_FILE_DIR)test_common.h
# Use this one if you want to build one part of the result without debug information:
CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
ifneq "$(DYLIB_NAME)" ""
ifeq "$(OS)" "Darwin"
DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
+ else ifeq "$(OS)" "Windows_NT"
+ DYLIB_FILENAME = $(DYLIB_NAME).dll
else
DYLIB_FILENAME = lib$(DYLIB_NAME).so
endif
ifneq (,$(findstring clang,$(CC)))
# Clang for Windows doesn't support C++ Exceptions
CXXFLAGS += -fno-exceptions
- CXXFLAGS += -include $(THIS_FILE_DIR)uncaught_exception.h
CXXFLAGS += -D_HAS_EXCEPTIONS=0
# The MSVC linker doesn't understand long section names
# generated by the clang compiler.
#----------------------------------------------------------------------
# Make the dylib
#----------------------------------------------------------------------
+$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
+
$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
ifeq "$(OS)" "Darwin"
$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
#----------------------------------------------------------------------
# Automatic variables based on items already entered. Below we create
-# an objects lists from the list of sources by replacing all entries
+# an object's lists from the list of sources by replacing all entries
# that end with .c with .o, and we also create a list of prerequisite
# files by replacing all .c files with .d.
#----------------------------------------------------------------------
# the compiler -MM option. The -M option will list all system headers,
# and the -MM option will list all non-system dependencies.
#----------------------------------------------------------------------
+ifeq "$(OS)" "Windows_NT"
+ JOIN_CMD = &
+ QUOTE = "
+else
+ JOIN_CMD = ;
+ QUOTE = '
+endif
+
%.d: %.c
- @rm -f $@; \
+ @rm -f $@ $(JOIN_CMD) \
$(CC) -M $(CFLAGS) $< > $@.tmp && \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \
+ sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
rm -f $@.tmp
%.d: %.cpp
- @rm -f $@; \
+ @rm -f $@ $(JOIN_CMD) \
$(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \
+ sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
rm -f $@.tmp
%.d: %.m
- @rm -f $@; \
+ @rm -f $@ $(JOIN_CMD) \
$(CC) -M $(CFLAGS) $< > $@.tmp && \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \
+ sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
rm -f $@.tmp
%.d: %.mm
- @rm -f $@; \
+ @rm -f $@ $(JOIN_CMD) \
$(CXX) -M $(CXXFLAGS) $< > $@.tmp && \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \
+ sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \
rm -f $@.tmp
#----------------------------------------------------------------------
endif
ifeq "$(OS)" "Windows_NT"
$(RM) "$(EXE).manifest" $(wildcard *.pdb *.ilk)
+ ifneq "$(DYLIB_NAME)" ""
+ $(RM) $(DYLIB_FILENAME).manifest
+ $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp
+ endif
endif
#----------------------------------------------------------------------
--- /dev/null
+// This header is included in all the test programs (C and C++) and provides a\r
+// hook for dealing with platform-specifics.\r
+#if defined(_WIN32) || defined(_WIN64)\r
+#ifdef COMPILING_LLDB_TEST_DLL\r
+#define LLDB_TEST_API __declspec(dllexport)\r
+#else\r
+#define LLDB_TEST_API __declspec(dllimport)\r
+#endif\r
+#else\r
+#define LLDB_TEST_API\r
+#endif\r
+\r
+#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)\r
+// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all\r
+// calls to __uncaught_exception. Unfortunately, it does seem to eliminate\r
+// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is\r
+// declared. This may not be necessary after MSVC 12.\r
+#include <eh.h>\r
+#endif\r