# Copyright (C) 2011 Red Hat, Inc. All rights reserved. # # This file is part of the thin-provisioning-tools source. # # thin-provisioning-tools is free software: you can redistribute it # and/or modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # thin-provisioning-tools is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with thin-provisioning-tools. If not, see # . GMOCK_DIR=gmock-1.6.0/ GMOCK_INCLUDES=\ -Igmock-1.6.0/include \ -Igmock-1.6.0/gtest/include GMOCK_LIBS=\ -Llib -lpdata -lgmock -lpthread GMOCK_DEPS=\ $(wildcard $(GMOCK_DIR)/include/*.h) \ $(wildcard $(GMOCK_DIR)/src/*.cc) \ $(wildcard $(GMOCK_DIR)/gtest/include/*.h) \ $(wildcard $(GMOCK_DIR)/gtest/src/*.cc) lib/libgmock.a: $(GMOCK_DEPS) @echo " [CXX] gtest" $(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/gtest -c $(GMOCK_DIR)/gtest/src/gtest-all.cc @echo " [CXX] gmock" $(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR) -c $(GMOCK_DIR)/src/gmock-all.cc @echo " [AR] $<" $(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o 2>&1 > /dev/null MOCK_SOURCE=\ unit-tests/gmock_main.cc \ \ unit-tests/array_block_t.cc \ unit-tests/array_t.cc \ unit-tests/bitset_t.cc \ unit-tests/block_t.cc \ unit-tests/btree_t.cc \ unit-tests/buffer_t.cc \ unit-tests/cache_t.cc \ unit-tests/endian_t.cc \ unit-tests/space_map_t.cc \ unit-tests/transaction_manager_t.cc MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE)) # .gmo files are plain .o files, only they've been built with gmock # include paths. .SUFFIXES: .gmo %.gmo: %.cc @echo " [CXX] $<" $(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $< unit-tests/unit_tests: $(MOCK_OBJECTS) lib/libgmock.a lib/libpdata.a @echo " [LD] $<" $(V)g++ $(CXXFLAGS) -o $@ $(MOCK_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT) .PHONEY: unit-test unit-test: unit-tests/unit_tests unit-tests/unit_tests