yroussel | 1319005 | 2012-01-12 16:09:06 +0100 | [diff] [blame] | 1 | CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame^] | 2 | CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX) |
yroussel | 1319005 | 2012-01-12 16:09:06 +0100 | [diff] [blame] | 3 | LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX) |
| 4 | |
| 5 | define do-clang-flags-subst |
| 6 | TARGET_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(TARGET_GLOBAL_CLANG_FLAGS)) |
| 7 | HOST_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(HOST_GLOBAL_CLANG_FLAGS)) |
| 8 | endef |
| 9 | |
| 10 | define clang-flags-subst |
| 11 | $(eval $(call do-clang-flags-subst,$(1),$(2))) |
| 12 | endef |
| 13 | |
| 14 | |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame^] | 15 | CLANG_CONFIG_EXTRA_CFLAGS := \ |
| 16 | -D__compiler_offsetof=__builtin_offsetof \ |
| 17 | -Dnan=__builtin_nan \ |
yroussel | 1319005 | 2012-01-12 16:09:06 +0100 | [diff] [blame] | 18 | |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame^] | 19 | CLANG_CONFIG_UNKNOWN_CFLAGS := \ |
| 20 | -funswitch-loops |
| 21 | |
| 22 | ifeq ($(TARGET_ARCH),arm) |
| 23 | CLANG_CONFIG_EXTRA_CFLAGS += \ |
| 24 | -target arm-linux-androideabi \ |
| 25 | -mllvm -arm-enable-ehabi |
| 26 | CLANG_CONFIG_EXTRA_LDFLAGS += \ |
| 27 | -target arm-linux-androideabi \ |
| 28 | -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin |
| 29 | CLANG_CONFIG_UNKNOWN_CFLAGS += \ |
| 30 | -mthumb-interwork \ |
| 31 | -fgcse-after-reload \ |
| 32 | -frerun-cse-after-loop \ |
| 33 | -frename-registers \ |
| 34 | -Wa,--noexecstack |
| 35 | endif |
| 36 | ifeq ($(TARGET_ARCH),x86) |
| 37 | CLANG_CONFIG_EXTRA_CFLAGS += \ |
| 38 | -target i686-android-linux |
| 39 | CLANG_CONFIG_EXTRA_LDFLAGS += \ |
| 40 | -target i686-android-linux \ |
| 41 | -B$(TARGET_TOOLCHAIN_ROOT)/i686-android-linux/bin |
| 42 | CLANG_CONFIG_UNKNOWN_CFLAGS += \ |
| 43 | -finline-limit=300 \ |
| 44 | -fno-inline-functions-called-once \ |
| 45 | -mfpmath=sse \ |
| 46 | -mbionic |
| 47 | endif |
| 48 | |
| 49 | CLANG_CONFIG_EXTRA_C_INCLUDES := external/clang/lib/Headers |
yroussel | 1319005 | 2012-01-12 16:09:06 +0100 | [diff] [blame] | 50 | |
| 51 | # remove unknown flags to define CLANG_FLAGS |
| 52 | TARGET_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_GLOBAL_CFLAGS)) |
| 53 | HOST_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(HOST_GLOBAL_CFLAGS)) |
| 54 | |
| 55 | # llvm does not yet support -march=armv5e nor -march=armv5te, fall back to armv5 or armv5t |
| 56 | $(call clang-flags-subst,-march=armv5te,-march=armv5t) |
| 57 | $(call clang-flags-subst,-march=armv5e,-march=armv5) |