OSDN Git Service

Merge "Add NOTICE file"
[android-x86/external-llvm.git] / llvm-host-build.mk
1 # Windows can't use Clang to build yet
2 ifneq ($(HOST_OS),windows)
3 LOCAL_CLANG := true
4 include external/libcxx/libcxx.mk
5 endif
6
7 LOCAL_CFLAGS += \
8         -D_GNU_SOURCE   \
9         -D__STDC_LIMIT_MACROS   \
10         -O2     \
11         -fomit-frame-pointer    \
12         -Wall   \
13         -W      \
14         -Wno-unused-parameter   \
15         -Wwrite-strings \
16         -Dsprintf=sprintf \
17         $(LOCAL_CFLAGS)
18
19 ifeq ($(LLVM_ENABLE_ASSERTION),true)
20 LOCAL_CFLAGS := \
21         $(LOCAL_CFLAGS) \
22         -D_DEBUG        \
23         -UNDEBUG
24 endif
25
26 ifneq ($(REQUIRES_EH),1)
27 LOCAL_CFLAGS += -fno-exceptions
28 else
29 REQUIRES_EH := 0
30 LOCAL_CFLAGS += -fexceptions
31 endif
32
33 ifneq ($(REQUIRES_RTTI),1)
34 LOCAL_CPPFLAGS += -fno-rtti
35 else
36 REQUIRES_RTTI := 0
37 endif
38
39 LOCAL_CPPFLAGS :=       \
40         $(LOCAL_CPPFLAGS)       \
41         -Woverloaded-virtual    \
42         -Wno-sign-promo         \
43         -std=c++11
44
45 # Make sure bionic is first so we can include system headers.
46 LOCAL_C_INCLUDES :=     \
47         $(LLVM_ROOT_PATH)       \
48         $(LLVM_ROOT_PATH)/include       \
49         $(LLVM_ROOT_PATH)/host/include  \
50         $(LOCAL_C_INCLUDES)
51
52 # Add on ncurses to have support for terminfo
53 ifneq ($(HOST_OS),windows)
54 LOCAL_LDLIBS += -lncurses
55 ifneq ($(HOST_OS),darwin)
56 LOCAL_LDLIBS += -lgcc_s
57 endif
58 endif
59
60 LOCAL_IS_HOST_MODULE := true
61
62 ###########################################################
63 ## Commands for running tblgen to compile a td file
64 ###########################################################
65 define transform-host-td-to-out
66 @mkdir -p $(dir $@)
67 @echo "Host TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<"
68 $(hide) $(LLVM_TBLGEN) \
69         -I $(dir $<)    \
70         -I $(LLVM_ROOT_PATH)/include    \
71         -I $(LLVM_ROOT_PATH)/host/include       \
72         -I $(LLVM_ROOT_PATH)/lib/Target \
73         $(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,)        \
74         -gen-$(strip $(1))      \
75         -o $@ $<
76 endef