Home | History | Annotate | Download | only in llvm
      1 ifeq ($(FORCE_BUILD_LLVM_DEBUG),true)
      2 local_optflags = -O0 -g
      3 else
      4 local_optflags = -O2
      5 endif
      6 
      7 LOCAL_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.
     25 LOCAL_CFLAGS_windows += -Wno-array-bounds \
     26 			-Wno-comment \
     27 			-UWIN32_LEAN_AND_MEAN
     28 
     29 ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
     30 LOCAL_CFLAGS :=	\
     31 	$(LOCAL_CFLAGS) \
     32 	-D_DEBUG	\
     33 	-UNDEBUG
     34 endif
     35 
     36 ifneq ($(REQUIRES_EH),1)
     37 LOCAL_CFLAGS += -fno-exceptions
     38 else
     39 REQUIRES_EH := 0
     40 LOCAL_CFLAGS += -fexceptions
     41 endif
     42 
     43 ifneq ($(REQUIRES_RTTI),1)
     44 LOCAL_CPPFLAGS += -fno-rtti
     45 else
     46 REQUIRES_RTTI := 0
     47 endif
     48 
     49 LOCAL_CPPFLAGS :=	\
     50 	$(LOCAL_CPPFLAGS)	\
     51 	-Wno-sign-promo         \
     52 	-std=c++11
     53 
     54 LOCAL_CPPFLAGS_linux := \
     55 	-Woverloaded-virtual
     56 
     57 LOCAL_CPPFLAGS_darwin += \
     58 	-Wno-deprecated-declarations \
     59 	-Woverloaded-virtual
     60 
     61 # Make sure bionic is first so we can include system headers.
     62 LOCAL_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
     69 LOCAL_LDLIBS_darwin += -lncurses
     70 LOCAL_LDLIBS_linux += -lncurses
     71 LOCAL_LDLIBS_linux += -lgcc_s
     72 
     73 LOCAL_IS_HOST_MODULE := true
     74 
     75 ifeq ($(HOST_PREFER_32_BIT),true)
     76 LOCAL_MULTILIB := 32
     77 else
     78 ifeq (libLLVM, $(filter libLLVM,$(LOCAL_SHARED_LIBRARIES)$(LOCAL_SHARED_LIBRARIES_$(HOST_OS))))
     79 # Skip building a 32-bit shared object if they are using libLLVM.
     80 LOCAL_MULTILIB := first
     81 endif
     82 endif
     83 
     84 ###########################################################
     85 ## Commands for running tblgen to compile a td file
     86 ###########################################################
     87 define 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 $@ $<
     98 endef
     99