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