63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
64 CXX32 ?= llvm-g++
65 CC32 ?= llvm-gcc
66 else
67 CXX32 ?= g++-4.0
68 CC32 ?= gcc-4.0
69 endif
70 CXX = $(CXX32)
71 CC = $(CC32)
72 endif
73
74 ifeq ($(USE_CLANG), true)
75 CXX = clang++
76 CC = clang
77 endif
78
79 HOSTCXX = $(CXX)
80 HOSTCC = $(CC)
81 endif
82
83 AS = $(CC) -c -x assembler-with-cpp
84 endif
85
86
87 ifeq ($(USE_CLANG), true)
88 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
89 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
90 else
91 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
92 # prints the numbers (e.g. "2.95", "3.2.1")
93 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
94 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
95 endif
96
97 ifeq ($(USE_CLANG), true)
98 # clang has precompiled headers support by default, but the user can switch
99 # it off by using 'USE_PRECOMPILED_HEADER=0'.
100 ifdef LP64
101 ifeq ($(USE_PRECOMPILED_HEADER),)
102 USE_PRECOMPILED_HEADER=1
103 endif
324
325 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
326 ifeq ($(USE_PRECOMPILED_HEADER),0)
327 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
328 endif
329
330 ifeq ($(OS_VENDOR), Darwin)
331 # Setting these parameters makes it an error to link to macosx APIs that are
332 # newer than the given OS version and makes the linked binaries compatible even
333 # if built on a newer version of the OS.
334 # The expected format is X.Y.Z
335 ifeq ($(MACOSX_VERSION_MIN),)
336 MACOSX_VERSION_MIN=10.7.0
337 endif
338 # The macro takes the version with no dots, ex: 1070
339 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \
340 -mmacosx-version-min=$(MACOSX_VERSION_MIN)
341 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
342 endif
343
344 #------------------------------------------------------------------------
345 # Linker flags
346
347 # statically link libstdc++.so, work with gcc but ignored by g++
348 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
349
350 ifeq ($(USE_CLANG),)
351 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
352 ifneq ("${CC_VER_MAJOR}", "2")
353 STATIC_LIBGCC += -static-libgcc
354 endif
355
356 ifeq ($(BUILDARCH), ia64)
357 LFLAGS += -Wl,-relax
358 endif
359 endif
360
361 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
362 MAPFLAG = -Xlinker --version-script=FILENAME
363
|
63 ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true)
64 CXX32 ?= llvm-g++
65 CC32 ?= llvm-gcc
66 else
67 CXX32 ?= g++-4.0
68 CC32 ?= gcc-4.0
69 endif
70 CXX = $(CXX32)
71 CC = $(CC32)
72 endif
73
74 ifeq ($(USE_CLANG), true)
75 CXX = clang++
76 CC = clang
77 endif
78
79 HOSTCXX = $(CXX)
80 HOSTCC = $(CC)
81 endif
82
83 AS = $(CC) -c
84 endif
85
86
87 ifeq ($(USE_CLANG), true)
88 CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
89 CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
90 else
91 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
92 # prints the numbers (e.g. "2.95", "3.2.1")
93 CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
94 CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
95 endif
96
97 ifeq ($(USE_CLANG), true)
98 # clang has precompiled headers support by default, but the user can switch
99 # it off by using 'USE_PRECOMPILED_HEADER=0'.
100 ifdef LP64
101 ifeq ($(USE_PRECOMPILED_HEADER),)
102 USE_PRECOMPILED_HEADER=1
103 endif
324
325 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
326 ifeq ($(USE_PRECOMPILED_HEADER),0)
327 CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
328 endif
329
330 ifeq ($(OS_VENDOR), Darwin)
331 # Setting these parameters makes it an error to link to macosx APIs that are
332 # newer than the given OS version and makes the linked binaries compatible even
333 # if built on a newer version of the OS.
334 # The expected format is X.Y.Z
335 ifeq ($(MACOSX_VERSION_MIN),)
336 MACOSX_VERSION_MIN=10.7.0
337 endif
338 # The macro takes the version with no dots, ex: 1070
339 CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \
340 -mmacosx-version-min=$(MACOSX_VERSION_MIN)
341 LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
342 endif
343
344
345 #------------------------------------------------------------------------
346 # Assembler flags
347
348 # Enforce prerpocessing of .s files
349 ASFLAGS += -x assembler-with-cpp
350
351 #------------------------------------------------------------------------
352 # Linker flags
353
354 # statically link libstdc++.so, work with gcc but ignored by g++
355 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
356
357 ifeq ($(USE_CLANG),)
358 # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
359 ifneq ("${CC_VER_MAJOR}", "2")
360 STATIC_LIBGCC += -static-libgcc
361 endif
362
363 ifeq ($(BUILDARCH), ia64)
364 LFLAGS += -Wl,-relax
365 endif
366 endif
367
368 # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
369 MAPFLAG = -Xlinker --version-script=FILENAME
370
|