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 = ../../../csdk
35 OCLOGGER_DIR = $(ROOT_DIR)/logger
36 OC_LOG_DIR = $(ROOT_DIR)/../oc_logger
37 OCRANDOM_DIR = $(ROOT_DIR)/ocrandom
38 OCTBSTACK_DIR = $(ROOT_DIR)/stack
40 OC_LOG_INC = $(OC_LOG_DIR)/include
41 OC_LOG_LIB = $(OC_LOG_DIR)/lib/oc_logger.a
43 OCLOGGER_INC = $(OCLOGGER_DIR)/include
44 OCRANDOM_INC = $(OCRANDOM_DIR)/include
45 OCTBSTACK_INC = $(OCTBSTACK_DIR)/include
47 INC_DIRS := -I$(OCLOGGER_INC)
48 INC_DIRS += -I$(OC_LOG_INC)
49 INC_DIRS += -I$(OCRANDOM_INC)
50 INC_DIRS += -I$(OCTBSTACK_INC)
52 CC_FLAGS.debug := -O0 -g3 -Wall -ffunction-sections -fdata-sections \
53 -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(PLATFORM)/$(BUILD) -DTB_LOG
54 CC_FLAGS.release := -Os -Wall -fdata-sections -Wl,--gc-sections -Wl,-s \
55 -std=c99 $(INC_DIRS) -L$(ROOT_DIR)/$(PLATFORM)/$(BUILD)
57 LDLIBS += $(OC_LOG_LIB) -loctbstack -lpthread
58 CPPFLAGS += $(CC_FLAGS.$(BUILD)) $(LDLIBS)
60 SOURCES := test_logging.c
62 OBJECTS:= $(patsubst %.c, $(OBJ_DIR)/%.o, $(SOURCES))
64 PROGRAMS += test_logging
66 all: prep_dirs $(OBJECTS) $(PROGRAMS)
73 $(CC) -c $(CPPFLAGS) $< -o $@
75 test_logging: $(OBJ_DIR)/test_logging.o
76 $(CC) $^ $(CPPFLAGS) -o $(OUT_DIR)/$(BUILD)/$@