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=release`
22 # default to release build
28 # You must create the file "local.properties" on your local machine which contains any local paths, etc
29 # local_settings.mk should NOT be committed to repo
30 include $(ROOT_DIR)/local.properties
31 # GTEST_DIR contains the path to Google Test libs and must be defined in local.properties
33 # GTEST_DIR := /home/johndoe/utils/gtest-1.7.0
35 # NOTE: to run app, make sure that LD_LIBRARY_PATH env variable
36 # contains $(GTEST_DIR)/lib/.libs
47 CC_FLAGS.debug := -O0 -g3 -Wall -c -fmessage-length=0 -pedantic -std=c99 -fpic -DTB_LOG
48 CC_FLAGS.release := -Os -Wall -c -fmessage-length=0 -std=c99 -fpic
49 CC_FLAGS := $(CC_FLAGS.$(BUILD))
51 CXX_FLAGS.debug := -O0 -g3 -Wall -c -fmessage-length=0 -pedantic -std=c++0x -fpic -DTB_LOG
52 CXX_FLAGS.release := -Os -Wall -c -fmessage-length=0 -std=c++0x -fpic
53 CXX_FLAGS := $(CXX_FLAGS.$(BUILD))
58 INC += -I$(GTEST_DIR)/include
61 # using make's computed variables to select object and bin folders
62 # depending on the build type
63 OBJ_DIR.debug := ./obj/debug
64 OBJ_DIR.release := ./obj/release
65 OBJ_DIR := $(OBJ_DIR.$(BUILD))
67 BIN_DIR.debug := ./bin/debug
68 BIN_DIR.release := ./bin/release
69 BIN_DIR := $(BIN_DIR.$(BUILD))
71 C_FILES := $(wildcard $(SRC_DIR)/*.c)
72 #CPP_FILES := $(wildcard $(SRC_DIR)/*.cpp)
73 CPP_FILES := $(wildcard $(TEST_DIR)/*.cpp)
74 OBJ_FILES := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o) $(C_FILES:.c=.o)))
75 H_FILES := $(wildcard $(TEST_DIR)/*.h)
76 H_FILES += $(wildcard $(INC_DIR)/*.h)
77 LD_FLAGS := -L/usr/lib
78 LD_FLAGS += -L$(GTEST_DIR)/lib/.libs
89 $(CXX) -o $@ $^ $(LD_FLAGS) $(LIBS)
90 mv ./$(PROG) ./$(BIN_DIR)
92 #$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/%.h $(H_FILES)
93 # $(CC) $(CC_FLAGS) $(INC) -c -o $@ $<
95 $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(INC_DIR)/%.h $(H_FILES)
96 $(CC) $(CC_FLAGS) $(INC) -c -o $@ $<
98 $(OBJ_DIR)/%.o: $(TEST_DIR)/%.cpp $(H_FILES)
99 $(CXX) $(CXX_FLAGS) $(INC) -c -o $@ $<
105 rm -rf ./obj/release/*
107 rm -rf ./lib/release/*
109 rm -rf ./bin/release/*
110 rm -rf ./test/tst_*.txt
117 @echo 'BUILD = '$(value BUILD)
118 @echo 'INC = '$(value INC)
119 @echo 'CPP_FILES = '$(value CPP_FILES)
120 @echo 'LIBS = '$(value LIBS)