2011-12-21 12:30:50 +01:00
|
|
|
# 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
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-06-07 11:12:27 +01:00
|
|
|
GMOCK_DIR=googletest
|
2013-03-22 10:55:55 +00:00
|
|
|
GMOCK_INCLUDES=\
|
2016-06-07 11:12:27 +01:00
|
|
|
-I$(GMOCK_DIR)/googlemock/include \
|
|
|
|
-I$(GMOCK_DIR)/googletest/include
|
2013-03-22 10:55:55 +00:00
|
|
|
|
2013-06-25 14:18:38 +01:00
|
|
|
GMOCK_FLAGS=\
|
|
|
|
-Wno-unused-local-typedefs
|
|
|
|
|
2013-03-22 10:55:55 +00:00
|
|
|
GMOCK_LIBS=\
|
2014-07-29 11:34:26 +01:00
|
|
|
-Llib -lpdata -lgmock -lpthread -laio
|
2013-03-22 10:55:55 +00:00
|
|
|
|
2013-03-22 12:10:51 +00:00
|
|
|
GMOCK_DEPS=\
|
2016-06-07 11:12:27 +01:00
|
|
|
$(wildcard $(GMOCK_DIR)/googlemock/include/*.h) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googlemock/src/*.cc) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googletest/include/*.h) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googletest/src/*.cc)
|
2013-03-22 12:10:51 +00:00
|
|
|
|
|
|
|
lib/libgmock.a: $(GMOCK_DEPS)
|
2013-03-22 15:41:13 +00:00
|
|
|
@echo " [CXX] gtest"
|
2018-06-13 09:33:25 +01:00
|
|
|
@mkdir -p lib
|
2020-07-25 15:04:18 -07:00
|
|
|
$(V) $(CXX) $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/googletest -std=c++11 -c $(GMOCK_DIR)/googletest/src/gtest-all.cc
|
2013-03-22 15:41:13 +00:00
|
|
|
@echo " [CXX] gmock"
|
2020-07-25 15:04:18 -07:00
|
|
|
$(V) $(CXX) $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/googlemock -std=c++11 -c $(GMOCK_DIR)/googlemock/src/gmock-all.cc
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [AR] $<"
|
2020-07-29 00:20:36 +08:00
|
|
|
$(V) $(AR) -rv lib/libgmock.a gtest-all.o gmock-all.o > /dev/null 2>&1
|
2013-03-22 10:55:55 +00:00
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
TEST_SOURCE=\
|
2013-03-22 12:04:38 +00:00
|
|
|
unit-tests/gmock_main.cc \
|
2013-04-26 15:55:45 +01:00
|
|
|
unit-tests/test_utils.cc \
|
2013-03-22 12:04:38 +00:00
|
|
|
\
|
2013-03-22 14:13:58 +00:00
|
|
|
unit-tests/array_block_t.cc \
|
2013-03-22 13:42:20 +00:00
|
|
|
unit-tests/array_t.cc \
|
2013-10-10 10:18:46 +01:00
|
|
|
unit-tests/base64_t.cc \
|
2017-07-24 15:32:26 +01:00
|
|
|
unit-tests/bcache_t.cc \
|
2013-03-22 14:43:15 +00:00
|
|
|
unit-tests/block_t.cc \
|
2014-07-29 11:34:26 +01:00
|
|
|
unit-tests/bitset_t.cc \
|
2013-03-22 14:57:46 +00:00
|
|
|
unit-tests/btree_t.cc \
|
2013-12-11 17:00:57 +00:00
|
|
|
unit-tests/btree_counter_t.cc \
|
2013-05-08 12:00:24 +01:00
|
|
|
unit-tests/btree_damage_visitor_t.cc \
|
2013-10-07 15:21:45 +01:00
|
|
|
unit-tests/cache_superblock_t.cc \
|
2016-05-07 11:47:40 +01:00
|
|
|
unit-tests/copier_t.cc \
|
2013-05-13 12:36:57 +01:00
|
|
|
unit-tests/damage_tracker_t.cc \
|
2013-03-22 15:08:52 +00:00
|
|
|
unit-tests/endian_t.cc \
|
2015-04-08 13:58:41 +01:00
|
|
|
unit-tests/error_state_t.cc \
|
2016-06-07 11:12:27 +01:00
|
|
|
unit-tests/io_engine_t.cc \
|
2016-05-07 11:47:40 +01:00
|
|
|
unit-tests/mem_pool_t.cc \
|
2013-05-24 13:30:17 +01:00
|
|
|
unit-tests/rmap_visitor_t.cc \
|
2015-09-03 13:02:29 +01:00
|
|
|
unit-tests/rolling_hash_t.cc \
|
2013-07-08 21:44:09 +01:00
|
|
|
unit-tests/run_set_t.cc \
|
2020-07-27 12:06:51 +08:00
|
|
|
unit-tests/sequence_generator_t.cc \
|
2013-03-22 15:19:40 +00:00
|
|
|
unit-tests/space_map_t.cc \
|
2013-04-22 13:50:40 +01:00
|
|
|
unit-tests/span_iterator_t.cc \
|
2013-03-22 15:19:40 +00:00
|
|
|
unit-tests/transaction_manager_t.cc
|
2013-03-22 12:04:38 +00:00
|
|
|
|
2013-05-23 14:43:53 +01:00
|
|
|
# unit-tests/thin_metadata_t.cc \
|
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
TEST_OBJECTS=$(subst .cc,.gmo,$(TEST_SOURCE))
|
2013-03-22 15:41:13 +00:00
|
|
|
|
2013-03-22 12:04:38 +00:00
|
|
|
# .gmo files are plain .o files, only they've been built with gmock
|
|
|
|
# include paths.
|
|
|
|
.SUFFIXES: .gmo
|
|
|
|
|
|
|
|
%.gmo: %.cc
|
2013-03-22 12:19:31 +00:00
|
|
|
@echo " [CXX] $<"
|
2018-06-13 09:33:25 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2021-06-02 18:03:50 +08:00
|
|
|
$(V) $(CXX) -c $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) -o $@ $<
|
2013-06-27 10:17:38 +01:00
|
|
|
@echo " [DEP] $<"
|
2021-06-02 18:03:50 +08:00
|
|
|
$(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) $< > $*.$$$$; \
|
2013-06-27 12:42:52 +01:00
|
|
|
sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \
|
2013-06-27 10:17:38 +01:00
|
|
|
$(RM) $*.$$$$
|
2013-03-22 12:04:38 +00:00
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
unit-tests/unit_tests: $(TEST_OBJECTS) lib/libgmock.a lib/libpdata.a
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $<"
|
2018-06-13 09:33:25 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2020-07-29 00:20:36 +08:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(TEST_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
|
2013-03-22 15:41:13 +00:00
|
|
|
|
2016-05-08 23:35:19 -04:00
|
|
|
.PHONY: unit-test
|
2013-03-22 10:55:55 +00:00
|
|
|
|
2013-03-22 15:41:13 +00:00
|
|
|
unit-test: unit-tests/unit_tests
|
2013-06-25 14:18:38 +01:00
|
|
|
unit-tests/unit_tests
|