Merge "Implemented JSON Serialization using Cereal Library"
[platform/upstream/iotivity.git] / resource / examples / 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=release`
22 # default to release build
23 BUILD     := release
24 PLATFORM  := linux
25 CXX           := g++
26 #CXX      := clang
27 OUT_DIR   := $(BUILD)
28
29 DEPEND_DIR:= ../dependencies
30 CEREAL_DIR:= $(DEPEND_DIR)/cereal
31
32 CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread
33
34 CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
35
36 CXX_INC   := -I../include/
37 CXX_INC   += -I../oc_logger/include
38 CXX_INC   += -I../csdk/stack/include
39 CXX_INC   += -I../csdk/ocsocket/include
40 CXX_INC   += -I../csdk/ocrandom/include
41 CXX_INC   += -I../csdk/logger/include
42 CXX_INC   += -I../csdk/libcoap
43 CXX_INC   += -I$(CEREAL_DIR)/include
44
45 LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
46
47 CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
48
49 # Force metatargets to build:
50 all.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient ocicuc_target threadingsample
51
52 apps.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample
53
54 buildScript_all.PHONY: prep_dirs simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample
55
56 all: all.PHONY
57
58 apps: apps.PHONY
59
60 buildScript_all: buildScript_all.PHONY
61
62 prep_dirs:
63         -mkdir -p $(OUT_DIR)
64
65 oc_cpp_sdk:
66         cd ../ && $(MAKE) cpp_sdk "BUILD=$(BUILD)"
67
68 simpleserver: simpleserver.cpp
69         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleserver.cpp $(CXX_INC) $(CXX_LIBS)
70
71 simpleserverHQ: simpleserverHQ.cpp
72         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleserverHQ.cpp $(CXX_INC) $(CXX_LIBS)
73
74 simpleclientHQ: simpleclientHQ.cpp
75         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclientHQ.cpp $(CXX_INC) $(CXX_LIBS)
76
77 simpleclient: simpleclient.cpp
78         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclient.cpp $(CXX_INC) $(CXX_LIBS)
79
80 fridgeserver: fridgeserver.cpp
81         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ fridgeserver.cpp $(CXX_INC) $(CXX_LIBS)
82
83 fridgeclient: fridgeclient.cpp
84         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ fridgeclient.cpp $(CXX_INC) $(CXX_LIBS)
85
86 presenceserver: presenceserver.cpp
87         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ presenceserver.cpp $(CXX_INC) $(CXX_LIBS)
88
89 presenceclient: presenceclient.cpp
90         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ presenceclient.cpp $(CXX_INC) $(CXX_LIBS)
91
92 simpleclientserver: simpleclientserver.cpp
93         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclientserver.cpp $(CXX_INC) $(CXX_LIBS)
94
95 roomserver: roomserver.cpp
96         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ roomserver.cpp $(CXX_INC) $(CXX_LIBS)
97
98 roomclient: roomclient.cpp
99         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ roomclient.cpp $(CXX_INC) $(CXX_LIBS)
100
101 garageserver: garageserver.cpp
102         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageserver.cpp $(CXX_INC) $(CXX_LIBS)
103
104 garageclient: garageclient.cpp
105         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageclient.cpp $(CXX_INC) $(CXX_LIBS)
106
107 threadingsample: threadingsample.cpp
108         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ threadingsample.cpp $(CXX_INC) $(CXX_LIBS)
109
110 ocicuc_target:
111         cd ocicuc && $(MAKE) apps
112
113 clean:
114         rm -rf debug
115         rm -rf release
116         cd ../ && $(MAKE) clean_cpp_sdk
117         cd ocicuc && $(MAKE) clean
118         cd ocicuc && $(MAKE) clean_apps
119
120 clean_apps:
121         rm -rf debug
122         rm -rf release
123         cd ocicuc && $(MAKE) clean
124         cd ocicuc && $(MAKE) clean_apps