Merge "Fix failed unit tests for CSDK stack."
[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 CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread
30
31 CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
32
33 CXX_INC   := -I../include/
34 CXX_INC   += -I../oc_logger/include
35 CXX_INC   += -I../csdk/stack/include
36 CXX_INC   += -I../csdk/ocsocket/include
37 CXX_INC   += -I../csdk/ocrandom/include
38 CXX_INC   += -I../csdk/logger/include
39 CXX_INC   += -I../csdk/libcoap
40
41 LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
42
43 CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
44
45 # Force metatargets to build:
46 all.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient ocicuc_target threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
47
48 apps.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
49
50 buildScript_all.PHONY: prep_dirs simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
51
52 all: all.PHONY
53
54 apps: apps.PHONY
55
56 buildScript_all: buildScript_all.PHONY
57
58 prep_dirs:
59         -mkdir -p $(OUT_DIR)
60
61 oc_cpp_sdk:
62         cd ../ && $(MAKE) cpp_sdk "BUILD=$(BUILD)"
63
64 simpleserver: simpleserver.cpp
65         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleserver.cpp $(CXX_INC) $(CXX_LIBS)
66
67 simpleserverHQ: simpleserverHQ.cpp
68         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleserverHQ.cpp $(CXX_INC) $(CXX_LIBS)
69
70 simpleclientHQ: simpleclientHQ.cpp
71         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclientHQ.cpp $(CXX_INC) $(CXX_LIBS)
72
73 simpleclient: simpleclient.cpp
74         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclient.cpp $(CXX_INC) $(CXX_LIBS)
75
76 fridgeserver: fridgeserver.cpp
77         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ fridgeserver.cpp $(CXX_INC) $(CXX_LIBS)
78
79 fridgeclient: fridgeclient.cpp
80         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ fridgeclient.cpp $(CXX_INC) $(CXX_LIBS)
81
82 presenceserver: presenceserver.cpp
83         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ presenceserver.cpp $(CXX_INC) $(CXX_LIBS)
84
85 presenceclient: presenceclient.cpp
86         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ presenceclient.cpp $(CXX_INC) $(CXX_LIBS)
87
88 simpleclientserver: simpleclientserver.cpp
89         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ simpleclientserver.cpp $(CXX_INC) $(CXX_LIBS)
90
91 roomserver: roomserver.cpp
92         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ roomserver.cpp $(CXX_INC) $(CXX_LIBS)
93
94 roomclient: roomclient.cpp
95         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ roomclient.cpp $(CXX_INC) $(CXX_LIBS)
96
97 garageserver: garageserver.cpp
98         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageserver.cpp $(CXX_INC) $(CXX_LIBS)
99
100 garageclient: garageclient.cpp
101         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ garageclient.cpp $(CXX_INC) $(CXX_LIBS)
102
103 threadingsample: threadingsample.cpp
104         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ threadingsample.cpp $(CXX_INC) $(CXX_LIBS)
105
106 groupserver: groupserver.cpp
107         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ groupserver.cpp $(CXX_INC) $(CXX_LIBS)
108
109 groupclient: groupclient.cpp
110         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ groupclient.cpp $(CXX_INC) $(CXX_LIBS)
111
112 lightserver: lightserver.cpp
113         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ lightserver.cpp $(CXX_INC) $(CXX_LIBS)
114
115 devicediscoveryserver: devicediscoveryserver.cpp
116         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ devicediscoveryserver.cpp $(CXX_INC) $(CXX_LIBS)
117
118 devicediscoveryclient: devicediscoveryclient.cpp
119         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ devicediscoveryclient.cpp $(CXX_INC) $(CXX_LIBS)
120         
121         
122
123 ocicuc_target:
124         cd ocicuc && $(MAKE) apps
125
126 clean:
127         rm -rf debug
128         rm -rf release
129         cd ../ && $(MAKE) clean_cpp_sdk
130         cd ocicuc && $(MAKE) clean
131         cd ocicuc && $(MAKE) clean_apps
132
133 clean_apps:
134         rm -rf debug
135         rm -rf release
136         cd ocicuc && $(MAKE) clean
137         cd ocicuc && $(MAKE) clean_apps