thin-provisioning-tools/Makefile.in
Heinz Mauelshagen e2d68de562 - add licence
- try to fix up --enable-testing, but most unit tests don't compile (include
file changes?) or run (missing data?) at present
- support building in different dir from src
- add 'distclean' target and don't build .d files when cleaning
- rebuild if Makefile changes  (didn't bother triggering a build
[Alasdair Kergon]
2011-12-21 11:04:00 +01:00

143 lines
3.7 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/>.
.PHONEY: all
PROGRAMS=\
thin_repair \
thin_dump \
thin_restore
all: $(PROGRAMS)
SOURCE=\
checksum.cc \
endian_utils.cc \
error_set.cc \
hex_dump.cc \
human_readable_format.cc \
metadata.cc \
metadata_checker.cc \
metadata_dumper.cc \
metadata_disk_structures.cc \
restore_emitter.cc \
space_map.cc \
space_map_disk.cc \
space_map_recursive.cc \
space_map_transactional.cc \
thin_pool.cc \
transaction_manager.cc \
xml_format.cc
PROGRAM_SOURCE=\
thin_dump.cc \
thin_repair.cc \
thin_restore.cc
CXX:=@CXX@
OBJECTS:=$(subst .cc,.o,$(SOURCE))
TOP_DIR:=@top_srcdir@
TOP_BUILDDIR:=@top_builddir@
CXXFLAGS+=-Wall
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
.PHONEY: test-programs
test-programs: $(TEST_PROGRAMS)
.SUFFIXES: .d
%.d: %.cc
$(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(CXXFLAGS) $< > $@.$$$$;\
sed 's,\([^ :]*\)\.o[ :]*,\1.o $@ : Makefile ,g' < $@.$$$$ > $@; \
$(RM) $@.$$$$
%.o: %.cc
$(CXX) -c $(INCLUDES) $(CXXFLAGS) -o $@ $<
THIN_DUMP_SOURCE=$(SOURCE)
THIN_RESTORE_SOURCE=$(SOURCE)
THIN_REPAIR_SOURCE=\
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
THIN_DUMP_OBJECTS=$(subst .cc,.o,$(THIN_DUMP_SOURCE))
THIN_RESTORE_OBJECTS=$(subst .cc,.o,$(THIN_RESTORE_SOURCE))
THIN_REPAIR_OBJECTS=$(subst .cc,.o,$(THIN_REPAIR_SOURCE))
thin_dump: $(THIN_DUMP_OBJECTS) thin_dump.o
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
thin_restore: $(THIN_RESTORE_OBJECTS) thin_restore.o
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS) $(LIBEXPAT)
thin_repair: $(THIN_REPAIR_OBJECTS) thin_repair.o
$(CXX) $(CXXFLAGS) -o $@ $+ $(LIBS)
.PHONEY: clean distclean
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.in
.PHONEY: install
install: $(PROGRAMS)
$(INSTALL_DIR) $(BINDIR)
$(INSTALL_PROGRAM) thin_repair $(BINDIR)/thin_repair
$(INSTALL_PROGRAM) thin_dump $(BINDIR)/thin_dump
$(INSTALL_PROGRAM) thin_restore $(BINDIR)/thin_restore
$(INSTALL_DIR) $(MANPATH)/man8
$(INSTALL_DATA) man8/thin_repair.8 $(MANPATH)/man8/thin_repair.8
$(INSTALL_DATA) man8/thin_dump.8 $(MANPATH)/man8/thin_dump.8
$(INSTALL_DATA) man8/thin_restore.8 $(MANPATH)/man8/thin_restore.8
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.in
endif