summaryrefslogtreecommitdiff
path: root/examples/OICMiddle/makefile
blob: 7b396057962e1106f8b972712c2a99086dbac4b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#//******************************************************************
#//
#// Copyright 2014 Intel Corporation.
#//
#//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#//
#// Licensed under the Apache License, Version 2.0 (the "License");
#// you may not use this file except in compliance with the License.
#// You may obtain a copy of the License at
#//
#//      http://www.apache.org/licenses/LICENSE-2.0
#//
#// Unless required by applicable law or agreed to in writing, software
#// distributed under the License is distributed on an "AS IS" BASIS,
#// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#// See the License for the specific language governing permissions and
#// limitations under the License.
#//
#//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# override with `make BUILD=release`
# default to release build
BUILD	  := debug
PLATFORM  := linux
CXX	  := g++
#CXX	  := clang
OUT_DIR	  := $(BUILD)
OIC       := ../..
OIC_RES   := $(OIC)/resource
OIC_LIB   := $(OIC)/out/linux/x86_64/release
OBJS	  := OICMiddle.o \
				Client.o \
				Server.o \
				WrapResource.o \
				LineInput.o \
				RestInput.o

CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread

CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread

CXX_INC	  := -I$(OIC_RES)/include/
CXX_INC   += -I$(OIC_RES)/oc_logger/include
CXX_INC	  += -I$(OIC_RES)/csdk/stack/include
CXX_INC	  += -I$(OIC_RES)/csdk/ocsocket/include
CXX_INC	  += -I$(OIC_RES)/csdk/ocrandom/include
CXX_INC	  += -I$(OIC_RES)/csdk/logger/include
CXX_INC	  += -I$(OIC_RES)/csdk/libcoap

CXX_LIBS  := -L${OIC_LIB}
CXX_LIBS  += -loc
CXX_LIBS  += -loctbstack
CXX_LIBS  += -loc_logger
CXX_LIBS  += -loc_logger_core
CXX_LIBS  += -lcoap

all: prep_dirs OICMiddle

prep_dirs:
	-mkdir -p $(OUT_DIR)

OICMiddle: $(OBJS)
	$(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ $(OBJS) $(CXX_LIBS)

OICMiddle.o: OICMiddle.cpp OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) OICMiddle.cpp $(CXX_INC)

Client.o: Client.cpp Client.h OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) Client.cpp $(CXX_INC)

Server.o: Server.cpp Server.h OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) Server.cpp $(CXX_INC)

WrapResource.o: WrapResource.cpp WrapResource.h OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) WrapResource.cpp $(CXX_INC)

LineInput.o: LineInput.cpp LineInput.h OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) LineInput.cpp $(CXX_INC)

RestInput.o: RestInput.cpp RestInput.h OICMiddle.h
	$(CXX) -c $(CXX_FLAGS.$(BUILD)) RestInput.cpp $(CXX_INC)

clean:
	rm $(OBJS)
	rm -rf debug
	rm -rf release