1 #----------------------------------------------------------------------
2 # Clients fill in the source files to build
3 #----------------------------------------------------------------------
9 # DYLIB_OBJC_SOURCES :=
10 # DYLIB_CXX_SOURCES :=
12 # Specifying DYLIB_ONLY has the effect of building dylib only, skipping
13 # the building of the a.out executable program. For example,
16 # Specifying FRAMEWORK and its variants has the effect of building a NeXT-style
19 # FRAMEWORK_HEADERS := "Foo.h"
20 # FRAMEWORK_MODULES := "module.modulemap"
22 # Also might be of interest:
23 # FRAMEWORK_INCLUDES (Darwin only) :=
26 # SPLIT_DEBUG_SYMBOLS := YES
28 # USE_PRIVATE_MODULE_CACHE := YES
30 # Uncomment line below for debugging shell commands
33 # Suppress built-in suffix rules. We explicitly define rules for %.o.
36 SRCDIR := $(shell dirname $(firstword $(MAKEFILE_LIST)))
37 BUILDDIR := $(shell pwd)
38 MAKEFILE_RULES := $(lastword $(MAKEFILE_LIST))
39 THIS_FILE_DIR := $(shell dirname $(MAKEFILE_RULES))
40 LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
42 # The test harness invokes the test Makefiles with an explicit 'all'
43 # target, but its handy to be able to recursively call this Makefile
44 # without specifying a goal. You almost certainly want to build 'all',
45 # and not only the first target defined in this file (which might vary
46 # according to variable values).
49 #----------------------------------------------------------------------
50 # If OS is not defined, use 'uname -s' to determine the OS name.
52 # GNUWin32 uname gives "windows32" or "server version windows32" while
53 # some versions of MSYS uname return "MSYS_NT*", but most environments
54 # standardize on "Windows_NT", so we'll make it consistent here.
55 # When running tests from Visual Studio, the environment variable isn't
56 # inherited all the way down to the process spawned for make.
57 #----------------------------------------------------------------------
58 HOST_OS := $(shell uname -s)
59 ifneq (,$(findstring windows32,$(HOST_OS)))
63 ifneq (,$(findstring MSYS_NT,$(HOST_OS)))
71 #----------------------------------------------------------------------
72 # If OS is Windows, force SHELL to be cmd
74 # Some versions of make on Windows will search for other shells such as
75 # C:\cygwin\bin\sh.exe. This shell fails for numerous different reasons
76 # so default to using cmd.exe.
77 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
78 # which needs to be converted to windows path.
79 #----------------------------------------------------------------------
80 ifeq "$(OS)" "Windows_NT"
81 SHELL = $(WINDIR)\system32\cmd.exe
82 BUILDDIR := $(shell echo %cd%)
85 #----------------------------------------------------------------------
86 # If the OS is Windows use double-quotes in commands
88 # For other operating systems, single-quotes work fine, but on Windows
89 # we strictly required double-quotes
90 #----------------------------------------------------------------------
91 ifeq "$(HOST_OS)" "Windows_NT"
93 FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = "
96 FIXUP_SYNTAX_HIGHLIGHTING_IN_MY_EDITOR = '
99 #----------------------------------------------------------------------
100 # If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more
101 # from the triple alone
102 #----------------------------------------------------------------------
104 ifeq "$(OS)" "Android"
105 include $(THIS_FILE_DIR)/Android.rules
108 #----------------------------------------------------------------------
109 # If ARCH is not defined, default to x86_64.
110 #----------------------------------------------------------------------
112 ifeq "$(OS)" "Windows_NT"
119 #----------------------------------------------------------------------
120 # CC defaults to clang.
122 # If you change the defaults of CC, be sure to also change it in the file
123 # test/builders/builder_base.py, which provides a Python way to return the
124 # value of the make variable CC -- getCompiler().
126 # See also these functions:
129 #----------------------------------------------------------------------
131 $(error "C compiler is not specified. Please run tests through lldb-dotest or lit")
134 #----------------------------------------------------------------------
135 # Handle SDKROOT on Darwin
136 #----------------------------------------------------------------------
138 ifeq "$(OS)" "Darwin"
140 # We haven't otherwise set the SDKROOT, so set it now to macosx
141 SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path)
145 #----------------------------------------------------------------------
146 # ARCHFLAG is the flag used to tell the compiler which architecture
147 # to compile for. The default is the flag that clang accepts.
148 #----------------------------------------------------------------------
151 #----------------------------------------------------------------------
152 # Change any build/tool options needed
153 #----------------------------------------------------------------------
154 ifeq "$(OS)" "Darwin"
156 DSFLAGS := $(DSFLAGS_EXTRAS)
158 AR := $(CROSS_COMPILE)libtool
159 ARFLAGS := -static -o
161 AR := $(CROSS_COMPILE)ar
162 # On non-Apple platforms, -arch becomes -m
165 # i386, i686, x86 -> 32
166 # amd64, x86_64, x64 -> 64
167 ifeq "$(ARCH)" "amd64"
168 override ARCH := $(subst amd64,64,$(ARCH))
170 ifeq "$(ARCH)" "x86_64"
171 override ARCH := $(subst x86_64,64,$(ARCH))
174 override ARCH := $(subst x64,64,$(ARCH))
177 override ARCH := $(subst x86,32,$(ARCH))
179 ifeq "$(ARCH)" "i386"
180 override ARCH := $(subst i386,32,$(ARCH))
182 ifeq "$(ARCH)" "i686"
183 override ARCH := $(subst i686,32,$(ARCH))
185 ifeq "$(ARCH)" "powerpc"
186 override ARCH := $(subst powerpc,32,$(ARCH))
188 ifeq "$(ARCH)" "powerpc64"
189 override ARCH := $(subst powerpc64,64,$(ARCH))
191 ifeq "$(ARCH)" "powerpc64le"
192 override ARCH := $(subst powerpc64le,64,$(ARCH))
194 ifeq "$(ARCH)" "aarch64"
198 ifeq "$(findstring arm,$(ARCH))" "arm"
202 ifeq "$(ARCH)" "s390x"
206 ifeq "$(findstring mips,$(ARCH))" "mips"
207 override ARCHFLAG := -
210 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
215 LIMIT_DEBUG_INFO_FLAGS =
216 NO_LIMIT_DEBUG_INFO_FLAGS =
217 MODULE_DEBUG_INFO_FLAGS =
218 ifneq (,$(findstring clang,$(CC)))
219 LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info
220 NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info
221 MODULE_DEBUG_INFO_FLAGS += -gmodules
224 # If the OS is Windows, we need to pass -gdwarf to clang, otherwise it will build
225 # with codeview by default but all the tests rely on dwarf.
226 ifeq "$(OS)" "Windows_NT"
227 DEBUG_INFO_FLAG ?= -gdwarf
230 DEBUG_INFO_FLAG ?= -g
232 CFLAGS ?= $(DEBUG_INFO_FLAG) -O0
234 ifeq "$(OS)" "Darwin"
235 ifneq "$(SDKROOT)" ""
236 CFLAGS += -isysroot "$(SDKROOT)"
240 ifeq "$(OS)" "Darwin"
241 CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include
243 CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include
246 CFLAGS += -I$(SRCDIR) -I$(THIS_FILE_DIR)
248 ifndef NO_TEST_COMMON_H
249 CFLAGS += -include $(THIS_FILE_DIR)/test_common.h
252 CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS)
254 # Use this one if you want to build one part of the result without debug information:
255 ifeq "$(OS)" "Darwin"
256 CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) -isysroot "$(SDKROOT)"
258 CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
261 ifeq "$(MAKE_DWO)" "YES"
262 CFLAGS += -gsplit-dwarf
265 ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES"
266 THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache
268 THE_CLANG_MODULE_CACHE_DIR := $(CLANG_MODULE_CACHE_DIR)
271 MODULE_BASE_FLAGS := -fmodules -gmodules -fmodules-cache-path=$(THE_CLANG_MODULE_CACHE_DIR)
272 MANDATORY_MODULE_BUILD_CFLAGS := $(MODULE_BASE_FLAGS) -gmodules
273 # Build flags for building with C++ modules.
274 # -glldb is necessary for emitting information about what modules were imported.
275 MANDATORY_CXXMODULE_BUILD_CFLAGS := $(MODULE_BASE_FLAGS) -fcxx-modules -glldb
277 ifeq "$(OS)" "Darwin"
278 MANDATORY_MODULE_BUILD_CFLAGS += -fcxx-modules
281 ifeq "$(MAKE_GMODULES)" "YES"
282 CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
283 CXXFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
286 CFLAGS += $(CFLAGS_EXTRAS)
287 CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
290 LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
291 ifeq (,$(filter $(OS), Windows_NT Android Darwin))
292 ifneq (,$(filter YES,$(ENABLE_THREADS)))
299 ifneq "$(FRAMEWORK)" ""
300 DYLIB_NAME ?= $(FRAMEWORK).framework/Versions/A/$(FRAMEWORK)
301 DYLIB_FILENAME ?= $(FRAMEWORK).framework/Versions/A/$(FRAMEWORK)
304 ifneq "$(DYLIB_NAME)" ""
305 ifeq "$(OS)" "Darwin"
306 ifneq "$(FRAMEWORK)" ""
307 DYLIB_INSTALL_NAME ?= @executable_path/$(FRAMEWORK).framework/Versions/A/$(FRAMEWORK)
309 DYLIB_FILENAME = lib$(DYLIB_NAME).dylib
310 DYLIB_INSTALL_NAME ?= @executable_path/$(DYLIB_FILENAME)
312 else ifeq "$(OS)" "Windows_NT"
313 DYLIB_FILENAME = $(DYLIB_NAME).dll
315 DYLIB_FILENAME = lib$(DYLIB_NAME).so
319 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
320 cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
321 $(subst icc,icpc,$(1)), \
322 $(if $(findstring llvm-gcc,$(1)), \
323 $(subst llvm-gcc,llvm-g++,$(1)), \
324 $(if $(findstring gcc,$(1)), \
325 $(subst gcc,g++,$(1)), \
326 $(subst cc,c++,$(1)))))
327 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1)))
329 # Function that returns the C++ linker, given $(CC) as arg.
330 cxx_linker_notdir = $(if $(findstring icc,$(1)), \
331 $(subst icc,icpc,$(1)), \
332 $(if $(findstring llvm-gcc,$(1)), \
333 $(subst llvm-gcc,llvm-g++,$(1)), \
334 $(if $(findstring gcc,$(1)), \
335 $(subst gcc,g++,$(1)), \
336 $(subst cc,c++,$(1)))))
337 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1)))
339 ifneq "$(OS)" "Darwin"
340 CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
341 $(findstring clang,$(CC)), \
342 $(if $(findstring gcc,$(CC)), \
343 $(findstring gcc,$(CC)), \
346 CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC))))
348 replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
349 $(subst $(3),$(1),$(2)), \
350 $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)))))
352 ifeq "$(notdir $(CC))" "$(CC)"
353 replace_cc_with = $(call replace_with,$(1),$(CC),$(CLANG_OR_GCC))
355 replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC)))
358 OBJCOPY ?= $(call replace_cc_with,objcopy)
359 ARCHIVER ?= $(call replace_cc_with,ar)
360 override AR = $(ARCHIVER)
367 #----------------------------------------------------------------------
368 # Windows specific options
369 #----------------------------------------------------------------------
370 ifeq "$(OS)" "Windows_NT"
371 ifneq (,$(findstring clang,$(CC)))
372 # Clang for Windows doesn't support C++ Exceptions
373 CXXFLAGS += -fno-exceptions
374 CXXFLAGS += -D_HAS_EXCEPTIONS=0
376 # MSVC 2015 or higher is required, which depends on c++14, so
377 # append these values unconditionally.
378 CXXFLAGS += -fms-compatibility-version=19.0
379 CXXFLAGS += -std=c++14
381 # The MSVC linker doesn't understand long section names
382 # generated by the clang compiler.
383 LDFLAGS += -fuse-ld=lld
387 #----------------------------------------------------------------------
388 # C++ standard library options
389 #----------------------------------------------------------------------
390 ifneq ($(and $(USE_LIBSTDCPP), $(USE_LIBCPP)),)
391 $(error Libcxx and Libstdc++ cannot be used together)
394 ifeq (1, $(USE_SYSTEM_STDLIB))
395 ifneq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP)),)
396 $(error Cannot use system's standard library and a custom standard library together)
400 ifeq (1,$(USE_LIBSTDCPP))
401 # Clang requires an extra flag: -stdlib=libstdc++
402 ifneq (,$(findstring clang,$(CC)))
403 CXXFLAGS += -stdlib=libstdc++
404 LDFLAGS += -stdlib=libstdc++
408 ifeq (1,$(USE_LIBCPP))
409 ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
410 CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
411 ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
412 CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
414 LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
416 ifeq "$(OS)" "Android"
417 # Nothing to do, this is already handled in
420 CXXFLAGS += -stdlib=libc++
421 LDFLAGS += -stdlib=libc++
423 ifneq (,$(filter $(OS), FreeBSD Linux NetBSD))
424 ifneq (,$(LLVM_LIBS_DIR))
425 LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR)
431 ifeq (1, $(USE_SYSTEM_STDLIB))
432 ifeq "$(OS)" "Darwin"
434 $(error "SDKROOT must be set on Darwin to use the system libcxx")
436 CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(SDKROOT)/usr/include/c++/v1
437 LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++
441 # If no explicit request was made, but we have paths to a custom libcxx, use
443 ifeq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP), $(USE_SYSTEM_STDLIB)),)
444 ifneq ($(and $(LIBCPP_INCLUDE_DIR), $(LIBCPP_LIBRARY_DIR)),)
445 CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(LIBCPP_INCLUDE_DIR)
446 ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
447 CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
449 LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
453 #----------------------------------------------------------------------
454 # Additional system libraries
455 #----------------------------------------------------------------------
456 ifeq (1,$(USE_LIBDL))
457 ifeq (,$(filter $(OS), NetBSD Windows_NT))
462 CXXFLAGS += $(CXXFLAGS_EXTRAS)
464 #----------------------------------------------------------------------
466 #----------------------------------------------------------------------
468 DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o))
469 DYLIB_OBJECTS +=$(strip $(DYLIB_OBJC_SOURCES:.m=.o))
470 ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
471 DYLIB_OBJECTS +=$(strip $(patsubst %.mm, %.o, $(DYLIB_CXX_SOURCES:.cpp=.o)))
472 CXX = $(call cxx_compiler,$(CC))
473 LD = $(call cxx_linker,$(CC))
476 #----------------------------------------------------------------------
477 # Check if we have a precompiled header
478 #----------------------------------------------------------------------
479 ifneq "$(strip $(PCH_CXX_SOURCE))" ""
480 PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch)
481 PCHFLAGS = -include $(PCH_CXX_SOURCE)
484 #----------------------------------------------------------------------
485 # Check if we have any C source files
486 #----------------------------------------------------------------------
487 ifneq "$(strip $(C_SOURCES))" ""
488 OBJECTS +=$(strip $(C_SOURCES:.c=.o))
491 #----------------------------------------------------------------------
492 # Check if we have any C++ source files
493 #----------------------------------------------------------------------
494 ifneq "$(strip $(CXX_SOURCES))" ""
495 OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
496 CXX = $(call cxx_compiler,$(CC))
497 LD = $(call cxx_linker,$(CC))
500 #----------------------------------------------------------------------
501 # Check if we have any ObjC source files
502 #----------------------------------------------------------------------
503 ifneq "$(strip $(OBJC_SOURCES))" ""
504 OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o))
508 #----------------------------------------------------------------------
509 # Check if we have any ObjC++ source files
510 #----------------------------------------------------------------------
511 ifneq "$(strip $(OBJCXX_SOURCES))" ""
512 OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
513 CXX = $(call cxx_compiler,$(CC))
514 LD = $(call cxx_linker,$(CC))
515 ifeq "$(findstring lobjc,$(LDFLAGS))" ""
520 ifeq ($(findstring clang, $(CXX)), clang)
521 CXXFLAGS += --driver-mode=g++
525 ifeq ($(findstring clang, $(LD)), clang)
526 LDFLAGS += --driver-mode=g++
530 #----------------------------------------------------------------------
531 # DYLIB_ONLY variable can be used to skip the building of a.out.
532 # See the sections below regarding dSYM file as well as the building of
533 # EXE from all the objects.
534 #----------------------------------------------------------------------
536 #----------------------------------------------------------------------
537 # Compile the executable from all the objects.
538 #----------------------------------------------------------------------
539 ifneq "$(DYLIB_NAME)" ""
540 ifeq "$(DYLIB_ONLY)" ""
541 $(EXE) : $(OBJECTS) $(DYLIB_FILENAME)
542 $(LD) $(OBJECTS) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o "$(EXE)"
543 ifneq "$(CODESIGN)" ""
544 $(CODESIGN) -s - "$(EXE)"
547 EXE = $(DYLIB_FILENAME)
551 $(LD) $(OBJECTS) $(LDFLAGS) -o "$(EXE)"
552 ifneq "$(CODESIGN)" ""
553 $(CODESIGN) -s - "$(EXE)"
557 #----------------------------------------------------------------------
558 # Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
559 #----------------------------------------------------------------------
561 ifeq "$(OS)" "Darwin"
562 ifneq "$(MAKE_DSYM)" "NO"
563 "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
567 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
568 $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
569 $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
573 #----------------------------------------------------------------------
575 #----------------------------------------------------------------------
576 $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
578 ifneq "$(OS)" "Windows_NT"
579 $(DYLIB_OBJECTS) : CFLAGS += -fPIC
580 $(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
583 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
584 ifeq "$(OS)" "Darwin"
585 ifneq "$(FRAMEWORK)" ""
586 mkdir -p $(FRAMEWORK).framework/Versions/A/Headers
587 mkdir -p $(FRAMEWORK).framework/Versions/A/Modules
588 mkdir -p $(FRAMEWORK).framework/Versions/A/Resources
589 ifneq "$(FRAMEWORK_MODULES)" ""
590 cp -r $(FRAMEWORK_MODULES) $(FRAMEWORK).framework/Versions/A/Modules
592 ifneq "$(FRAMEWORK_HEADERS)" ""
593 cp -r $(FRAMEWORK_HEADERS) $(FRAMEWORK).framework/Versions/A/Headers
595 (cd $(FRAMEWORK).framework/Versions; ln -sf A Current)
596 (cd $(FRAMEWORK).framework/; ln -sf Versions/A/Headers Headers)
597 (cd $(FRAMEWORK).framework/; ln -sf Versions/A/Modules Modules)
598 (cd $(FRAMEWORK).framework/; ln -sf Versions/A/Resources Resources)
599 (cd $(FRAMEWORK).framework/; ln -sf Versions/A/$(FRAMEWORK) $(FRAMEWORK))
601 $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_INSTALL_NAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
602 ifneq "$(CODESIGN)" ""
603 $(CODESIGN) -s - "$(DYLIB_FILENAME)"
605 ifneq "$(MAKE_DSYM)" "NO"
607 "$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)"
611 $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
612 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
613 $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
614 $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
618 #----------------------------------------------------------------------
619 # Make the precompiled header and compile C++ sources against it
620 #----------------------------------------------------------------------
622 ifneq "$(PCH_OUTPUT)" ""
623 $(PCH_OUTPUT) : $(PCH_CXX_SOURCE)
624 $(CXX) $(CXXFLAGS) -x c++-header -o $@ $<
628 $(CC) $(CFLAGS) -MT $@ -MD -MP -MF $*.d -c -o $@ $<
630 %.o: %.cpp %.d $(PCH_OUTPUT)
631 $(CXX) $(PCHFLAGS) $(CXXFLAGS) -MT $@ -MD -MP -MF $*.d -c -o $@ $<
634 $(CC) $(CFLAGS) -MT $@ -MD -MP -MF $*.d -c -o $@ $<
637 $(CXX) $(CXXFLAGS) -MT $@ -MD -MP -MF $*.d -c -o $@ $<
639 #----------------------------------------------------------------------
640 # Automatic variables based on items already entered. Below we create
641 # an object's lists from the list of sources by replacing all entries
642 # that end with .c with .o, and we also create a list of prerequisite
643 # files by replacing all .c files with .d.
644 #----------------------------------------------------------------------
645 PREREQS := $(OBJECTS:.o=.d)
646 DWOS := $(OBJECTS:.o=.dwo)
647 ifneq "$(DYLIB_NAME)" ""
648 DYLIB_PREREQS := $(DYLIB_OBJECTS:.o=.d)
649 DYLIB_DWOS := $(DYLIB_OBJECTS:.o=.dwo)
652 # Don't error if a .d file is deleted.
653 $(PREREQS) $(DYLIB_PREREQS): ;
655 #----------------------------------------------------------------------
656 # Include all of the makefiles for each source file so we don't have
657 # to manually track all of the prerequisites for each source file.
658 #----------------------------------------------------------------------
659 include $(wildcard $(PREREQS) $(DYLIB_PREREQS))
665 ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" ""
666 $(error Trying to invoke the clean rule, but not using the default build tree layout)
668 $(RM) -r $(wildcard $(BUILDDIR)/*)
671 #----------------------------------------------------------------------
672 # From http://blog.melski.net/tag/debugging-makefiles/
674 # Usage: make print-CC print-CXX print-LD
675 #----------------------------------------------------------------------
678 @echo ' origin = $(origin $*)'
679 @echo ' flavor = $(flavor $*)'
680 @echo ' value = $(value $*)'
682 ### Local Variables: ###
683 ### mode:makefile ###