1ifeq ($(FORCE_BUILD_LLVM_DEBUG),true) 2local_optflags = -O0 -g 3else 4local_optflags = -O2 5endif 6 7LOCAL_CFLAGS += \ 8 -D_GNU_SOURCE \ 9 -D__STDC_LIMIT_MACROS \ 10 $(local_optflags) \ 11 -fomit-frame-pointer \ 12 -Wall \ 13 -W \ 14 -Wno-unused-parameter \ 15 -Wno-maybe-uninitialized \ 16 -Wno-missing-field-initializers \ 17 -Wwrite-strings \ 18 -Werror \ 19 -Dsprintf=sprintf \ 20 $(LOCAL_CFLAGS) 21 22# Disable certain warnings for use with mingw. 23# We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally 24# on the command line, and LLVM defines this internally itself. 25LOCAL_CFLAGS_windows += -Wno-array-bounds \ 26 -Wno-comment \ 27 -UWIN32_LEAN_AND_MEAN 28 29ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true) 30LOCAL_CFLAGS := \ 31 $(LOCAL_CFLAGS) \ 32 -D_DEBUG \ 33 -UNDEBUG 34endif 35 36ifneq ($(REQUIRES_EH),1) 37LOCAL_CFLAGS += -fno-exceptions 38else 39REQUIRES_EH := 0 40LOCAL_CFLAGS += -fexceptions 41endif 42 43ifneq ($(REQUIRES_RTTI),1) 44LOCAL_CPPFLAGS += -fno-rtti 45else 46REQUIRES_RTTI := 0 47endif 48 49LOCAL_CPPFLAGS := \ 50 $(LOCAL_CPPFLAGS) \ 51 -Wno-sign-promo \ 52 -std=c++11 53 54LOCAL_CPPFLAGS_linux := \ 55 -Woverloaded-virtual 56 57LOCAL_CPPFLAGS_darwin += \ 58 -Wno-deprecated-declarations \ 59 -Woverloaded-virtual 60 61# Make sure bionic is first so we can include system headers. 62LOCAL_C_INCLUDES := \ 63 $(LLVM_ROOT_PATH) \ 64 $(LLVM_ROOT_PATH)/include \ 65 $(LLVM_ROOT_PATH)/host/include \ 66 $(LOCAL_C_INCLUDES) 67 68# Add on ncurses to have support for terminfo 69LOCAL_LDLIBS_darwin += -lncurses 70LOCAL_LDLIBS_linux += -lncurses 71LOCAL_LDLIBS_linux += -lgcc_s 72 73LOCAL_IS_HOST_MODULE := true 74 75ifeq ($(HOST_PREFER_32_BIT),true) 76LOCAL_MULTILIB := 32 77else 78ifeq (libLLVM, $(filter libLLVM,$(LOCAL_SHARED_LIBRARIES)$(LOCAL_SHARED_LIBRARIES_$(HOST_OS)))) 79# Skip building a 32-bit shared object if they are using libLLVM. 80LOCAL_MULTILIB := first 81endif 82endif 83 84########################################################### 85## Commands for running tblgen to compile a td file 86########################################################### 87define transform-host-td-to-out 88@mkdir -p $(dir $@) 89@echo "Host TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<" 90$(hide) $(LLVM_TBLGEN) \ 91 -I $(dir $<) \ 92 -I $(LLVM_ROOT_PATH)/include \ 93 -I $(LLVM_ROOT_PATH)/host/include \ 94 -I $(LLVM_ROOT_PATH)/lib/Target \ 95 $(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,) \ 96 -gen-$(strip $(1)) \ 97 -o $@ $< 98endef 99