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
31 ROOT_DIR = ../../../..
36 OCLOGGER_DIR = $(ROOT_DIR)/logger
37 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
38 OCRANDOM_DIR = $(ROOT_DIR)/ocrandom
39 OCTBSTACK_DIR = $(ROOT_DIR)/stack
40 EXTLIBS_DIR = $(ROOT_DIR)/../../extlibs
41 CJSON_DIR = $(EXTLIBS_DIR)/cjson
42 CJSON_SRC = $(CJSON_DIR)
43 CONNECTIVITY_DIR= $(ROOT_DIR)/connectivity
46 OCLOGGER_INC = $(OCLOGGER_DIR)/include
47 OC_LOG_INC = $(OC_LOG_DIR)/include
48 OCRANDOM_INC = $(OCRANDOM_DIR)/include
49 OCTBSTACK_INC = $(OCTBSTACK_DIR)/include
50 CJSON_INC = $(CJSON_DIR)
52 INC_DIRS := -I$(OCLOGGER_INC)
53 INC_DIRS += -I$(OC_LOG_INC)
54 INC_DIRS += -I$(OCRANDOM_INC)
55 INC_DIRS += -I$(OCTBSTACK_INC)
56 INC_DIRS += -I$(CJSON_INC)
58 CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections -fno-exceptions \
59 -std=c++0x -pedantic $(INC_DIRS) -L$(ROOT_DIR)/linux/$(BUILD) \
60 -L$(CONNECTIVITY_DIR)/build/out -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) \
63 -L$(CONNECTIVITY_DIR)/build/out -DTB_LOG
65 LDLIBS += -loctbstack -lpthread
66 CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS)
67 ifeq ($(CA_INT_DTLS),1)
68 CPPFLAGS += -lconnectivity_abstraction -DCA_INT_DTLS
71 CJSON_SOURCES := $(CJSON_SRC)/cJSON.c
73 SOURCES := $(CJSON_SOURCES)
74 SOURCES += common.cpp ocserverbasicops.cpp occlientbasicops.cpp gen_sec_bin.cpp
76 OBJECTS:= $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(SOURCES))
78 PROGRAMS += ocserverbasicops
79 PROGRAMS += occlientbasicops
80 PROGRAMS += gen_sec_bin
82 all: c_sdk prep_dirs $(OBJECTS) $(PROGRAMS)
89 cd $(ROOT_DIR) && $(MAKE) BUILD=$(BUILD) PLATFORM=$(PLATFORM)
92 $(CC) -c $(CPPFLAGS) $< -o $@
94 ocserverbasicops: $(OBJ_DIR)/ocserverbasicops.o $(OBJ_DIR)/common.o
95 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
97 occlientbasicops: $(OBJ_DIR)/occlientbasicops.o $(OBJ_DIR)/common.o
98 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
100 gen_sec_bin: $(OBJ_DIR)/gen_sec_bin.o
101 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@
108 cd $(ROOT_DIR) && $(MAKE) clean
109 cd $(ROOT_DIR) && $(MAKE) deepclean
112 rm -f *.o $(PROGRAMS)