4a40c95974f27d9c3f07cae91fcb62d16b088738
[platform/upstream/iotivity.git] / examples / OICMiddle / 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     := debug
24 PLATFORM  := linux
25 CXX       := g++
26 #CXX      := clang
27 OUT_DIR   := $(BUILD)
28 OIC       := ../..
29 OIC_RES   := $(OIC)/resource
30 OIC_LIB   := $(OIC)/out/linux/x86_64/release
31 OBJS      := OICMiddle.o \
32                                 Client.o \
33                                 Server.o \
34                                 WrapResource.o \
35                                 LineInput.o \
36                                 RestInput.o
37
38 CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread
39
40 CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
41
42 CXX_INC   := -I$(OIC_RES)/include/
43 CXX_INC   += -I$(OIC_RES)/oc_logger/include
44 CXX_INC   += -I$(OIC_RES)/csdk/stack/include
45 CXX_INC   += -I$(OIC_RES)/csdk/ocrandom/include
46 CXX_INC   += -I$(OIC_RES)/csdk/logger/include
47 CXX_INC   += -I$(OIC_RES)/csdk/connectivity/lib/libcoap-4.1.1
48
49 CXX_LIBS  := -L${OIC_LIB}
50 CXX_LIBS  += -loc
51 CXX_LIBS  += -loctbstack
52 CXX_LIBS  += -loc_logger
53 #CXX_LIBS  += -loc_logger_core
54 CXX_LIBS  += -lconnectivity_abstraction
55 CXX_LIBS  += -lcoap
56
57 all: prep_dirs OICMiddle
58
59 prep_dirs:
60         -mkdir -p $(OUT_DIR)
61
62 OICMiddle: $(OBJS)
63         $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ $(OBJS) $(CXX_LIBS)
64
65 OICMiddle.o: OICMiddle.cpp OICMiddle.h
66         $(CXX) -c $(CXX_FLAGS.$(BUILD)) OICMiddle.cpp $(CXX_INC)
67
68 Client.o: Client.cpp Client.h OICMiddle.h
69         $(CXX) -c $(CXX_FLAGS.$(BUILD)) Client.cpp $(CXX_INC)
70
71 Server.o: Server.cpp Server.h OICMiddle.h
72         $(CXX) -c $(CXX_FLAGS.$(BUILD)) Server.cpp $(CXX_INC)
73
74 WrapResource.o: WrapResource.cpp WrapResource.h OICMiddle.h
75         $(CXX) -c $(CXX_FLAGS.$(BUILD)) WrapResource.cpp $(CXX_INC)
76
77 LineInput.o: LineInput.cpp LineInput.h OICMiddle.h
78         $(CXX) -c $(CXX_FLAGS.$(BUILD)) LineInput.cpp $(CXX_INC)
79
80 RestInput.o: RestInput.cpp RestInput.h OICMiddle.h
81         $(CXX) -c $(CXX_FLAGS.$(BUILD)) RestInput.cpp $(CXX_INC)
82
83 clean:
84         rm $(OBJS)
85         rm -rf debug
86         rm -rf release
87
88