1 # //******************************************************************
3 # // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # // http://www.apache.org/licenses/LICENSE-2.0
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.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 # override with `make BUILD=debug`
22 # default to release build
27 OBJ_DIR := $(OUT_DIR)/obj
30 ROOT_DIR = ../../../..
35 OCLOGGER_DIR = $(ROOT_DIR)/logger
36 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
37 OCRANDOM_DIR = $(ROOT_DIR)/ocrandom
38 OCSOCKET_DIR = $(ROOT_DIR)/ocsocket
39 LCOAP_DIR = $(ROOT_DIR)/libcoap-4.1.1
40 OCCOAP_DIR = $(ROOT_DIR)/occoap
41 OCTBSTACK_DIR = $(ROOT_DIR)/stack
43 OCLOGGER_INC = $(OCLOGGER_DIR)/include
44 OC_LOG_INC = $(OC_LOG_DIR)/include
45 OCRANDOM_INC = $(OCRANDOM_DIR)/include
46 OCSOCKET_INC = $(OCSOCKET_DIR)/include
47 LCOAP_INC = $(LCOAP_DIR)
48 OCCOAP_INC = $(OCCOAP_DIR)/include
49 OCTBSTACK_INC = $(OCTBSTACK_DIR)/include
51 INC_DIRS := -I$(OCLOGGER_INC)
52 INC_DIRS += -I$(OC_LOG_INC)
53 INC_DIRS += -I$(OCRANDOM_INC)
54 INC_DIRS += -I$(OCSOCKET_INC)
55 INC_DIRS += -I$(LCOAP_INC)
56 INC_DIRS += -I$(OCCOAP_INC)
57 INC_DIRS += -I$(OCTBSTACK_INC)
59 CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions \
60 -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG
61 CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s -fno-exceptions \
62 -std=c++0x $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) -DTB_LOG
64 LDLIBS += -loctbstack -lpthread
65 CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS)
67 SOURCES := occlient.cpp ocserver.cpp occlientcoll.cpp ocservercoll.cpp common.cpp
69 OBJECTS:= $(patsubst %.c, $(OBJ_DIR)/%.o, $(SOURCES))
73 PROGRAMS += ocservercoll
74 PROGRAMS += occlientcoll
76 all: c_sdk prep_dirs $(OBJECTS) $(PROGRAMS)
83 cd $(ROOT_DIR) && $(MAKE) BUILD=$(BUILD) PLATFORM=$(PLATFORM)
86 $(CC) -c $(CPPFLAGS) $< -o $@
88 ocserver: $(OBJ_DIR)/ocserver.o $(OBJ_DIR)/common.o
89 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
91 ocservercoll: $(OBJ_DIR)/ocservercoll.o $(OBJ_DIR)/common.o
92 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
94 occlient: $(OBJ_DIR)/occlient.o $(OBJ_DIR)/common.o
95 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
97 occlientcoll: $(OBJ_DIR)/occlientcoll.o $(OBJ_DIR)/common.o
98 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
105 cd $(ROOT_DIR) && $(MAKE) clean
106 cd $(ROOT_DIR) && $(MAKE) deepclean
109 rm -f *.o $(PROGRAMS)