iotivity 0.9.0
[platform/upstream/iotivity.git] / resource / csdk / ocsocket / test / android / makefile
1 # //******************************************************************
2 # //
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 # //
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 # //
7 # // Licensed under the Apache License, Version 2.0 (the "License");
8 # // you may not use this file except in compliance with the License.
9 # // You may obtain a copy of the License at
10 # //
11 # //      http://www.apache.org/licenses/LICENSE-2.0
12 # //
13 # // Unless required by applicable law or agreed to in writing, software
14 # // distributed under the License is distributed on an "AS IS" BASIS,
15 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # // See the License for the specific language governing permissions and
17 # // limitations under the License.
18 # //
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 #
21 include ../local.properties
22
23 ROOT_DIR = ../../..
24 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
25 LOGGER_DIR = $(ROOT_DIR)/logger
26 BIN_DIR = $(OCSOCK_DIR)/bin/android/
27 OBJ_DIR = $(OCSOCK_DIR)/obj/android/
28 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
29
30 CXX=arm-linux-androideabi-g++
31 CC=arm-linux-androideabi-gcc
32 CFLAGS_ANDROID =  -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DGTEST_HAS_PTHREAD=0
33 LDFLAGS_ANDROID = -march=armv7-a -Wl,--fix-cortex-a8 -llog
34
35 DEP_LIBS = $(GTEST_ANDROID_DIR)/lib/.libs/libgtest_main.a $(GTEST_ANDROID_DIR)/lib/.libs/libgtest.a
36
37 CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -DTB_LOG
38
39 TEST_APP = ocsocket_gtest
40
41 COBJ = ocsocket.o logger.o
42
43 VPATH = $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src
44
45 all: $(TEST_APP)
46         mkdir -p $(BIN_DIR)
47         cp $(TEST_APP) $(BIN_DIR)
48         mkdir -p $(OBJ_DIR)
49         cp *.o $(OBJ_DIR)
50
51 %.o: %.c
52         $(CXX) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) $< -o $@
53
54 $(TEST_APP).o: $(TEST_APP).cpp
55         $(CXX) -c $(CFLAGS) $(CFLAGS_ANDROID) $(INC_DIRS) -I$(GTEST_ANDROID_DIR)/include -o $@ $<
56
57 $(TEST_APP): $(TEST_APP).o $(DEP_LIBS) $(COBJ)
58         $(CXX) -Os -Wl,--gc-sections $(LDFLAGS_ANDROID) $^ -o $@
59
60 install: all
61 #       adb remount
62         adb push $(BIN_DIR)$(TEST_APP) /data/local/tmp/
63
64 .PHONY: clean
65
66 clean:
67         rm -f *.o $(TEST_APP) recv
68         rm -fr $(BIN_DIR)
69         rm -fr $(OBJ_DIR)
70