1 # //******************************************************************
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # // http://www.apache.org/licenses/LICENSE-2.0
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.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 # override with `make BUILD=debug`
22 # default to release build
29 GTEST_DIR= ../../extlibs/gtest-1.7.0
30 MOCKS_DIR= ../../extlibs/hippomocks-master
38 INC_DIRS := -I../include/
39 INC_DIRS += -I../oc_logger/include
40 INC_DIRS += -I../csdk/stack/include
41 INC_DIRS += -I../csdk/ocsocket/include
42 INC_DIRS += -I../csdk/ocrandom/include
43 INC_DIRS += -I../csdk/logger/include
44 INC_DIRS += -I../csdk/libcoap
45 INC_DIRS += -I$(GTEST_DIR)/include
46 INC_DIRS += -I$(MOCKS_DIR)/HippoMocks
47 INC_DIRS += -I$(MOCKS_DIR)/HippoMocksTest
49 LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
51 GTEST_LIBS := $(GTEST_DIR)/lib/.libs/libgtest.a $(GTEST_DIR)/lib/.libs/libgtest_main.a
52 CXX_LIBS := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
53 CXX_LIBS += $(GTEST_LIBS)
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)
60 CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(CXX_LIBS) -lpthread
62 all: prep_dirs $(MOCKS_DIR) unittests
67 unittests: OCPlatformTest.cpp OCResourceTest.cpp ConstructResourceTest.cpp $(GTEST_LIBS)
68 $(CXX) $^ $(CPPFLAGS) -o $(OUT_DIR)/$@
72 wget -q https://googletest.googlecode.com/files/gtest-1.7.0.zip && \
75 $(GTEST_LIBS): $(GTEST_DIR)
76 cd $(GTEST_DIR) && ./configure && make
80 wget -q https://github.com/dascandy/hippomocks/archive/master.zip && \