6cfd31888ceaea7f4f2a4f2ca8fa874aecd54705
[platform/upstream/iotivity.git] / csdk / ocsocket / test / linux / 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 PLATFORM := linux
22
23 ROOT_DIR = ../../..
24 include $(ROOT_DIR)/local.properties
25
26 OCSOCK_DIR = $(ROOT_DIR)/ocsocket
27 LOGGER_DIR = $(ROOT_DIR)/logger
28 BIN_DIR = $(OCSOCK_DIR)/bin/linux/
29 OBJ_DIR = $(OCSOCK_DIR)/obj/linux/
30 INC_DIRS = -I$(OCSOCK_DIR)/include/ -I$(LOGGER_DIR)/include
31
32 CXX = g++
33 CC = gcc
34
35 CFLAGS += -Os -Wall -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -DTB_LOG
36 DEP_LIBS = $(GTEST_LINUX_DIR)/lib/.libs/libgtest_main.a $(GTEST_LINUX_DIR)/lib/.libs/libgtest.a
37 VPATH = $(OCSOCK_DIR)/src:$(LOGGER_DIR)/src
38
39 TEST_APP = ocsocket_gtest
40 COBJ = logger.o ocsocket.o 
41
42 all: $(TEST_APP)
43         mkdir -p $(BIN_DIR)
44         cp $(TEST_APP) $(BIN_DIR)
45         mkdir -p $(OBJ_DIR)
46         cp *.o $(OBJ_DIR)
47
48 %.o: %.c
49         $(CC) -c $(CFLAGS) $(INC_DIRS) $< -o $@
50
51 $(TEST_APP).o: $(TEST_APP).cpp
52         $(CXX) -c $(CFLAGS) -pthread $(INC_DIRS)  -I$(GTEST_LINUX_DIR)/include -o $@ $<
53
54 $(TEST_APP): $(TEST_APP).o $(DEP_LIBS) $(COBJ)
55         $(CXX) -Os -Wl,--gc-sections $^ -lpthread -o $@
56
57 .PHONY: clean
58
59 clean:
60         rm -f *.o $(TEST_APP)
61         rm -fr $(BIN_DIR)
62         rm -fr $(OBJ_DIR)
63
64