diff options
Diffstat (limited to 'googletest/make/Makefile')
-rw-r--r-- | googletest/make/Makefile | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/googletest/make/Makefile b/googletest/make/Makefile index 91eb68b..b62da67 100644 --- a/googletest/make/Makefile +++ b/googletest/make/Makefile @@ -16,6 +16,9 @@ # Remember to tweak this if you move this file. GTEST_DIR = .. +# Points to the location of the Google Test libraries +GTEST_LIB_DIR = . + # Where to find user code. USER_DIR = ../samples @@ -27,6 +30,9 @@ CPPFLAGS += -isystem $(GTEST_DIR)/include # Flags passed to the C++ compiler. CXXFLAGS += -g -Wall -Wextra -pthread -std=c++11 +# Google Test libraries +GTEST_LIBS = libgtest.a libgtest_main.a + # All tests produced by this Makefile. Remember to add new tests you # created to the list. TESTS = sample1_unittest @@ -38,10 +44,10 @@ GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \ # House-keeping build targets. -all : $(TESTS) +all : $(GTEST_LIBS) $(TESTS) clean : - rm -f $(TESTS) gtest.a gtest_main.a *.o + rm -f $(GTEST_LIBS) $(TESTS) *.o # Builds gtest.a and gtest_main.a. @@ -61,10 +67,10 @@ gtest_main.o : $(GTEST_SRCS_) $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \ $(GTEST_DIR)/src/gtest_main.cc -gtest.a : gtest-all.o +libgtest.a : gtest-all.o $(AR) $(ARFLAGS) $@ $^ -gtest_main.a : gtest-all.o gtest_main.o +libgtest_main.a : gtest-all.o gtest_main.o $(AR) $(ARFLAGS) $@ $^ # Builds a sample test. A test should link with either gtest.a or @@ -78,5 +84,5 @@ sample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \ $(USER_DIR)/sample1.h $(GTEST_HEADERS) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc -sample1_unittest : sample1.o sample1_unittest.o gtest_main.a - $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ +sample1_unittest : sample1.o sample1_unittest.o $(GTEST_LIBS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(GTEST_LIB_DIR) -lgtest_main -lpthread $^ -o $@ |