| 1 |
# SYNOPSIS: |
| 2 |
# |
| 3 |
# make [all] - makes everything. |
| 4 |
# make TARGET - makes the given target. |
| 5 |
# make clean - removes all files generated by make. |
| 6 |
|
| 7 |
# Points to the root of Google Test, relative to where this file is. |
| 8 |
# Remember to tweak this if you move this file. |
| 9 |
GTEST_DIR = gtest-1.4.0 |
| 10 |
|
| 11 |
# Where to find user code. |
| 12 |
UPDIR = $(realpath ..) |
| 13 |
USER_DIR = $(UPDIR) |
| 14 |
|
| 15 |
VPATH = $(USER_DIR) |
| 16 |
|
| 17 |
CC = g++ |
| 18 |
# Flags passed to the preprocessor. |
| 19 |
CPPFLAGS += -I. -I$(GTEST_DIR) -I$(GTEST_DIR)/include $(patsubst %,-I%,$(USER_DIR)) -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -DHAVE_SSE |
| 20 |
|
| 21 |
# Flags passed to the C++ compiler. |
| 22 |
# For profiling -fprofile-arcs -ftest-coverage -O0 |
| 23 |
# TODO: remove lax-vector-conversions |
| 24 |
CXXFLAGS += -g -Wall -Wextra -Werror -DSSE -march=native -msse -msse2 -O3 |
| 25 |
|
| 26 |
LDFLAGS = -lpthread -lrt -lm |
| 27 |
|
| 28 |
# All tests produced by this Makefile. Remember to add new tests you |
| 29 |
# created to the list. |
| 30 |
#TESTS = test_large_block test_mutex test_cond test_packed_key_value_array test_square_binary_matrix test_misc test_offsets_key_value |
| 31 |
TESTS = test_offsets_key_value |
| 32 |
SOURCES = $(patsubst %,%.cc,$(TESTS)) |
| 33 |
|
| 34 |
# All Google Test headers. Usually you shouldn't change this |
| 35 |
# definition. |
| 36 |
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ |
| 37 |
$(GTEST_DIR)/include/gtest/internal/*.h |
| 38 |
|
| 39 |
# House-keeping build targets. |
| 40 |
|
| 41 |
%.d: %.cc |
| 42 |
$(CC) -M -MM -MG -MP $(CPPFLAGS) $< > [email protected] |
| 43 |
sed -e 's/$*.o/& $@/g' [email protected] > $@ && rm [email protected] |
| 44 |
|
| 45 |
all : $(TESTS) |
| 46 |
|
| 47 |
run: all |
| 48 |
@for i in $(TESTS); do ./$$i; done |
| 49 |
|
| 50 |
clean : |
| 51 |
rm -f $(TESTS) gtest.a gtest_main.a *.o |
| 52 |
|
| 53 |
$(TESTS): gtest_main.a |
| 54 |
|
| 55 |
# Some extra dependencies |
| 56 |
test_packed_key_value_array: storage.o |
| 57 |
|
| 58 |
test_square_binary_matrix: square_binary_matrix.o |
| 59 |
|
| 60 |
# Builds gtest.a and gtest_main.a. |
| 61 |
|
| 62 |
# Usually you shouldn't tweak such internal variables, indicated by a |
| 63 |
# trailing _. |
| 64 |
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) |
| 65 |
|
| 66 |
# For simplicity and to avoid depending on Google Test's |
| 67 |
# implementation details, the dependencies specified below are |
| 68 |
# conservative and not optimized. This is fine as Google Test |
| 69 |
# compiles fast and for ordinary users its source rarely changes. |
| 70 |
gtest-all.o : $(GTEST_SRCS_) |
| 71 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest-all.cc |
| 72 |
|
| 73 |
gtest_main.o : $(GTEST_SRCS_) |
| 74 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_DIR)/src/gtest_main.cc |
| 75 |
|
| 76 |
gtest.a : gtest-all.o |
| 77 |
$(AR) $(ARFLAGS) $@ $^ |
| 78 |
|
| 79 |
gtest_main.a : gtest-all.o gtest_main.o |
| 80 |
$(AR) $(ARFLAGS) $@ $^ |
| 81 |
|
| 82 |
include $(SOURCES:.cc=.d) |