Merge branch 'master' into easysetup
[platform/upstream/iotivity.git] / resource / csdk / connectivity / build / android / jni / Android.mk
1 $(info TC_PREFIX=$(TOOLCHAIN_PREFIX))
2 $(info CFLAGS=$(TARGET_CFLAGS))
3 $(info CXXFLAGS=$(TARGET_CXXFLAGS) $(TARGET_NO_EXECUTE_CFLAGS))
4 $(info CPPPATH=$(TARGET_C_INCLUDES) $(__ndk_modules.$(APP_STL).EXPORT_C_INCLUDES))
5 $(info SYSROOT=$(SYSROOT_LINK))
6 $(info LDFLAGS=$(TARGET_LDFLAGS) $(TARGET_NO_EXECUTE_LDFLAGS) $(TARGET_NO_UNDEFINED_LDFLAGS) $(TARGET_RELRO_LDFLAGS))
7 $(info TC_VER=$(TOOLCHAIN_VERSION))
8 $(info PLATFORM=$(APP_PLATFORM))
9
10
11 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 #define build type
13 BUILD = debug
14
15 PROJECT_ROOT_PATH           ?= ../..
16 ROOT_DIR_PATH               = $(PROJECT_ROOT_PATH)/../../..
17 EXT_LIB_PATH                = $(ROOT_DIR_PATH)/extlibs
18 PROJECT_API_PATH            = $(PROJECT_ROOT_PATH)/api
19 PROJECT_INC_PATH            = $(PROJECT_ROOT_PATH)/inc
20 PROJECT_SRC_PATH            = $(PROJECT_ROOT_PATH)/src
21 PROJECT_COMMON_PATH         = $(PROJECT_ROOT_PATH)/common
22 PROJECT_COMMON_INC_PATH     = $(PROJECT_COMMON_PATH)/inc
23 PROJECT_COMMON_SRC_PATH     = $(PROJECT_COMMON_PATH)/src
24 PROJECT_LIB_PATH            = $(PROJECT_ROOT_PATH)/lib
25 PROJECT_EXTERNAL_PATH       = $(PROJECT_ROOT_PATH)/external/inc
26 DTLS_LIB                    = $(EXT_LIB_PATH)/tinydtls
27 OIC_C_COMMON_PATH           = $(ROOT_DIR_PATH)/resource/c_common
28 #GLIB_PATH                  = ../../../../../../extlibs/glib/glib-2.40.2
29
30 #Modify below values to enable/disable the Adapter
31 #Suffix "NO_" to disable given adapter
32 EDR             = EDR_ADAPTER
33 IP              = IP_ADAPTER
34 LE              = LE_ADAPTER
35 NFC             = NFC_ADAPTER
36
37 #Add Pre processor definitions
38 DEFINE_FLAG =  -DWITH_POSIX -D__ANDROID__
39 DEFINE_FLAG +=  -D__WITH_DTLS__
40 DEFINE_FLAG += -D$(EDR) -D$(LE) -D$(IP) -D$(NFC)
41
42 #Add Debug flags here
43 DEBUG_FLAG      = -DTB_LOG
44
45 BUILD_FLAG.debug        = $(DEFINE_FLAG) $(DEBUG_FLAG)
46 BUILD_FLAG.release      =       $(DEFINE_FLAG)
47 BUILD_FLAG = $(BUILD_FLAG.$(BUILD))
48
49 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50 #Build TinyDtls
51
52 include $(CLEAR_VARS)
53 include $(DTLS_LIB)/Android.mk
54
55 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 #Build OIC C Common libraries required for CA
57
58 include $(CLEAR_VARS)
59 LOCAL_MODULE = OICCommon
60
61 #Build Common Libraries
62 LOCAL_PATH = $(OIC_C_COMMON_PATH)
63 LOCAL_CFLAGS = -D__ANDROID__ $(DEBUG_FLAG)
64 LOCAL_CFLAGS += -std=c99
65
66 LOCAL_C_INCLUDES = $(OIC_C_COMMON_PATH)/oic_malloc/include \
67                    $(OIC_C_COMMON_PATH)/oic_string/include
68 LOCAL_SRC_FILES  = oic_malloc/src/oic_malloc.c \
69                    oic_string/src/oic_string.c
70
71 include $(BUILD_STATIC_LIBRARY)
72
73 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74 #Build CACommon
75
76 include $(CLEAR_VARS)
77
78 #Build Common Libraries
79 LOCAL_PATH = $(PROJECT_COMMON_SRC_PATH)
80 LOCAL_MODULE = CACommon
81 LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
82 #LOCAL_SHARED_LIBRARIES = Glib GLibThread
83 LOCAL_STATIC_LIBRARIES = rt pthread
84 LOCAL_STATIC_LIBRARIES += OICCommon
85
86 LOCAL_CFLAGS = -D__ANDROID__ $(DEBUG_FLAG)
87 LOCAL_CFLAGS += -std=c99
88
89 LOCAL_C_INCLUDES = $(PROJECT_COMMON_INC_PATH)
90 LOCAL_C_INCLUDES += $(PROJECT_API_PATH)
91 LOCAL_C_INCLUDES += $(OIC_C_COMMON_PATH)/oic_malloc/include
92 LOCAL_C_INCLUDES += $(OIC_C_COMMON_PATH)/oic_string/include
93
94 LOCAL_SRC_FILES =       oic_logger.c oic_console_logger.c logger.c \
95                         uarraylist.c uqueue.c \
96                         cathreadpool_pthreads.c camutex_pthreads.c \
97                         caremotehandler.c
98
99 include $(BUILD_STATIC_LIBRARY)
100
101 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
102 #Build CACoap
103
104 include $(CLEAR_VARS)
105
106 LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
107 LOCAL_PATH = $(PROJECT_LIB_PATH)/libcoap-4.1.1
108 LOCAL_MODULE = CACoap
109 LOCAL_EXPORT_C_INCLUDES = $(PROJECT_LIB_PATH)/libcoap-4.1.1
110 LOCAL_CFLAGS = -DWITH_POSIX
111 LOCAL_SRC_FILES = pdu.c net.c debug.c encode.c uri.c coap_list.c resource.c hashkey.c \
112                                         str.c option.c async.c subscribe.c block.c
113
114 include $(BUILD_STATIC_LIBRARY)
115
116 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
117 #Build CA
118
119 #Relative path to LOCAL_PATH (PROJECT_SRC_PATH)
120 LOCAL_PLATFORM                          = android
121
122 ENET_ADAPTER_PATH                       = ethernet_adapter/$(LOCAL_PLATFORM)
123 EDR_ADAPTER_PATH                        = bt_edr_adapter/$(LOCAL_PLATFORM)
124 LE_ADAPTER_PATH                         = bt_le_adapter/$(LOCAL_PLATFORM)
125 IP_ADAPTER_PATH                         = ip_adapter
126 ADAPTER_UTILS                           = adapter_util
127
128 include $(CLEAR_VARS)
129
130 LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
131 LOCAL_PATH = $(PROJECT_SRC_PATH)
132 LOCAL_MODULE = CA
133
134 LOCAL_STATIC_LIBRARIES = CACommon CACoap TinyDtls
135
136 LOCAL_C_INCLUDES = $(PROJECT_API_PATH)
137 LOCAL_C_INCLUDES += $(PROJECT_COMMON_INC_PATH)
138 LOCAL_C_INCLUDES += $(PROJECT_INC_PATH)
139 LOCAL_C_INCLUDES += $(PROJECT_LIB_PATH)/libcoap-4.1.1
140 LOCAL_C_INCLUDES += $(PROJECT_EXTERNAL_PATH)
141 LOCAL_C_INCLUDES += $(OIC_C_COMMON_PATH)/oic_malloc/include
142 LOCAL_C_INCLUDES += $(OIC_C_COMMON_PATH)/oic_string/include
143
144 LOCAL_C_INCLUDES += $(DTLS_LIB)
145
146 LOCAL_CFLAGS += $(BUILD_FLAG)
147 LOCAL_CFLAGS += -std=c99 -DWITH_POSIX -DWITH_BWT
148
149 LOCAL_SRC_FILES = \
150                 caconnectivitymanager.c cainterfacecontroller.c \
151                 camessagehandler.c canetworkconfigurator.c caprotocolmessage.c \
152                 caretransmission.c caqueueingthread.c cablockwisetransfer.c \
153                 $(ADAPTER_UTILS)/caadapternetdtls.c $(ADAPTER_UTILS)/caadapterutils.c \
154                 $(ADAPTER_UTILS)/cafragmentation.c \
155                 bt_le_adapter/caleadapter.c $(LE_ADAPTER_PATH)/caleclient.c \
156                 $(LE_ADAPTER_PATH)/caleserver.c $(LE_ADAPTER_PATH)/caleutils.c \
157                 $(LE_ADAPTER_PATH)/calenwmonitor.c \
158                 bt_edr_adapter/caedradapter.c $(EDR_ADAPTER_PATH)/caedrutils.c \
159                 $(EDR_ADAPTER_PATH)/caedrclient.c $(EDR_ADAPTER_PATH)/caedrserver.c \
160                 $(EDR_ADAPTER_PATH)/caedrnwmonitor.c \
161                 $(IP_ADAPTER_PATH)/caipadapter.c $(IP_ADAPTER_PATH)/caipserver.c \
162                 $(IP_ADAPTER_PATH)/android/caipnwmonitor.c \
163                 nfc_adapter/canfcadapter.c nfc_adapter/android/canfcserver.c
164
165 include $(BUILD_STATIC_LIBRARY)