Updated Makefiles and CMakeLists.txt to point to resource, not oic-resource
[platform/upstream/iotivity.git] / resource / unittests / 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 # override with `make BUILD=debug`
22 # default to release build
23 BUILD    := release
24 PLATFORM := linux
25 CXX      := g++
26
27 ROOT_DIR        = ./
28
29 # You must create the file "local.properties" on your local machine which contains any local paths, etc
30 # local.properties should NOT be committed to repo
31 include $(ROOT_DIR)/../csdk/local.properties
32 # GTEST_DIR contains the path to Google Test libs and must be defined in local.properties
33 #  Example:
34 #  GTEST_DIR := /home/johndoe/utils/gtest-1.7.0
35
36 # NOTE:  to run app, make sure that LD_LIBRARY_PATH env variable
37 #        contains $(GTEST_DIR)/lib/.libs
38
39 OUT_DIR   := $(BUILD)
40
41 INC_DIRS  := -I../include/
42 INC_DIRS  += -I../oc_logger/include
43 INC_DIRS  += -I../csdk/stack/include
44 INC_DIRS  += -I../csdk/ocsocket/include
45 INC_DIRS  += -I../csdk/ocrandom/include
46 INC_DIRS  += -I../csdk/logger/include
47 INC_DIRS  += -I../csdk/libcoap
48 INC_DIRS  += -I$(GTEST_DIR)/include
49
50 LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
51
52 CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
53 CXX_LIBS  += $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a
54
55 CC_FLAGS.debug      := -g -O0 -g3 -Wall -ffunction-sections -fdata-sections \
56                         -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD) -DTB_LOG
57 CC_FLAGS.release    := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s \
58                         -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/$(BUILD)
59
60 CPPFLAGS        += $(CC_FLAGS.$(BUILD)) $(CXX_LIBS) -lpthread
61
62 all: prep_dirs tests
63
64 prep_dirs:
65         -mkdir -p $(OUT_DIR)
66
67 tests: tests.cpp
68         $(CXX) $^ $(CPPFLAGS) -o $(OUT_DIR)/$@
69
70 .PHONY: clean
71
72 clean:
73         -rm -rf release
74         -rm -rf debug