| 1 |
# Points to the root of Google Test, relative to where this file is. |
| 2 |
# Remember to tweak this if you move this file. |
| 3 |
GTEST_DIR = . |
| 4 |
|
| 5 |
# Points to the location of the Google Test libraries |
| 6 |
GTEST_LIB_DIR = . |
| 7 |
|
| 8 |
# Flags passed to the preprocessor. |
| 9 |
# Set Google Test's header directory as a system directory, such that |
| 10 |
# the compiler doesn't generate warnings in Google Test headers. |
| 11 |
CPPFLAGS += -isystem $(GTEST_DIR)/include |
| 12 |
|
| 13 |
# Flags passed to the C++ compiler. |
| 14 |
CXXFLAGS += -g -Wall -Wextra -pthread -std=c++11 |
| 15 |
|
| 16 |
# Google Test libraries |
| 17 |
GTEST_LIBS = libgtest.a libgtest_main.a |
| 18 |
|
| 19 |
# All Google Test headers. Usually you shouldn't change this |
| 20 |
# definition. |
| 21 |
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ |
| 22 |
$(GTEST_DIR)/include/gtest/internal/*.h |
| 23 |
|
| 24 |
# House-keeping build targets. |
| 25 |
|
| 26 |
all : $(GTEST_LIBS) |
| 27 |
|
| 28 |
clean : |
| 29 |
rm -f *.o |
| 30 |
|
| 31 |
tidy : clean |
| 32 |
rm -f $(GTEST_LIBS) |
| 33 |
|
| 34 |
# Builds gtest.a and gtest_main.a. |
| 35 |
|
| 36 |
# Usually you shouldn't tweak such internal variables, indicated by a |
| 37 |
# trailing _. |
| 38 |
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) |
| 39 |
|
| 40 |
# For simplicity and to avoid depending on Google Test's |
| 41 |
# implementation details, the dependencies specified below are |
| 42 |
# conservative and not optimized. This is fine as Google Test |
| 43 |
# compiles fast and for ordinary users its source rarely changes. |
| 44 |
gtest-all.o : $(GTEST_SRCS_) |
| 45 |
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ |
| 46 |
$(GTEST_DIR)/src/gtest-all.cc |
| 47 |
|
| 48 |
gtest_main.o : $(GTEST_SRCS_) |
| 49 |
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ |
| 50 |
$(GTEST_DIR)/src/gtest_main.cc |
| 51 |
|
| 52 |
libgtest.a : gtest-all.o |
| 53 |
$(AR) $(ARFLAGS) $@ $^ |
| 54 |
|
| 55 |
libgtest_main.a : gtest-all.o gtest_main.o |
| 56 |
$(AR) $(ARFLAGS) $@ $^ |