3e24cff8a1
The common preprocessor variable is named CPPFLAGS. configure sets this up for us, including sourcing values from the user. Rename INCLUDES to match, and pull the default from configure.
246 lines
7.0 KiB
Makefile
246 lines
7.0 KiB
Makefile
# 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/>.
|
|
|
|
V=@
|
|
|
|
PROGRAMS=\
|
|
bin/pdata_tools
|
|
|
|
.PHONY: all
|
|
all: $(PROGRAMS)
|
|
|
|
SOURCE=\
|
|
base/application.cc \
|
|
base/base64.cc \
|
|
base/disk_units.cc \
|
|
base/endian_utils.cc \
|
|
base/error_state.cc \
|
|
base/error_string.cc \
|
|
base/grid_layout.cc \
|
|
base/progress_monitor.cc \
|
|
base/xml_utils.cc \
|
|
block-cache/block_cache.cc \
|
|
caching/cache_check.cc \
|
|
caching/cache_dump.cc \
|
|
caching/cache_metadata_size.cc \
|
|
caching/cache_repair.cc \
|
|
caching/cache_restore.cc \
|
|
caching/commands.cc \
|
|
caching/hint_array.cc \
|
|
caching/mapping_array.cc \
|
|
caching/metadata.cc \
|
|
caching/metadata_dump.cc \
|
|
caching/restore_emitter.cc \
|
|
caching/superblock.cc \
|
|
caching/xml_format.cc \
|
|
era/commands.cc \
|
|
era/era_array.cc \
|
|
era/era_check.cc \
|
|
era/era_detail.cc \
|
|
era/era_dump.cc \
|
|
era/era_invalidate.cc \
|
|
era/era_restore.cc \
|
|
era/metadata.cc \
|
|
era/metadata_dump.cc \
|
|
era/restore_emitter.cc \
|
|
era/superblock.cc \
|
|
era/writeset_tree.cc \
|
|
era/xml_format.cc \
|
|
main.cc \
|
|
persistent-data/checksum.cc \
|
|
persistent-data/data-structures/bitset.cc \
|
|
persistent-data/data-structures/bloom_filter.cc \
|
|
persistent-data/data-structures/btree.cc \
|
|
persistent-data/error_set.cc \
|
|
persistent-data/file_utils.cc \
|
|
persistent-data/hex_dump.cc \
|
|
persistent-data/space-maps/careful_alloc.cc \
|
|
persistent-data/space-maps/disk.cc \
|
|
persistent-data/space-maps/recursive.cc \
|
|
persistent-data/space_map.cc \
|
|
persistent-data/transaction_manager.cc \
|
|
persistent-data/validators.cc \
|
|
thin-provisioning/commands.cc \
|
|
thin-provisioning/device_tree.cc \
|
|
thin-provisioning/human_readable_format.cc \
|
|
thin-provisioning/mapping_tree.cc \
|
|
thin-provisioning/metadata.cc \
|
|
thin-provisioning/metadata_checker.cc \
|
|
thin-provisioning/metadata_dumper.cc \
|
|
thin-provisioning/restore_emitter.cc \
|
|
thin-provisioning/rmap_visitor.cc \
|
|
thin-provisioning/superblock.cc \
|
|
thin-provisioning/thin_check.cc \
|
|
thin-provisioning/thin_delta.cc \
|
|
thin-provisioning/thin_dump.cc \
|
|
thin-provisioning/thin_ls.cc \
|
|
thin-provisioning/thin_metadata_size.cc \
|
|
thin-provisioning/thin_pool.cc \
|
|
thin-provisioning/thin_repair.cc \
|
|
thin-provisioning/thin_restore.cc \
|
|
thin-provisioning/thin_rmap.cc \
|
|
thin-provisioning/thin_trim.cc \
|
|
thin-provisioning/xml_format.cc
|
|
|
|
CC:=@CC@
|
|
CXX:=@CXX@
|
|
STRIP:=@STRIP@
|
|
OBJECTS:=$(subst .cc,.o,$(SOURCE))
|
|
TOP_DIR:=@top_srcdir@
|
|
TOP_BUILDDIR:=@top_builddir@
|
|
CFLAGS?=@CFLAGS@
|
|
CFLAGS+=-Wall
|
|
CFLAGS+=@LFS_FLAGS@
|
|
CXXFLAGS?=@CXXFLAGS@
|
|
CXXFLAGS+=-Wall -fno-strict-aliasing -std=gnu++98
|
|
CXXFLAGS+=@CXXOPTIMISE_FLAG@
|
|
CXXFLAGS+=@CXXDEBUG_FLAG@
|
|
CXXFLAGS+=@CXX_STRERROR_FLAG@
|
|
CXXFLAGS+=@LFS_FLAGS@
|
|
CPPFLAGS?=@CPPFLAGS@
|
|
CPPFLAGS+=-I$(TOP_BUILDDIR) -I$(TOP_DIR) -I$(TOP_DIR)/thin-provisioning
|
|
LIBS:=-laio -lexpat
|
|
|
|
ifeq ("@STATIC_CXX@", "yes")
|
|
CXXLIB+=-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -Wl,--as-needed
|
|
else
|
|
CXXLIB+=-lstdc++
|
|
endif
|
|
|
|
ifeq ("@STATIC@", "yes")
|
|
LDFLAGS+=-static
|
|
endif
|
|
|
|
INSTALL:=@INSTALL@
|
|
PREFIX:=@prefix@
|
|
BINDIR:=$(DESTDIR)$(PREFIX)/sbin
|
|
DATADIR:=$(DESTDIR)$(PREFIX)/share
|
|
MANPATH:=$(DATADIR)/man
|
|
|
|
vpath %.cc $(TOP_DIR)
|
|
|
|
INSTALL_DIR = $(INSTALL) -m 755 -d
|
|
INSTALL_PROGRAM = $(INSTALL) -m 755
|
|
INSTALL_DATA = $(INSTALL) -p -m 644
|
|
|
|
ifeq ("@TESTING@", "yes")
|
|
TEST_INCLUDES=\
|
|
-Igmock-1.6.0/include \
|
|
-Igmock-1.6.0/gtest/include
|
|
else
|
|
TEST_INCLUDES=
|
|
endif
|
|
|
|
.SUFFIXES: .d
|
|
|
|
%.o: %.cc
|
|
@echo " [CXX] $<"
|
|
$(V) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
|
|
@echo " [DEP] $<"
|
|
$(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(CPPFLAGS) $(TEST_INCLUDES) $(CXXFLAGS) $< > $*.$$$$; \
|
|
sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \
|
|
$(RM) $*.$$$$
|
|
|
|
#----------------------------------------------------------------
|
|
|
|
lib/libpdata.a: $(OBJECTS)
|
|
@echo " [AR] $<"
|
|
$(V)ar -rv $@ $(OBJECTS) > /dev/null 2>&1
|
|
|
|
bin/pdata_tools: $(OBJECTS)
|
|
@echo " [LD] $@"
|
|
$(V) $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS) $(CXXLIB)
|
|
|
|
#----------------------------------------------------------------
|
|
|
|
DEPEND_FILES=\
|
|
$(subst .cc,.d,$(SOURCE)) \
|
|
$(subst .cc,.d,$(TEST_SOURCE)) \
|
|
$(subst .cc,.d,$(CXX_PROGRAM_SOURCE)) \
|
|
$(subst .c,.d,$(C_PROGRAM_SOURCE))
|
|
|
|
.PHONY: clean distclean
|
|
|
|
clean:
|
|
find . -name \*.o -delete
|
|
find . -name \*.gmo -delete
|
|
find . -name \*.d -delete
|
|
$(RM) $(TEST_PROGRAMS) $(PROGRAMS) $(GMOCK_OBJECTS) lib/*.a
|
|
|
|
distclean: clean
|
|
$(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile
|
|
|
|
install: bin/pdata_tools
|
|
$(INSTALL_DIR) $(BINDIR)
|
|
$(INSTALL_PROGRAM) bin/pdata_tools $(BINDIR)
|
|
$(STRIP) $(BINDIR)/pdata_tools
|
|
ln -s -f pdata_tools $(BINDIR)/cache_check
|
|
ln -s -f pdata_tools $(BINDIR)/cache_dump
|
|
ln -s -f pdata_tools $(BINDIR)/cache_metadata_size
|
|
ln -s -f pdata_tools $(BINDIR)/cache_repair
|
|
ln -s -f pdata_tools $(BINDIR)/cache_restore
|
|
ln -s -f pdata_tools $(BINDIR)/thin_check
|
|
ln -s -f pdata_tools $(BINDIR)/thin_delta
|
|
ln -s -f pdata_tools $(BINDIR)/thin_dump
|
|
ln -s -f pdata_tools $(BINDIR)/thin_ls
|
|
ln -s -f pdata_tools $(BINDIR)/thin_repair
|
|
ln -s -f pdata_tools $(BINDIR)/thin_restore
|
|
ln -s -f pdata_tools $(BINDIR)/thin_rmap
|
|
ln -s -f pdata_tools $(BINDIR)/thin_trim
|
|
ln -s -f pdata_tools $(BINDIR)/thin_metadata_size
|
|
ln -s -f pdata_tools $(BINDIR)/era_check
|
|
ln -s -f pdata_tools $(BINDIR)/era_dump
|
|
ln -s -f pdata_tools $(BINDIR)/era_invalidate
|
|
ln -s -f pdata_tools $(BINDIR)/era_restore
|
|
$(INSTALL_DIR) $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/cache_check.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/cache_dump.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/cache_repair.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/cache_restore.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_check.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_delta.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_dump.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_ls.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_repair.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_restore.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_rmap.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_trim.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/thin_metadata_size.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/era_check.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/era_dump.8 $(MANPATH)/man8
|
|
$(INSTALL_DATA) man8/era_invalidate.8 $(MANPATH)/man8
|
|
|
|
# $(INSTALL_DATA) man8/era_restore.8 $(MANPATH)/man8
|
|
|
|
.PHONY: install
|
|
|
|
ifeq ("@TESTING@", "yes")
|
|
include unit-tests/Makefile
|
|
|
|
.PHONY: features test check
|
|
|
|
features: bin/pdata_tools
|
|
cucumber --no-color --format progress
|
|
|
|
test: features unit-test
|
|
check: unit-test
|
|
endif
|
|
|
|
-include $(DEPEND_FILES)
|
|
|