2011-12-21 11:04:00 +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/>.
|
|
|
|
|
2011-12-21 11:31:56 +01:00
|
|
|
.PHONY: all
|
2011-08-31 14:01:48 +01:00
|
|
|
|
2013-03-22 12:19:31 +00:00
|
|
|
V=@
|
2011-12-06 15:47:24 +00:00
|
|
|
PROGRAMS=\
|
2012-03-02 10:00:31 +00:00
|
|
|
thin_check \
|
2011-12-06 15:47:24 +00:00
|
|
|
thin_dump \
|
2013-05-23 13:15:00 +01:00
|
|
|
thin_restore \
|
2013-06-19 12:39:28 +01:00
|
|
|
thin_repair \
|
2013-07-15 16:48:36 +02:00
|
|
|
thin_rmap \
|
|
|
|
thin_metadata_size
|
2011-12-06 15:47:24 +00:00
|
|
|
|
|
|
|
all: $(PROGRAMS)
|
2011-08-31 14:01:48 +01:00
|
|
|
|
2013-08-16 14:07:04 +01:00
|
|
|
SOURCE=\
|
|
|
|
base/error_state.cc \
|
|
|
|
\
|
|
|
|
caching/superblock.cc \
|
|
|
|
\
|
2013-01-02 12:55:41 +00:00
|
|
|
persistent-data/checksum.cc \
|
|
|
|
persistent-data/endian_utils.cc \
|
|
|
|
persistent-data/error_set.cc \
|
|
|
|
persistent-data/hex_dump.cc \
|
2013-01-07 14:59:41 +00:00
|
|
|
persistent-data/lock_tracker.cc \
|
2013-01-11 19:26:51 +00:00
|
|
|
persistent-data/transaction_manager.cc \
|
|
|
|
\
|
2013-06-20 14:27:40 +01:00
|
|
|
persistent-data/data-structures/btree.cc \
|
|
|
|
\
|
2013-01-02 12:55:41 +00:00
|
|
|
persistent-data/space_map.cc \
|
2013-01-10 21:36:38 +00:00
|
|
|
persistent-data/space-maps/disk.cc \
|
|
|
|
persistent-data/space-maps/recursive.cc \
|
2013-08-16 14:07:04 +01:00
|
|
|
persistent-data/space-maps/careful_alloc.cc \
|
2013-03-15 16:24:17 +00:00
|
|
|
\
|
2013-05-20 16:09:13 +01:00
|
|
|
thin-provisioning/device_tree.cc \
|
2013-04-23 15:21:44 +01:00
|
|
|
thin-provisioning/file_utils.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
thin-provisioning/human_readable_format.cc \
|
2013-05-21 11:46:37 +01:00
|
|
|
thin-provisioning/mapping_tree.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
thin-provisioning/metadata.cc \
|
|
|
|
thin-provisioning/metadata_checker.cc \
|
|
|
|
thin-provisioning/metadata_dumper.cc \
|
|
|
|
thin-provisioning/restore_emitter.cc \
|
2013-05-24 13:30:17 +01:00
|
|
|
thin-provisioning/rmap_visitor.cc \
|
2013-05-21 12:46:07 +01:00
|
|
|
thin-provisioning/superblock.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
thin-provisioning/thin_pool.cc \
|
|
|
|
thin-provisioning/xml_format.cc
|
2013-04-29 13:24:19 +01:00
|
|
|
|
2013-04-11 13:41:43 +01:00
|
|
|
PDATA_OBJECTS=$(subst .cc,.o,$(SOURCE))
|
2011-08-22 10:42:13 +01:00
|
|
|
|
2013-07-16 15:33:38 +02:00
|
|
|
CXX_PROGRAM_SOURCE=\
|
2013-08-16 14:07:04 +01:00
|
|
|
caching/cache_check.cc \
|
2013-03-15 16:24:17 +00:00
|
|
|
\
|
2013-01-02 12:55:41 +00:00
|
|
|
thin-provisioning/thin_check.cc \
|
|
|
|
thin-provisioning/thin_dump.cc \
|
2013-05-23 13:15:00 +01:00
|
|
|
thin-provisioning/thin_restore.cc \
|
2013-06-19 12:39:28 +01:00
|
|
|
thin-provisioning/thin_repair.cc \
|
2013-05-23 13:15:00 +01:00
|
|
|
thin-provisioning/thin_rmap.cc
|
2011-11-03 14:44:00 +00:00
|
|
|
|
2013-07-15 16:48:36 +02:00
|
|
|
C_PROGRAM_SOURCE=\
|
|
|
|
thin-provisioning/thin_metadata_size.c
|
|
|
|
|
|
|
|
CC:=@CC@
|
2011-12-21 11:04:00 +01:00
|
|
|
CXX:=@CXX@
|
|
|
|
OBJECTS:=$(subst .cc,.o,$(SOURCE))
|
2011-12-09 12:54:51 +00:00
|
|
|
TOP_DIR:=@top_srcdir@
|
2011-12-21 11:04:00 +01:00
|
|
|
TOP_BUILDDIR:=@top_builddir@
|
2013-07-15 16:48:36 +02:00
|
|
|
CFLAGS+=-g -Wall -O3
|
2013-08-08 10:49:59 +01:00
|
|
|
CXXFLAGS+=-g -Wall -fno-strict-aliasing
|
2011-12-09 12:54:51 +00:00
|
|
|
CXXFLAGS+=@CXXOPTIMISE_FLAG@
|
|
|
|
CXXFLAGS+=@CXXDEBUG_FLAG@
|
2013-01-02 12:55:41 +00:00
|
|
|
INCLUDES+=-I$(TOP_BUILDDIR) -I$(TOP_DIR) -I$(TOP_DIR)/thin-provisioning
|
2011-12-21 11:04:00 +01:00
|
|
|
LIBS:=-lstdc++
|
|
|
|
LIBEXPAT:=-lexpat
|
|
|
|
INSTALL:=@INSTALL@
|
2012-03-15 13:05:37 +01:00
|
|
|
PREFIX:=@prefix@
|
|
|
|
BINDIR:=$(DESTDIR)$(PREFIX)/sbin
|
2011-12-21 11:04:00 +01:00
|
|
|
MANPATH:=$(DESTDIR)$(MANDIR)
|
|
|
|
|
|
|
|
vpath %.cc $(TOP_DIR)
|
|
|
|
|
|
|
|
INSTALL_DIR = $(INSTALL) -m 755 -d
|
2013-07-10 17:16:56 +02:00
|
|
|
INSTALL_PROGRAM = $(INSTALL) -m 755
|
2011-12-21 11:04:00 +01:00
|
|
|
INSTALL_DATA = $(INSTALL) -p -m 644
|
2011-06-16 08:16:10 +01:00
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
ifeq ("@TESTING@", "yes")
|
|
|
|
TEST_INCLUDES=\
|
|
|
|
-Igmock-1.6.0/include \
|
|
|
|
-Igmock-1.6.0/gtest/include
|
|
|
|
else
|
|
|
|
TEST_INCLUDES=
|
|
|
|
endif
|
2011-07-22 16:09:56 +01:00
|
|
|
|
2011-12-21 11:04:00 +01:00
|
|
|
.SUFFIXES: .d
|
2011-06-16 08:16:10 +01:00
|
|
|
|
2013-07-15 16:48:36 +02:00
|
|
|
%.o: %.c
|
|
|
|
@echo " [CC] $<"
|
|
|
|
$(V) $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
|
|
|
|
@echo " [DEP] $<"
|
|
|
|
$(V) $(CC) -MM -MT $(subst .c,.o,$<) $(INCLUDES) $(CFLAGS) $< > $*.$$$$; \
|
|
|
|
sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \
|
|
|
|
$(RM) $*.$$$$
|
|
|
|
|
2011-12-21 11:04:00 +01:00
|
|
|
%.o: %.cc
|
2013-03-22 15:41:13 +00:00
|
|
|
@echo " [CXX] $<"
|
2013-03-22 12:19:31 +00:00
|
|
|
$(V) $(CXX) -c $(INCLUDES) $(CXXFLAGS) -o $@ $<
|
2013-06-27 10:17:38 +01:00
|
|
|
@echo " [DEP] $<"
|
|
|
|
$(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(TEST_INCLUDES) $(CXXFLAGS) $< > $*.$$$$; \
|
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) $*.$$$$
|
2011-06-16 08:16:10 +01:00
|
|
|
|
2013-03-22 13:42:20 +00:00
|
|
|
#----------------------------------------------------------------
|
2013-05-24 13:43:55 +01:00
|
|
|
|
2013-03-22 13:42:20 +00:00
|
|
|
lib/libpdata.a: $(PDATA_OBJECTS)
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [AR] $<"
|
|
|
|
$(V)ar -rv $@ $(PDATA_OBJECTS) > /dev/null 2>&1
|
2013-03-22 13:42:20 +00:00
|
|
|
|
2013-03-15 16:24:17 +00:00
|
|
|
#----------------------------------------------------------------
|
|
|
|
# Thin provisioning tools
|
2013-01-02 12:55:41 +00:00
|
|
|
|
2012-03-08 17:20:46 +00:00
|
|
|
THIN_DEBUG_SOURCE=$(SOURCE)
|
2011-12-15 13:53:07 +00:00
|
|
|
THIN_DUMP_SOURCE=$(SOURCE)
|
2013-06-19 12:39:28 +01:00
|
|
|
THIN_REPAIR_SOURCE=$(SOURCE)
|
2011-12-15 13:53:07 +00:00
|
|
|
THIN_RESTORE_SOURCE=$(SOURCE)
|
2012-03-02 10:00:31 +00:00
|
|
|
THIN_CHECK_SOURCE=\
|
2013-08-16 14:07:04 +01:00
|
|
|
base/error_state.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
persistent-data/checksum.cc \
|
|
|
|
persistent-data/endian_utils.cc \
|
|
|
|
persistent-data/error_set.cc \
|
|
|
|
persistent-data/hex_dump.cc \
|
2013-01-07 14:59:41 +00:00
|
|
|
persistent-data/lock_tracker.cc \
|
2013-06-20 14:46:46 +01:00
|
|
|
persistent-data/data-structures/btree.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
persistent-data/space_map.cc \
|
2013-01-11 19:26:51 +00:00
|
|
|
persistent-data/space-maps/disk.cc \
|
|
|
|
persistent-data/space-maps/recursive.cc \
|
|
|
|
persistent-data/space-maps/careful_alloc.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
persistent-data/transaction_manager.cc \
|
2013-04-23 15:21:44 +01:00
|
|
|
thin-provisioning/file_utils.cc \
|
2013-05-21 15:49:20 +01:00
|
|
|
thin-provisioning/device_tree.cc \
|
2013-05-22 14:55:28 +01:00
|
|
|
thin-provisioning/mapping_tree.cc \
|
2013-01-02 12:55:41 +00:00
|
|
|
thin-provisioning/metadata.cc \
|
|
|
|
thin-provisioning/metadata_checker.cc \
|
2013-05-21 13:20:03 +01:00
|
|
|
thin-provisioning/superblock.cc
|
2013-01-02 12:55:41 +00:00
|
|
|
|
2013-05-23 13:15:00 +01:00
|
|
|
THIN_RMAP_SOURCE=\
|
|
|
|
persistent-data/checksum.cc \
|
|
|
|
persistent-data/endian_utils.cc \
|
|
|
|
persistent-data/error_set.cc \
|
|
|
|
persistent-data/hex_dump.cc \
|
|
|
|
persistent-data/lock_tracker.cc \
|
2013-06-20 14:46:46 +01:00
|
|
|
persistent-data/data-structures/btree.cc \
|
2013-05-23 13:15:00 +01:00
|
|
|
persistent-data/space_map.cc \
|
|
|
|
persistent-data/space-maps/disk.cc \
|
|
|
|
persistent-data/space-maps/recursive.cc \
|
|
|
|
persistent-data/space-maps/careful_alloc.cc \
|
|
|
|
persistent-data/transaction_manager.cc \
|
|
|
|
thin-provisioning/file_utils.cc \
|
|
|
|
thin-provisioning/device_tree.cc \
|
|
|
|
thin-provisioning/mapping_tree.cc \
|
|
|
|
thin-provisioning/metadata.cc \
|
|
|
|
thin-provisioning/metadata_checker.cc \
|
2013-05-24 13:43:55 +01:00
|
|
|
thin-provisioning/rmap_visitor.cc \
|
2013-05-23 13:15:00 +01:00
|
|
|
thin-provisioning/superblock.cc
|
|
|
|
|
2012-03-08 17:20:46 +00:00
|
|
|
THIN_DEBUG_OBJECTS=$(subst .cc,.o,$(THIN_DEBUG_SOURCE))
|
2011-12-15 13:53:07 +00:00
|
|
|
THIN_DUMP_OBJECTS=$(subst .cc,.o,$(THIN_DUMP_SOURCE))
|
2013-06-19 12:39:28 +01:00
|
|
|
THIN_REPAIR_OBJECTS=$(subst .cc,.o,$(THIN_REPAIR_SOURCE))
|
2011-12-15 13:53:07 +00:00
|
|
|
THIN_RESTORE_OBJECTS=$(subst .cc,.o,$(THIN_RESTORE_SOURCE))
|
2012-03-02 10:00:31 +00:00
|
|
|
THIN_CHECK_OBJECTS=$(subst .cc,.o,$(THIN_CHECK_SOURCE))
|
2013-05-23 13:15:00 +01:00
|
|
|
THIN_RMAP_OBJECTS=$(subst .cc,.o,$(THIN_RMAP_SOURCE))
|
2011-12-15 13:53:07 +00:00
|
|
|
|
2013-01-02 12:55:41 +00:00
|
|
|
thin_debug: $(THIN_DEBUG_OBJECTS) thin-provisioning/thin_debug.o
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
|
2012-03-08 17:20:46 +00:00
|
|
|
|
2013-06-19 12:39:28 +01:00
|
|
|
thin_repair: $(THIN_REPAIR_OBJECTS) thin-provisioning/thin_repair.o
|
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
|
2013-06-19 12:39:28 +01:00
|
|
|
|
2013-01-02 12:55:41 +00:00
|
|
|
thin_dump: $(THIN_DUMP_OBJECTS) thin-provisioning/thin_dump.o
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
|
2011-12-15 13:53:07 +00:00
|
|
|
|
2013-01-02 12:55:41 +00:00
|
|
|
thin_restore: $(THIN_RESTORE_OBJECTS) thin-provisioning/thin_restore.o
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
|
2011-08-31 14:01:48 +01:00
|
|
|
|
2013-06-19 11:32:16 +01:00
|
|
|
thin_check: $(THIN_CHECK_OBJECTS) thin-provisioning/thin_check.o
|
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
|
2013-06-19 11:32:16 +01:00
|
|
|
|
2013-05-23 13:15:00 +01:00
|
|
|
thin_rmap: $(THIN_RMAP_OBJECTS) thin-provisioning/thin_rmap.o
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
|
2011-08-23 11:55:37 +01:00
|
|
|
|
2013-07-15 16:48:36 +02:00
|
|
|
thin_metadata_size: thin-provisioning/thin_metadata_size.o
|
|
|
|
@echo " [LD] $@"
|
|
|
|
$(V) $(CC) $(CFLAGS) -o $@ $+ -lm
|
|
|
|
|
2013-03-15 16:24:17 +00:00
|
|
|
#----------------------------------------------------------------
|
|
|
|
# Cache tools
|
|
|
|
|
|
|
|
CACHE_CHECK_SOURCE=\
|
|
|
|
persistent-data/checksum.cc \
|
|
|
|
persistent-data/endian_utils.cc \
|
|
|
|
persistent-data/error_set.cc \
|
|
|
|
persistent-data/hex_dump.cc \
|
|
|
|
persistent-data/lock_tracker.cc \
|
2013-06-20 14:46:46 +01:00
|
|
|
persistent-data/data-structures/btree.cc \
|
2013-03-15 16:24:17 +00:00
|
|
|
persistent-data/space_map.cc \
|
|
|
|
persistent-data/space-maps/disk.cc \
|
|
|
|
persistent-data/space-maps/recursive.cc \
|
|
|
|
persistent-data/space-maps/careful_alloc.cc \
|
|
|
|
persistent-data/transaction_manager.cc \
|
2013-08-16 13:39:12 +01:00
|
|
|
caching/superblock.cc
|
2013-03-15 16:24:17 +00:00
|
|
|
|
|
|
|
CACHE_CHECK_OBJECTS=$(subst .cc,.o,$(CACHE_CHECK_SOURCE))
|
|
|
|
|
2013-08-16 13:39:12 +01:00
|
|
|
cache_check: $(CACHE_CHECK_OBJECTS) caching/check.o
|
2013-03-22 15:48:43 +00:00
|
|
|
@echo " [LD] $@"
|
2013-07-14 21:10:28 +00:00
|
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
|
2013-03-22 13:42:20 +00:00
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
DEPEND_FILES=\
|
|
|
|
$(subst .cc,.d,$(SOURCE)) \
|
|
|
|
$(subst .cc,.d,$(TEST_SOURCE)) \
|
2013-07-16 15:33:38 +02:00
|
|
|
$(subst .cc,.d,$(CXX_PROGRAM_SOURCE)) \
|
2013-07-15 16:48:36 +02:00
|
|
|
$(subst .c,.d,$(C_PROGRAM_SOURCE))
|
2013-03-25 12:56:03 +00:00
|
|
|
|
2013-03-22 13:42:20 +00:00
|
|
|
.PHONY: clean distclean
|
2013-01-02 12:55:41 +00:00
|
|
|
|
2011-12-06 15:47:24 +00:00
|
|
|
clean:
|
2013-06-19 13:10:12 +01:00
|
|
|
find . -name \*.o -delete
|
|
|
|
find . -name \*.gmo -delete
|
2013-07-15 16:48:36 +02:00
|
|
|
find . -name \*.d -delete
|
|
|
|
$(RM) $(TEST_PROGRAMS) $(PROGRAMS) $(GMOCK_OBJECTS) lib/*.a
|
2013-03-22 13:42:20 +00:00
|
|
|
|
2011-12-21 11:04:00 +01:00
|
|
|
distclean: clean
|
2011-12-21 11:08:37 +01:00
|
|
|
$(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile
|
2011-12-06 15:47:24 +00:00
|
|
|
|
2011-12-09 12:54:51 +00:00
|
|
|
install: $(PROGRAMS)
|
2011-12-21 11:04:00 +01:00
|
|
|
$(INSTALL_DIR) $(BINDIR)
|
2013-07-19 13:28:38 +02:00
|
|
|
$(INSTALL_PROGRAM) thin_check $(BINDIR)
|
|
|
|
$(INSTALL_PROGRAM) thin_dump $(BINDIR)
|
|
|
|
$(INSTALL_PROGRAM) thin_repair $(BINDIR)
|
|
|
|
$(INSTALL_PROGRAM) thin_restore $(BINDIR)
|
|
|
|
$(INSTALL_PROGRAM) thin_rmap $(BINDIR)
|
|
|
|
$(INSTALL_PROGRAM) thin_metadata_size $(BINDIR)
|
2011-12-21 11:04:00 +01:00
|
|
|
$(INSTALL_DIR) $(MANPATH)/man8
|
2013-07-10 17:16:56 +02:00
|
|
|
$(INSTALL_DATA) man8/thin_check.8 $(MANPATH)/man8
|
|
|
|
$(INSTALL_DATA) man8/thin_dump.8 $(MANPATH)/man8
|
2013-07-18 15:54:15 +02:00
|
|
|
$(INSTALL_DATA) man8/thin_repair.8 $(MANPATH)/man8
|
2013-07-10 17:16:56 +02:00
|
|
|
$(INSTALL_DATA) man8/thin_restore.8 $(MANPATH)/man8
|
2013-07-18 15:54:15 +02:00
|
|
|
$(INSTALL_DATA) man8/thin_rmap.8 $(MANPATH)/man8
|
|
|
|
$(INSTALL_DATA) man8/thin_metadata_size.8 $(MANPATH)/man8
|
2013-07-18 14:19:06 +02:00
|
|
|
|
2011-12-21 11:31:56 +01:00
|
|
|
.PHONY: install
|
2011-12-21 11:04:00 +01:00
|
|
|
|
|
|
|
ifeq ("@TESTING@", "yes")
|
2011-12-21 11:08:37 +01:00
|
|
|
include unit-tests/Makefile
|
2013-01-15 05:29:40 +00:00
|
|
|
|
2013-03-25 11:53:55 +00:00
|
|
|
.PHONEY: features
|
|
|
|
|
|
|
|
features: thin_check cache_check
|
|
|
|
cucumber --no-color --format progress
|
|
|
|
|
2013-03-25 12:56:03 +00:00
|
|
|
test: features unit-test
|
|
|
|
endif
|
|
|
|
|
|
|
|
-include $(DEPEND_FILES)
|
|
|
|
|