1 Bug fix to check for length of uri and query separately.
[platform/upstream/iotivity.git] / 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 CXX           := g++
25 #CXX      := clang
26 OUT_DIR   := $(PWD)/$(BUILD)
27 OBJ_DIR   := $(OUT_DIR)/obj
28
29 CXX_FLAGS.debug     := -g3 -std=c++0x -Wall -pthread -O0
30 CXX_FLAGS.release   := -std=c++0x -Wall -pthread -O3
31
32 CXX_INC   := -I./include/
33 CXX_INC   += -I./csdk/stack/include
34 CXX_INC   += -I./csdk/ocsocket/include
35 CXX_INC   += -I./csdk/ocrandom/include
36 CXX_INC   += -I./csdk/logger/include
37 CXX_INC   += -I./csdk/libcoap
38
39 # Force metatargets to build:
40 .PHONY: prep_dirs c_sdk liboc.a examples
41
42 all:    .PHONY
43
44 prep_dirs:
45         -mkdir -p $(OUT_DIR)
46         -mkdir -p $(OBJ_DIR)
47
48 c_sdk:
49         cd csdk && $(MAKE) "BUILD=$(BUILD)"
50
51 examples: liboc.a
52         cd examples && $(MAKE) "BUILD=$(BUILD)"
53
54 liboc.a: OCPlatform.o OCResource.o OCUtilities.o InProcServerWrapper.o InProcClientWrapper.o
55         ar -cvq $(OBJ_DIR)/liboc.a $(OBJ_DIR)/OCPlatform.o $(OBJ_DIR)/OCResource.o $(OBJ_DIR)/OCUtilities.o $(OBJ_DIR)/InProcServerWrapper.o $(OBJ_DIR)/InProcClientWrapper.o
56
57 OCPlatform.o: src/OCPlatform.cpp
58         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCPlatform.cpp $(CXX_INC)
59
60 OCResource.o: src/OCResource.cpp
61         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCResource.cpp $(CXX_INC)
62
63 OCUtilities.o: src/OCUtilities.cpp
64         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/OCUtilities.cpp $(CXX_INC)
65
66 InProcServerWrapper.o: src/InProcServerWrapper.cpp
67         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcServerWrapper.cpp $(CXX_INC)
68
69 InProcClientWrapper.o: src/InProcClientWrapper.cpp
70         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OBJ_DIR)/$@ -c src/InProcClientWrapper.cpp $(CXX_INC)
71
72 clean: clean_legacy
73         -rm -rf release
74         -rm -rf debug
75         cd csdk && $(MAKE) clean
76         cd csdk && $(MAKE) deepclean
77         cd examples && $(MAKE) clean
78 clean_legacy:
79         -rm -f -v $(OBJ_DIR)/liboc.a $(OBJ_DIR)/*.o