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
34 DEPEND_DIR:= $(ROOT_DIR)/dependencies
35 CEREAL_DIR:= $(DEPEND_DIR)/cereal
37 OUT_DIR := $(ROOT_DIR)/$(BUILD)
38 OBJ_DIR := $(OUT_DIR)/obj
40 #TODO-CA Need to remove flag later
41 CXX_FLAGS.debug := -g3 -std=c++0x -Wall -pthread -O0 -DCA_INT
42 CXX_FLAGS.release := -std=c++0x -Wall -pthread -O3 -DCA_INT
44 CXX_INC := -I./include/
45 CXX_INC += -I./oc_logger/include
47 CXX_INC += -I./csdk/stack/include
48 CXX_INC += -I./csdk/ocsocket/include
49 CXX_INC += -I./csdk/ocrandom/include
50 CXX_INC += -I./csdk/logger/include
51 CXX_INC += -I./csdk/libcoap
52 CXX_INC += -I$(CEREAL_DIR)/include
53 # Force metatargets to build:
54 all.PHONY: applyDepPatches prep_dirs c_sdk oc_logger_target liboc.a examples
56 buildScript_all.PHONY: applyDepPatches prep_dirs oc_logger_target liboc.a
60 buildScript_all: buildScript_all.PHONY
66 # used to fetch all dependencies
68 -mkdir -p $(DEPEND_DIR)
70 if [ ! -d "$(CEREAL_DIR)" ]; then\
71 cd $(DEPEND_DIR) && git clone https://github.com/USCiLab/cereal.git;\
72 cd $(CEREAL_DIR) && git checkout 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245;\
76 #reset git to the 'base version', so we can apply our patch without issues
77 cd $(CEREAL_DIR) && git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245;
78 cd $(CEREAL_DIR) && git apply $(ROOT_DIR)/patches/cereal_gcc46.patch
81 cd csdk && $(MAKE) "BUILD=$(BUILD)" "PLATFORM=$(PLATFORM)"
84 cd oc_logger && $(MAKE) "BUILD=$(BUILD)"
86 cpp_sdk: prep_dirs c_sdk liboc.a
89 cd examples && $(MAKE) apps "BUILD=$(BUILD)"
91 liboc.a: OCPlatform_impl.o OCPlatform.o OCResource.o OCException.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o OCRepresentation.o OCResourceRequest.o
92 ar -cvq $(OBJ_DIR)/liboc.a $(OBJ_DIR)/OCPlatform_impl.o $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCException.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o $(OBJ_DIR)/OCRepresentation.o $(OBJ_DIR)/OCResourceRequest.o
94 OCPlatform_impl.o: src/OCPlatform_impl.cpp
95 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCPlatform_impl.cpp $(CXX_INC)
97 OCPlatform.o: src/OCPlatform.cpp
98 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCPlatform.cpp $(CXX_INC)
100 OCRepresentation.o: src/OCRepresentation.cpp
101 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCRepresentation.cpp $(CXX_INC)
103 OCResource.o: src/OCResource.cpp
104 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCResource.cpp $(CXX_INC)
106 OCException.o: src/OCException.cpp
107 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCException.cpp $(CXX_INC)
109 OCUtilities.o: src/OCUtilities.cpp
110 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCUtilities.cpp $(CXX_INC)
112 InProcServerWrapper.o: src/InProcServerWrapper.cpp
113 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcServerWrapper.cpp $(CXX_INC)
115 InProcClientWrapper.o: src/InProcClientWrapper.cpp
116 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcClientWrapper.cpp $(CXX_INC)
118 OCResourceRequest.o: src/OCResourceRequest.cpp
119 $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCResourceRequest.cpp $(CXX_INC)
124 cd oc_logger && $(MAKE) clean
126 clean_cpp_sdk: clean_legacy
131 -rm -f -v $(OBJ_DIR)/liboc.a $(OBJ_DIR)/*.o
132 cd csdk && $(MAKE) clean
133 cd csdk && $(MAKE) deepclean