1#---------------------------------------------------------------------- 2# Clients fill in the source files to build 3#---------------------------------------------------------------------- 4# C_SOURCES := main.c 5# CXX_SOURCES := 6# OBJC_SOURCES := 7# OBJCXX_SOURCES := 8# DYLIB_C_SOURCES := 9# DYLIB_CXX_SOURCES := 10# 11# Specifying DYLIB_ONLY has the effect of building dylib only, skipping 12# the building of the a.out executable program. For example, 13# DYLIB_ONLY := YES 14# 15# Also might be of interest: 16# FRAMEWORK_INCLUDES (Darwin only) := 17# CFLAGS_EXTRAS := 18# LD_EXTRAS := 19# SPLIT_DEBUG_SYMBOLS := YES 20# CROSS_COMPILE := 21# 22# And test/functionalities/archives/Makefile: 23# MAKE_DSYM := NO 24# ARCHIVE_NAME := libfoo.a 25# ARCHIVE_C_SOURCES := a.c b.c 26 27# Uncomment line below for debugging shell commands 28# SHELL = /bin/sh -x 29 30THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ 31LLDB_BASE_DIR := $(THIS_FILE_DIR)../../ 32 33 34#---------------------------------------------------------------------- 35# If TRIPLE is not defined try to set the ARCH, CC, CFLAGS, and more 36# from the triple alone 37#---------------------------------------------------------------------- 38TRIPLE_CFLAGS := 39ifneq "$(TRIPLE)" "" 40 triple_space = $(subst -, ,$(TRIPLE)) 41 ARCH =$(word 1, $(triple_space)) 42 TRIPLE_VENDOR =$(word 2, $(triple_space)) 43 triple_os_and_version =$(shell echo $(word 3, $(triple_space)) | sed -e 's/\(.*\)\([0-9]\.[0-9]\).*/\1 \2/') 44 TRIPLE_OS =$(word 1, $(triple_os_and_version)) 45 TRIPLE_VERSION =$(word 2, $(triple_os_and_version)) 46 ifeq "$(TRIPLE_VENDOR)" "apple" 47 ifeq "$(TRIPLE_OS)" "ios" 48 ifeq "$(SDKROOT)" "" 49 # Set SDKROOT if it wasn't set 50 ifneq (,$(findstring arm,$(ARCH))) 51 SDKROOT = $(shell xcrun --sdk iphoneos --show-sdk-path) 52 ifeq "$(TRIPLE_VERSION)" "" 53 TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/') 54 endif 55 TRIPLE_CFLAGS :=-mios-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" 56 else 57 SDKROOT = $(shell xcrun --sdk iphonesimulator --show-sdk-path) 58 ifeq "$(TRIPLE_VERSION)" "" 59 TRIPLE_VERSION =$(shell echo $(notdir $(SDKROOT)) | sed -e 's/.*\([0-9]\.[0-9]\).*/\1/') 60 endif 61 TRIPLE_CFLAGS :=-mios-simulator-version-min=$(TRIPLE_VERSION) -isysroot "$(SDKROOT)" 62 endif 63 endif 64 endif 65 endif 66endif 67 68#---------------------------------------------------------------------- 69# If OS is not defined, use 'uname -s' to determine the OS name. 70# 71# uname on Windows gives "windows32", but most environments standardize 72# on "Windows_NT", so we'll make it consistent here. When running 73# tests from Visual Studio, the environment variable isn't inherited 74# all the way down to the process spawned for make. 75#---------------------------------------------------------------------- 76HOST_OS = $(shell uname -s) 77ifeq "$(HOST_OS)" "windows32" 78 HOST_OS = Windows_NT 79endif 80ifeq "$(OS)" "" 81 OS = $(HOST_OS) 82endif 83 84#---------------------------------------------------------------------- 85# If ARCH is not defined, default to x86_64. 86#---------------------------------------------------------------------- 87ifeq "$(ARCH)" "" 88ifeq "$(OS)" "Windows_NT" 89 ARCH = x86 90else 91 ARCH = x86_64 92endif 93endif 94 95#---------------------------------------------------------------------- 96# CC defaults to clang. 97# 98# If you change the defaults of CC, be sure to also change it in the file 99# test/plugins/builder_base.py, which provides a Python way to return the 100# value of the make variable CC -- getCompiler(). 101# 102# See also these functions: 103# o cxx_compiler 104# o cxx_linker 105#---------------------------------------------------------------------- 106CC ?= clang 107ifeq "$(CC)" "cc" 108 ifneq "$(shell which clang)" "" 109 CC = clang 110 else ifneq "$(shell which clang-3.5)" "" 111 CC = clang-3.5 112 else ifneq "$(shell which gcc)" "" 113 CC = gcc 114 endif 115endif 116 117#---------------------------------------------------------------------- 118# ARCHFLAG is the flag used to tell the compiler which architecture 119# to compile for. The default is the flag that clang accepts. 120#---------------------------------------------------------------------- 121ARCHFLAG ?= -arch 122 123#---------------------------------------------------------------------- 124# Change any build/tool options needed 125#---------------------------------------------------------------------- 126ifeq "$(OS)" "Darwin" 127 DS := $(shell xcrun -find -toolchain default dsymutil) 128 DSFLAGS = 129 DSYM = $(EXE).dSYM 130 AR := $(CROSS_COMPILE)libtool 131 ARFLAGS := -static -o 132else 133 AR := $(CROSS_COMPILE)ar 134 # On non-Apple platforms, -arch becomes -m 135 ARCHFLAG := -m 136 137 # i386, i686, x86 -> 32 138 # amd64, x86_64, x64 -> 64 139 ifeq "$(ARCH)" "amd64" 140 override ARCH := $(subst amd64,64,$(ARCH)) 141 endif 142 ifeq "$(ARCH)" "x86_64" 143 override ARCH := $(subst x86_64,64,$(ARCH)) 144 endif 145 ifeq "$(ARCH)" "x64" 146 override ARCH := $(subst x64,64,$(ARCH)) 147 endif 148 ifeq "$(ARCH)" "x86" 149 override ARCH := $(subst x86,32,$(ARCH)) 150 endif 151 ifeq "$(ARCH)" "i386" 152 override ARCH := $(subst i386,32,$(ARCH)) 153 endif 154 ifeq "$(ARCH)" "i686" 155 override ARCH := $(subst i686,32,$(ARCH)) 156 endif 157 ifeq "$(ARCH)" "powerpc" 158 override ARCH := $(subst powerpc,32,$(ARCH)) 159 endif 160 ifeq "$(ARCH)" "powerpc64" 161 override ARCH := $(subst powerpc64,64,$(ARCH)) 162 endif 163 ifeq "$(ARCH)" "aarch64" 164 override ARCH := 165 override ARCHFLAG := 166 endif 167 168 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" 169 DSYM = $(EXE).debug 170 endif 171endif 172 173LIMIT_DEBUG_INFO_FLAGS = 174ifneq (,$(findstring clang,$(CC))) 175 LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info 176endif 177 178CFLAGS ?= -g -O0 -fno-builtin 179ifeq "$(OS)" "Darwin" 180 CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include 181else 182 CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include 183endif 184CFLAGS += -include $(THIS_FILE_DIR)test_common.h $(TRIPLE_CFLAGS) 185 186# Use this one if you want to build one part of the result without debug information: 187ifeq "$(OS)" "Darwin" 188 CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS) 189else 190 CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS) 191endif 192 193ifeq "$(MAKE_DWO)" "YES" 194 CFLAGS += -gsplit-dwarf 195endif 196 197CXXFLAGS += -std=c++11 198CXXFLAGS += $(CFLAGS) 199LD = $(CC) 200LDFLAGS ?= $(CFLAGS) 201LDFLAGS += $(LD_EXTRAS) 202ifeq (,$(filter $(OS), Windows_NT Android)) 203 ifneq (,$(filter YES,$(ENABLE_THREADS) $(ENABLE_STD_THREADS))) 204 LDFLAGS += -pthread 205 endif 206endif 207OBJECTS = 208EXE ?= a.out 209 210ifneq "$(DYLIB_NAME)" "" 211 ifeq "$(OS)" "Darwin" 212 DYLIB_FILENAME = lib$(DYLIB_NAME).dylib 213 DYLIB_EXECUTABLE_PATH ?= @executable_path 214 else ifeq "$(OS)" "Windows_NT" 215 DYLIB_FILENAME = $(DYLIB_NAME).dll 216 else 217 DYLIB_FILENAME = lib$(DYLIB_NAME).so 218 endif 219endif 220 221# Function that returns the counterpart C++ compiler, given $(CC) as arg. 222cxx_compiler_notdir = $(if $(findstring clang,$(1)), \ 223 $(subst clang,clang++,$(1)), \ 224 $(if $(findstring icc,$(1)), \ 225 $(subst icc,icpc,$(1)), \ 226 $(if $(findstring llvm-gcc,$(1)), \ 227 $(subst llvm-gcc,llvm-g++,$(1)), \ 228 $(if $(findstring gcc,$(1)), \ 229 $(subst gcc,g++,$(1)), \ 230 $(subst cc,c++,$(1)))))) 231cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1))) 232 233# Function that returns the C++ linker, given $(CC) as arg. 234cxx_linker_notdir = $(if $(findstring clang,$(1)), \ 235 $(subst clang,clang++,$(1)), \ 236 $(if $(findstring icc,$(1)), \ 237 $(subst icc,icpc,$(1)), \ 238 $(if $(findstring llvm-gcc,$(1)), \ 239 $(subst llvm-gcc,llvm-g++,$(1)), \ 240 $(if $(findstring gcc,$(1)), \ 241 $(subst gcc,g++,$(1)), \ 242 $(subst cc,c++,$(1)))))) 243cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1))) 244 245OBJCOPY := $(CROSS_COMPILE)objcopy 246 247#---------------------------------------------------------------------- 248# Windows specific options 249#---------------------------------------------------------------------- 250ifeq "$(OS)" "Windows_NT" 251 ifneq (,$(findstring clang,$(CC))) 252 # Clang for Windows doesn't support C++ Exceptions 253 CXXFLAGS += -fno-exceptions 254 CXXFLAGS += -D_HAS_EXCEPTIONS=0 255 # The MSVC linker doesn't understand long section names 256 # generated by the clang compiler. 257 LDFLAGS += -fuse-ld=lld 258 endif 259endif 260 261#---------------------------------------------------------------------- 262# Android specific options 263#---------------------------------------------------------------------- 264ifeq "$(OS)" "Android" 265 ifdef PIE 266 LDFLAGS += -pie 267 endif 268 replace_with = $(if $(findstring clang,$(1)), \ 269 $(subst clang,$(2),$(1)), \ 270 $(if $(findstring gcc,$(1)), \ 271 $(subst gcc,$(2),$(1)), \ 272 $(subst cc,$(2),$(1)))) 273 ifeq "$(notdir $(CC))" "$(CC)" 274 replace_cc_with = $(call replace_with,$(CC),$(1)) 275 else 276 replace_cc_with = $(join $(dir $(CC)),$(call replace_with,$(notdir $(CC)),$(1))) 277 endif 278 OBJCOPY = $(call replace_cc_with,objcopy) 279 AR = $(call replace_cc_with,ar) 280endif 281 282#---------------------------------------------------------------------- 283# C++ standard library options 284#---------------------------------------------------------------------- 285ifeq (1,$(USE_LIBSTDCPP)) 286 # Clang requires an extra flag: -stdlib=libstdc++ 287 ifneq (,$(findstring clang,$(CC))) 288 CXXFLAGS += -stdlib=libstdc++ 289 LDFLAGS += -stdlib=libstdc++ 290 endif 291endif 292 293ifeq (1,$(USE_LIBCPP)) 294 # Clang requires an extra flag: -stdlib=libstdc++ 295 ifneq (,$(findstring clang,$(CC))) 296 ifeq "$(OS)" "Linux" 297 # This is the default install location on Ubuntu 14.04 298 ifneq ($(wildcard /usr/include/c++/v1/.),) 299 CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP 300 LDFLAGS += -stdlib=libc++ 301 CXXFLAGS += -I/usr/include/c++/v1 302 endif 303 else 304 CXXFLAGS += -stdlib=libc++ -DLLDB_USING_LIBCPP 305 LDFLAGS += -stdlib=libc++ 306 endif 307 endif 308endif 309 310#---------------------------------------------------------------------- 311# dylib settings 312#---------------------------------------------------------------------- 313ifneq "$(strip $(DYLIB_C_SOURCES))" "" 314 DYLIB_OBJECTS +=$(strip $(DYLIB_C_SOURCES:.c=.o)) 315endif 316 317ifneq "$(strip $(DYLIB_OBJC_SOURCES))" "" 318 DYLIB_OBJECTS +=$(strip $(DYLIB_OBJC_SOURCES:.m=.o)) 319endif 320 321ifneq "$(strip $(DYLIB_CXX_SOURCES))" "" 322 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o)) 323 CXX = $(call cxx_compiler,$(CC)) 324 LD = $(call cxx_linker,$(CC)) 325endif 326 327#---------------------------------------------------------------------- 328# Check if we have any C source files 329#---------------------------------------------------------------------- 330ifneq "$(strip $(C_SOURCES))" "" 331 OBJECTS +=$(strip $(C_SOURCES:.c=.o)) 332endif 333 334#---------------------------------------------------------------------- 335# Check if we have any C++ source files 336#---------------------------------------------------------------------- 337ifneq "$(strip $(CXX_SOURCES))" "" 338 OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o)) 339 CXX = $(call cxx_compiler,$(CC)) 340 LD = $(call cxx_linker,$(CC)) 341endif 342 343#---------------------------------------------------------------------- 344# Check if we have any ObjC source files 345#---------------------------------------------------------------------- 346ifneq "$(strip $(OBJC_SOURCES))" "" 347 OBJECTS +=$(strip $(OBJC_SOURCES:.m=.o)) 348 LDFLAGS +=-lobjc 349endif 350 351#---------------------------------------------------------------------- 352# Check if we have any ObjC++ source files 353#---------------------------------------------------------------------- 354ifneq "$(strip $(OBJCXX_SOURCES))" "" 355 OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o)) 356 CXX = $(call cxx_compiler,$(CC)) 357 LD = $(call cxx_linker,$(CC)) 358 ifeq "$(findstring lobjc,$(LDFLAGS))" "" 359 LDFLAGS +=-lobjc 360 endif 361endif 362 363#---------------------------------------------------------------------- 364# Check if we have any C source files for archive 365#---------------------------------------------------------------------- 366ifneq "$(strip $(ARCHIVE_C_SOURCES))" "" 367 ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_C_SOURCES:.c=.o)) 368endif 369 370#---------------------------------------------------------------------- 371# Check if we have any C++ source files for archive 372#---------------------------------------------------------------------- 373ifneq "$(strip $(ARCHIVE_CXX_SOURCES))" "" 374 ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_CXX_SOURCES:.cpp=.o)) 375 CXX = $(call cxx_compiler,$(CC)) 376 LD = $(call cxx_linker,$(CC)) 377endif 378 379#---------------------------------------------------------------------- 380# Check if we have any ObjC source files for archive 381#---------------------------------------------------------------------- 382ifneq "$(strip $(ARCHIVE_OBJC_SOURCES))" "" 383 ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJC_SOURCES:.m=.o)) 384 LDFLAGS +=-lobjc 385endif 386 387#---------------------------------------------------------------------- 388# Check if we have any ObjC++ source files for archive 389#---------------------------------------------------------------------- 390ifneq "$(strip $(ARCHIVE_OBJCXX_SOURCES))" "" 391 ARCHIVE_OBJECTS +=$(strip $(ARCHIVE_OBJCXX_SOURCES:.mm=.o)) 392 CXX = $(call cxx_compiler,$(CC)) 393 LD = $(call cxx_linker,$(CC)) 394 ifeq "$(findstring lobjc,$(LDFLAGS))" "" 395 LDFLAGS +=-lobjc 396 endif 397endif 398 399#---------------------------------------------------------------------- 400# Check if we are compiling with gcc 4.6 401#---------------------------------------------------------------------- 402ifneq "$(strip $(CXX_SOURCES) $(OBJCXX_SOURCES))" "" 403ifneq "$(filter g++,$(CXX))" "" 404 CXXVERSION = $(shell $(CXX) -dumpversion | cut -b 1-3) 405 ifeq "$(CXXVERSION)" "4.6" 406 # GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x 407 # instead. FIXME: remove once GCC version is upgraded. 408 override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS)) 409 endif 410endif 411endif 412 413#---------------------------------------------------------------------- 414# DYLIB_ONLY variable can be used to skip the building of a.out. 415# See the sections below regarding dSYM file as well as the building of 416# EXE from all the objects. 417#---------------------------------------------------------------------- 418 419#---------------------------------------------------------------------- 420# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" 421#---------------------------------------------------------------------- 422ifneq "$(DYLIB_ONLY)" "YES" 423$(DSYM) : $(EXE) 424ifeq "$(OS)" "Darwin" 425ifneq "$(MAKE_DSYM)" "NO" 426 "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)" 427endif 428else 429ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" 430 $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" 431 $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" 432endif 433endif 434endif 435 436#---------------------------------------------------------------------- 437# Compile the executable from all the objects. 438#---------------------------------------------------------------------- 439ifneq "$(DYLIB_NAME)" "" 440ifeq "$(DYLIB_ONLY)" "" 441$(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME) 442 $(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o "$(EXE)" 443else 444EXE = $(DYLIB_FILENAME) 445endif 446else 447$(EXE) : $(OBJECTS) $(ARCHIVE_NAME) 448 $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)" 449endif 450 451#---------------------------------------------------------------------- 452# Make the archive 453#---------------------------------------------------------------------- 454ifneq "$(ARCHIVE_NAME)" "" 455ifeq "$(OS)" "Darwin" 456$(ARCHIVE_NAME) : $(ARCHIVE_OBJECTS) 457 $(AR) $(ARFLAGS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) 458 $(RM) $(ARCHIVE_OBJECTS) 459else 460$(ARCHIVE_NAME) : $(foreach ar_obj,$(ARCHIVE_OBJECTS),$(ARCHIVE_NAME)($(ar_obj))) 461endif 462endif 463 464#---------------------------------------------------------------------- 465# Make the dylib 466#---------------------------------------------------------------------- 467$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL 468 469$(DYLIB_FILENAME) : $(DYLIB_OBJECTS) 470ifeq "$(OS)" "Darwin" 471 $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)" 472ifneq "$(MAKE_DSYM)" "NO" 473ifneq "$(DS)" "" 474 "$(DS)" $(DSFLAGS) "$(DYLIB_FILENAME)" 475endif 476endif 477else 478 $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)" 479ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" 480 $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug" 481 $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)" 482endif 483endif 484 485#---------------------------------------------------------------------- 486# Automatic variables based on items already entered. Below we create 487# an object's lists from the list of sources by replacing all entries 488# that end with .c with .o, and we also create a list of prerequisite 489# files by replacing all .c files with .d. 490#---------------------------------------------------------------------- 491PREREQS := $(OBJECTS:.o=.d) 492DWOS := $(OBJECTS:.o=.dwo) $(ARCHIVE_OBJECTS:.o=.dwo) 493ifneq "$(DYLIB_NAME)" "" 494 DYLIB_PREREQS := $(DYLIB_OBJECTS:.o=.d) 495 DYLIB_DWOS := $(DYLIB_OBJECTS:.o=.dwo) 496endif 497 498#---------------------------------------------------------------------- 499# Rule for Generating Prerequisites Automatically using .d files and 500# the compiler -MM option. The -M option will list all system headers, 501# and the -MM option will list all non-system dependencies. 502#---------------------------------------------------------------------- 503ifeq "$(HOST_OS)" "Windows_NT" 504 JOIN_CMD = & 505 QUOTE = " 506else 507 JOIN_CMD = ; 508 QUOTE = ' 509endif 510 511%.d: %.c 512 @rm -f $@ $(JOIN_CMD) \ 513 $(CC) -M $(CFLAGS) $< > [email protected] && \ 514 sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(JOIN_CMD) \ 515 rm -f [email protected] 516 517%.d: %.cpp 518 @rm -f $@ $(JOIN_CMD) \ 519 $(CXX) -M $(CXXFLAGS) $< > [email protected] && \ 520 sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(JOIN_CMD) \ 521 rm -f [email protected] 522 523%.d: %.m 524 @rm -f $@ $(JOIN_CMD) \ 525 $(CC) -M $(CFLAGS) $< > [email protected] && \ 526 sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(JOIN_CMD) \ 527 rm -f [email protected] 528 529%.d: %.mm 530 @rm -f $@ $(JOIN_CMD) \ 531 $(CXX) -M $(CXXFLAGS) $< > [email protected] && \ 532 sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < [email protected] > $@ $(JOIN_CMD) \ 533 rm -f [email protected] 534 535#---------------------------------------------------------------------- 536# Include all of the makefiles for each source file so we don't have 537# to manually track all of the prerequisites for each source file. 538#---------------------------------------------------------------------- 539sinclude $(PREREQS) 540ifneq "$(DYLIB_NAME)" "" 541 sinclude $(DYLIB_PREREQS) 542endif 543 544# Define a suffix rule for .mm -> .o 545.SUFFIXES: .mm .o 546.mm.o: 547 $(CXX) $(CXXFLAGS) -c $< 548 549.PHONY: clean 550dsym: $(DSYM) 551all: $(EXE) $(DSYM) 552clean:: 553 $(RM) $(OBJECTS) $(PREREQS) $(PREREQS:.d=.d.tmp) $(DWOS) $(ARCHIVE_NAME) $(ARCHIVE_OBJECTS) 554ifneq "$(DYLIB_NAME)" "" 555 $(RM) -r $(DYLIB_FILENAME).dSYM 556 $(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug 557endif 558ifneq "$(DSYM)" "" 559 $(RM) -r "$(DSYM)" 560endif 561ifeq "$(OS)" "Windows_NT" 562# http://llvm.org/pr24589 563 IF EXIST "$(EXE)" del "$(EXE)" 564 $(RM) $(wildcard *.manifest *.pdb *.ilk) 565ifneq "$(DYLIB_NAME)" "" 566 $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp 567endif 568else 569 $(RM) "$(EXE)" 570endif 571 572#---------------------------------------------------------------------- 573# From http://blog.melski.net/tag/debugging-makefiles/ 574# 575# Usage: make print-CC print-CXX print-LD 576#---------------------------------------------------------------------- 577print-%: 578 @echo '$*=$($*)' 579 @echo ' origin = $(origin $*)' 580 @echo ' flavor = $(flavor $*)' 581 @echo ' value = $(value $*)' 582 583### Local Variables: ### 584### mode:makefile ### 585### End: ### 586