2001-09-21 12:37:43 +00:00
#
2004-03-30 19:35:44 +00:00
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
2018-05-12 18:14:53 +02:00
# Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
2001-09-21 12:37:43 +00:00
#
2007-09-21 10:16:45 +00:00
# This file is part of LVM2.
2001-09-21 12:37:43 +00:00
#
2004-03-30 19:35:44 +00:00
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
2001-09-21 12:37:43 +00:00
#
2004-03-30 19:35:44 +00:00
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2016-01-21 11:49:46 +01:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2001-09-21 12:37:43 +00:00
srcdir = @srcdir@
top_srcdir = @top_srcdir@
2009-10-02 19:10:31 +00:00
top_builddir = @top_builddir@
2015-05-11 14:28:55 +02:00
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
2001-09-21 12:37:43 +00:00
2018-05-11 18:55:55 +02:00
SUBDIRS = conf daemons include lib libdaemon libdm man scripts device_mapper tools
2004-02-13 22:56:45 +00:00
2009-07-31 11:49:53 +00:00
i f e q ( "@UDEV_RULES@" , "yes" )
SUBDIRS += udev
e n d i f
2004-02-13 22:56:45 +00:00
i f e q ( "@INTL@" , "yes" )
SUBDIRS += po
e n d i f
2009-05-22 14:44:59 +00:00
i f e q ( "@APPLIB@" , "yes" )
SUBDIRS += liblvm
e n d i f
2001-09-21 12:37:43 +00:00
2012-10-12 02:08:47 +01:00
i f e q ( "@PYTHON_BINDINGS@" , "yes" )
SUBDIRS += python
e n d i f
2013-06-03 12:05:02 +02:00
i f e q ( $( MAKECMDGOALS ) , c l e a n )
SUBDIRS += test
e n d i f
2011-08-11 19:18:17 +00:00
# FIXME Should use intermediate Makefiles here!
2001-12-11 16:26:34 +00:00
i f e q ( $( MAKECMDGOALS ) , d i s t c l e a n )
2013-06-28 10:46:00 +02:00
SUBDIRS = conf include man test scripts \
2012-02-28 18:35:04 +00:00
libdaemon lib tools daemons libdm \
2018-05-11 18:55:55 +02:00
udev po liblvm python device_mapper
2012-10-15 14:15:59 +01:00
tools.distclean : test .distclean
2001-12-11 16:26:34 +00:00
e n d i f
2010-04-06 09:54:11 +00:00
DISTCLEAN_DIRS += lcov_reports*
DISTCLEAN_TARGETS += config.cache config.log config.status make.tmpl
2001-12-11 16:26:34 +00:00
2001-09-21 12:37:43 +00:00
i n c l u d e m a k e . t m p l
2008-11-01 02:19:19 +00:00
libdm : include
2014-04-16 11:58:32 +02:00
libdaemon : include
2012-02-28 18:35:04 +00:00
lib : libdm libdaemon
2009-03-06 16:19:52 +00:00
liblvm : lib
2012-02-28 18:35:04 +00:00
daemons : lib libdaemon tools
tools : lib libdaemon device -mapper
2008-10-31 22:29:44 +00:00
po : tools daemons
2017-02-14 10:24:25 +01:00
man : tools
2017-02-14 13:24:31 +00:00
all_man : tools
2012-08-01 13:54:32 +02:00
scripts : liblvm libdm
2018-05-11 18:55:55 +02:00
test : tools daemons
2018-05-12 18:14:53 +02:00
unit-test : lib
run-unit-test : unit -test
2002-01-21 16:02:55 +00:00
2010-08-02 13:56:34 +00:00
lib.device-mapper : include .device -mapper
2008-11-03 22:14:30 +00:00
libdm.device-mapper : include .device -mapper
2010-08-02 12:10:35 +00:00
liblvm.device-mapper : include .device -mapper
2008-11-03 23:01:21 +00:00
daemons.device-mapper : libdm .device -mapper
2008-11-01 02:19:19 +00:00
tools.device-mapper : libdm .device -mapper
2013-09-05 11:32:42 +02:00
scripts.device-mapper : include .device -mapper
2008-11-04 15:55:27 +00:00
device-mapper : tools .device -mapper daemons .device -mapper man .device -mapper
2008-11-01 02:19:19 +00:00
2004-02-13 22:56:45 +00:00
i f e q ( "@INTL@" , "yes" )
lib.pofile : include .pofile
tools.pofile : lib .pofile
2004-06-24 08:02:38 +00:00
daemons.pofile : lib .pofile
2008-10-31 22:29:44 +00:00
po.pofile : tools .pofile daemons .pofile
2004-02-13 22:56:45 +00:00
pofile : po .pofile
e n d i f
2002-01-21 16:02:55 +00:00
2012-10-12 02:08:47 +01:00
i f e q ( "@PYTHON_BINDINGS@" , "yes" )
python : liblvm
e n d i f
2010-03-29 14:11:17 +00:00
i f n e q ( "$(CFLOW_CMD)" , "" )
tools.cflow : libdm .cflow lib .cflow
daemons.cflow : tools .cflow
cflow : include .cflow
2006-04-19 15:33:07 +00:00
e n d i f
i f n e q ( "@CSCOPE_CMD@" , "" )
2010-03-29 14:07:56 +00:00
cscope.out :
@CSCOPE_CMD@ -b -R -s$( top_srcdir)
2006-04-19 15:33:07 +00:00
all : cscope .out
e n d i f
2010-03-29 14:07:56 +00:00
DISTCLEAN_TARGETS += cscope.out
2015-05-13 15:43:55 +02:00
CLEAN_DIRS += autom4te.cache
2007-09-18 14:00:42 +00:00
2018-05-11 18:55:55 +02:00
check check_system check_cluster check_local check_lvmetad check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock unit-test run-unit-test : test
2010-04-13 13:28:52 +00:00
$( MAKE) -C test $( @)
2008-06-27 15:35:09 +00:00
2017-03-14 00:47:46 +00:00
conf.generate man.generate : tools
2015-04-15 16:15:30 -05:00
2015-05-11 21:48:11 +02:00
# how to use parenthesis in makefiles
leftparen := (
LVM_VER := $( firstword $( subst $( leftparen) , ,$( LVM_VERSION) ) )
VER := LVM2.$( LVM_VER)
# release file name
FILE_VER := $( VER) .tgz
CLEAN_TARGETS += $( FILE_VER)
CLEAN_DIRS += $( rpmbuilddir)
2015-05-11 14:28:55 +02:00
dist :
2015-05-11 21:48:11 +02:00
@echo " Generating $( FILE_VER) " ; \
( cd $( top_srcdir) ; git ls-tree -r HEAD --name-only | xargs tar --transform " s,^, $( VER) /, " -c) | gzip >$( FILE_VER)
2015-05-11 14:28:55 +02:00
rpm : dist
2015-05-11 21:48:11 +02:00
$( RM) -r $( rpmbuilddir) /SOURCES
$( MKDIR_P) $( rpmbuilddir) /SOURCES
$( LN_S) -f $( abs_top_builddir) /$( FILE_VER) $( rpmbuilddir) /SOURCES
$( LN_S) -f $( abs_top_srcdir) /spec/build.inc $( rpmbuilddir) /SOURCES
$( LN_S) -f $( abs_top_srcdir) /spec/macros.inc $( rpmbuilddir) /SOURCES
$( LN_S) -f $( abs_top_srcdir) /spec/packages.inc $( rpmbuilddir) /SOURCES
DM_VER = $$ ( cut -d- -f1 $( top_srcdir) /VERSION_DM) ; \
GIT_VER = $$ ( cd $( top_srcdir) ; git describe | cut -d- --output-delimiter= . -f2,3 || echo 0) ; \
sed -e " s,\(device_mapper_version\) [0-9.]* $$ ,\1 $$ DM_VER, " \
-e " s,^\(Version:[^0-9%]*\)[0-9.]* $$ ,\1 $( LVM_VER) , " \
-e " s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 $$ GIT_VER, " \
$( top_srcdir) /spec/source.inc >$( rpmbuilddir) /SOURCES/source.inc
2015-05-13 15:43:55 +02:00
rpmbuild -v --define " _topdir $( rpmbuilddir) " -ba $( top_srcdir) /spec/lvm2.spec
2015-05-11 14:28:55 +02:00
2017-03-14 00:47:46 +00:00
generate : conf .generate man .generate
2015-04-15 16:15:30 -05:00
$( MAKE) -C conf generate
2017-03-14 00:47:46 +00:00
$( MAKE) -C man generate
2015-04-15 16:15:30 -05:00
2015-09-15 13:14:16 +01:00
all_man :
$( MAKE) -C man all_man
2010-05-20 13:47:21 +00:00
install_system_dirs :
2010-11-22 21:39:47 +00:00
$( INSTALL_DIR) $( DESTDIR) $( DEFAULT_SYS_DIR)
2010-05-20 13:47:21 +00:00
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_ARCHIVE_DIR)
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_BACKUP_DIR)
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_CACHE_DIR)
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_LOCK_DIR)
2010-07-28 13:55:42 +00:00
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_RUN_DIR)
2010-05-20 13:47:21 +00:00
$( INSTALL_ROOT_DATA) /dev/null $( DESTDIR) $( DEFAULT_CACHE_DIR) /.cache
2018-05-12 18:14:53 +02:00
install_initscripts :
2010-05-20 14:45:14 +00:00
$( MAKE) -C scripts install_initscripts
2012-07-31 16:46:24 +02:00
install_systemd_generators :
$( MAKE) -C scripts install_systemd_generators
2014-03-13 13:01:06 +01:00
$( MAKE) -C man install_systemd_generators
2012-07-31 16:46:24 +02:00
2011-07-28 12:57:26 +00:00
install_systemd_units :
$( MAKE) -C scripts install_systemd_units
2015-09-15 13:14:16 +01:00
install_all_man :
$( MAKE) -C man install_all_man
2015-08-28 13:03:18 +01:00
2012-10-12 02:08:47 +01:00
i f e q ( "@PYTHON_BINDINGS@" , "yes" )
install_python_bindings :
$( MAKE) -C liblvm/python install_python_bindings
e n d i f
2012-02-22 17:55:10 +00:00
install_tmpfiles_configuration :
$( MAKE) -C scripts install_tmpfiles_configuration
2015-03-19 10:23:57 +01:00
LCOV_TRACES = libdm.info lib.info liblvm.info tools.info \
libdaemon/client.info libdaemon/server.info \
2018-05-12 00:47:53 +02:00
test/unit.info \
2016-02-26 10:14:39 +01:00
daemons/clvmd.info \
daemons/dmeventd.info \
daemons/lvmetad.info \
daemons/lvmlockd.info \
daemons/lvmpolld.info
2015-03-19 10:23:57 +01:00
2010-04-06 09:50:07 +00:00
CLEAN_TARGETS += $( LCOV_TRACES)
2010-03-29 14:06:06 +00:00
i f n e q ( "$(LCOV)" , "" )
2010-04-06 09:50:07 +00:00
.PHONY : lcov -reset lcov lcov -dated $( LCOV_TRACES )
2008-06-27 15:35:09 +00:00
2008-06-27 19:24:17 +00:00
i f e q ( $( MAKECMDGOALS ) , l c o v - d a t e d )
2010-04-06 09:50:07 +00:00
LCOV_REPORTS_DIR := lcov_reports-$( shell date +%Y%m%d%k%M%S)
lcov-dated : lcov
2008-06-27 19:24:17 +00:00
e l s e
2010-04-06 09:50:07 +00:00
LCOV_REPORTS_DIR := lcov_reports
2008-06-27 19:24:17 +00:00
e n d i f
2008-06-27 15:35:09 +00:00
2008-06-27 19:24:17 +00:00
lcov-reset :
2010-04-06 09:50:07 +00:00
$( LCOV) --zerocounters $( addprefix -d , $( basename $( LCOV_TRACES) ) )
# maybe use subdirs processing to create tracefiles...
$(LCOV_TRACES) :
2012-03-23 09:39:03 +00:00
$( LCOV) -b $( basename $@ ) -d $( basename $@ ) \
--ignore-errors source -c -o - | $( SED) \
2010-04-06 09:50:07 +00:00
-e "s/\(dmeventd_lvm.[ch]\)/plugins\/lvm2\/\1/" \
2012-03-23 09:39:03 +00:00
-e "s/dmeventd_\(mirror\|snapshot\|thin\|raid\)\.c/plugins\/\1\/dmeventd_\1\.c/" \
2010-04-06 09:50:07 +00:00
>$@
2008-06-27 15:35:09 +00:00
2010-03-29 14:06:06 +00:00
i f n e q ( "$(GENHTML)" , "" )
2010-04-06 09:50:07 +00:00
lcov : $( LCOV_TRACES )
$( RM) -r $( LCOV_REPORTS_DIR)
$( MKDIR_P) $( LCOV_REPORTS_DIR)
for i in $( LCOV_TRACES) ; do \
2015-04-14 13:28:26 +02:00
test -s $$ i -a $$ ( wc -w <$$ i) -ge 100 && lc = " $$ lc $$ i " ; \
2010-04-06 09:50:07 +00:00
done ; \
2010-04-06 11:53:53 +00:00
test -z " $$ lc " || $( GENHTML) -p @abs_top_builddir@ \
2010-04-06 09:50:07 +00:00
-o $( LCOV_REPORTS_DIR) $$ lc
2008-06-27 15:35:09 +00:00
e n d i f
e n d i f
2010-07-20 14:38:44 +00:00
2009-10-02 12:09:02 +02:00
i f n e q ( $( shell which ctags ) , )
.PHONY : tags
tags :
2015-09-07 13:44:14 +02:00
test -z " $( shell find $( top_srcdir) -type f -name '*.[ch]' -newer tags 2>/dev/null | head -1) " || $( RM) tags
2015-10-12 00:10:37 +02:00
test -f tags || find $( top_srcdir) -maxdepth 5 -type f -name '*.[ch]' -exec ctags -a '{}' +
2009-10-02 12:09:02 +02:00
2015-09-07 13:44:14 +02:00
CLEAN_TARGETS += tags
2009-10-02 12:09:02 +02:00
e n d i f