OSDN Git Service

am c3899706: Merge "Clean up warning/error flags (especially for Windows)."
[android-x86/external-llvm.git] / llvm-host-build.mk
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 LOCAL_CFLAGS_darwin += -Wno-error=deprecated-declarations
23
24 # Disable certain warnings as errors for use with mingw.
25 # We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally
26 # on the command line, and LLVM defines this internally itself.
27 LOCAL_CFLAGS_windows += -Wno-error=array-bounds \
28                         -Wno-error=comment \
29                         -Wno-error=return-type \
30                         -UWIN32_LEAN_AND_MEAN
31
32 ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
33 LOCAL_CFLAGS := \
34         $(LOCAL_CFLAGS) \
35         -D_DEBUG        \
36         -UNDEBUG
37 endif
38
39 ifneq ($(REQUIRES_EH),1)
40 LOCAL_CFLAGS += -fno-exceptions
41 else
42 REQUIRES_EH := 0
43 LOCAL_CFLAGS += -fexceptions
44 endif
45
46 ifneq ($(REQUIRES_RTTI),1)
47 LOCAL_CPPFLAGS += -fno-rtti
48 else
49 REQUIRES_RTTI := 0
50 endif
51
52 LOCAL_CPPFLAGS :=       \
53         $(LOCAL_CPPFLAGS)       \
54         -Woverloaded-virtual    \
55         -Wno-sign-promo         \
56         -std=c++11
57
58 # Make sure bionic is first so we can include system headers.
59 LOCAL_C_INCLUDES :=     \
60         $(LLVM_ROOT_PATH)       \
61         $(LLVM_ROOT_PATH)/include       \
62         $(LLVM_ROOT_PATH)/host/include  \
63         $(LOCAL_C_INCLUDES)
64
65 # Add on ncurses to have support for terminfo
66 LOCAL_LDLIBS_darwin += -lncurses
67 LOCAL_LDLIBS_linux += -lncurses
68 LOCAL_LDLIBS_linux += -lgcc_s
69
70 LOCAL_IS_HOST_MODULE := true
71
72 ifeq ($(HOST_PREFER_32_BIT),true)
73 LOCAL_MULTILIB := 32
74 else
75 LOCAL_MULTILIB := first
76 endif
77
78 ###########################################################
79 ## Commands for running tblgen to compile a td file
80 ###########################################################
81 define transform-host-td-to-out
82 @mkdir -p $(dir $@)
83 @echo "Host TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<"
84 $(hide) $(LLVM_TBLGEN) \
85         -I $(dir $<)    \
86         -I $(LLVM_ROOT_PATH)/include    \
87         -I $(LLVM_ROOT_PATH)/host/include       \
88         -I $(LLVM_ROOT_PATH)/lib/Target \
89         $(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,)        \
90         -gen-$(strip $(1))      \
91         -o $@ $<
92 endef