143 lines
3.7 KiB
Makefile
Raw Normal View History

# 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/>.
.PHONY: all
2011-08-31 14:01:48 +01:00
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 \
thin_restore
all: $(PROGRAMS)
2011-08-31 14:01:48 +01:00
2011-06-16 08:16:10 +01:00
SOURCE=\
2011-09-12 11:49:42 +01:00
checksum.cc \
2011-08-22 10:42:13 +01:00
endian_utils.cc \
error_set.cc \
2011-09-16 10:06:37 +01:00
hex_dump.cc \
2011-10-10 14:10:30 +01:00
human_readable_format.cc \
2011-10-28 12:25:06 +01:00
metadata.cc \
2011-10-28 12:07:21 +01:00
metadata_checker.cc \
2011-10-28 12:13:03 +01:00
metadata_dumper.cc \
metadata_disk_structures.cc \
2011-10-28 14:01:44 +01:00
restore_emitter.cc \
2011-11-08 11:08:16 +00:00
space_map.cc \
space_map_disk.cc \
2011-11-09 10:21:25 +00:00
space_map_recursive.cc \
2011-11-16 13:17:49 +00:00
space_map_transactional.cc \
2011-10-28 12:21:58 +01:00
thin_pool.cc \
2011-10-10 15:06:07 +01:00
transaction_manager.cc \
xml_format.cc
2011-08-22 10:42:13 +01:00
PROGRAM_SOURCE=\
2012-03-02 10:00:31 +00:00
thin_check.cc \
thin_dump.cc \
thin_restore.cc
CXX:=@CXX@
OBJECTS:=$(subst .cc,.o,$(SOURCE))
2011-12-09 12:54:51 +00:00
TOP_DIR:=@top_srcdir@
TOP_BUILDDIR:=@top_builddir@
2012-02-29 11:00:13 +00:00
CXXFLAGS+=-Wall -fno-strict-aliasing
2011-12-09 12:54:51 +00:00
CXXFLAGS+=@CXXOPTIMISE_FLAG@
CXXFLAGS+=@CXXDEBUG_FLAG@
INCLUDES+=-I$(TOP_BUILDDIR) -I$(TOP_DIR)
LIBS:=-lstdc++
LIBEXPAT:=-lexpat
INSTALL:=@INSTALL@
STRIP=
DESTDIR:=@prefix@
BINDIR:=$(DESTDIR)/sbin
MANPATH:=$(DESTDIR)$(MANDIR)
vpath %.cc $(TOP_DIR)
INSTALL_DIR = $(INSTALL) -m 755 -d
INSTALL_PROGRAM = $(INSTALL) -m 755 $(STRIP)
INSTALL_DATA = $(INSTALL) -p -m 644
2011-06-16 08:16:10 +01:00
.PHONY: test-programs
2011-07-22 16:09:56 +01:00
test-programs: $(TEST_PROGRAMS)
.SUFFIXES: .d
2011-06-16 08:16:10 +01:00
%.d: %.cc
$(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\
sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \
$(RM) $@.$$$$
2011-06-16 08:16:10 +01:00
%.o: %.cc
$(CXX) -c $(INCLUDES) $(CXXFLAGS) -o $@ $<
2011-06-16 08:16:10 +01:00
2011-12-15 13:53:07 +00:00
THIN_DUMP_SOURCE=$(SOURCE)
THIN_RESTORE_SOURCE=$(SOURCE)
2012-03-02 10:00:31 +00:00
THIN_CHECK_SOURCE=\
2011-12-15 13:53:07 +00:00
checksum.cc \
endian_utils.cc \
error_set.cc \
hex_dump.cc \
metadata.cc \
metadata_checker.cc \
metadata_disk_structures.cc \
space_map.cc \
space_map_disk.cc \
space_map_recursive.cc \
space_map_transactional.cc \
transaction_manager.cc
2011-08-23 11:55:37 +01:00
2011-12-15 13:53:07 +00:00
THIN_DUMP_OBJECTS=$(subst .cc,.o,$(THIN_DUMP_SOURCE))
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))
2011-12-15 13:53:07 +00:00
thin_dump: $(THIN_DUMP_OBJECTS) thin_dump.o
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-15 13:53:07 +00:00
thin_restore: $(THIN_RESTORE_OBJECTS) thin_restore.o
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-08-31 14:01:48 +01:00
2012-03-02 10:00:31 +00:00
thin_check: $(THIN_CHECK_OBJECTS) thin_check.o
2011-12-09 12:54:51 +00:00
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
2011-08-23 11:55:37 +01:00
2011-12-06 15:47:24 +00:00
clean:
$(RM) *.o unit-tests/*.o *.d unit-tests/*.d $(TEST_PROGRAMS) $(PROGRAMS)
distclean: clean
$(RM) config.cache config.log config.status configure.h version.h Makefile unit-tests/Makefile
.PHONY: clean distclean
2011-12-06 15:47:24 +00:00
2011-12-09 12:54:51 +00:00
install: $(PROGRAMS)
$(INSTALL_DIR) $(BINDIR)
2012-03-02 10:00:31 +00:00
$(INSTALL_PROGRAM) thin_check $(BINDIR)/thin_check
$(INSTALL_PROGRAM) thin_dump $(BINDIR)/thin_dump
$(INSTALL_PROGRAM) thin_restore $(BINDIR)/thin_restore
$(INSTALL_DIR) $(MANPATH)/man8
2012-03-02 10:00:31 +00:00
$(INSTALL_DATA) man8/thin_check.8 $(MANPATH)/man8/thin_check.8
$(INSTALL_DATA) man8/thin_dump.8 $(MANPATH)/man8/thin_dump.8
$(INSTALL_DATA) man8/thin_restore.8 $(MANPATH)/man8/thin_restore.8
.PHONY: install
ifeq (,$(findstring $(MAKECMDGOALS),clean distclean))
-include $(subst .cc,.d,$(SOURCE))
-include $(subst .cc,.d,$(TEST_SOURCE))
-include $(subst .cc,.d,$(PROGRAM_SOURCE))
endif
ifeq ("@TESTING@", "yes")
include unit-tests/Makefile
2011-12-09 12:54:51 +00:00
endif