2001-09-21 16:37:43 +04:00
#
2004-03-30 23:35:44 +04:00
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
2018-05-12 19:14:53 +03:00
# Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
2001-09-21 16:37:43 +04:00
#
2007-09-21 14:16:45 +04:00
# This file is part of LVM2.
2001-09-21 16:37:43 +04:00
#
2004-03-30 23:35:44 +04: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 16:37:43 +04:00
#
2004-03-30 23:35:44 +04: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 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2001-09-21 16:37:43 +04:00
srcdir = @srcdir@
top_srcdir = @top_srcdir@
2009-10-02 23:10:31 +04:00
top_builddir = @top_builddir@
2015-05-11 15:28:55 +03:00
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
2001-09-21 16:37:43 +04:00
2018-05-11 19:55:55 +03:00
SUBDIRS = conf daemons include lib libdaemon libdm man scripts device_mapper tools
2004-02-14 01:56:45 +03:00
2009-07-31 15:49:53 +04:00
i f e q ( "@UDEV_RULES@" , "yes" )
SUBDIRS += udev
e n d i f
2004-02-14 01:56:45 +03:00
i f e q ( "@INTL@" , "yes" )
SUBDIRS += po
e n d i f
2009-05-22 18:44:59 +04:00
i f e q ( "@APPLIB@" , "yes" )
SUBDIRS += liblvm
e n d i f
2001-09-21 16:37:43 +04:00
2012-10-12 05:08:47 +04:00
i f e q ( "@PYTHON_BINDINGS@" , "yes" )
SUBDIRS += python
e n d i f
2013-06-03 14:05:02 +04:00
i f e q ( $( MAKECMDGOALS ) , c l e a n )
SUBDIRS += test
e n d i f
2011-08-11 23:18:17 +04:00
# FIXME Should use intermediate Makefiles here!
2001-12-11 19:26:34 +03:00
i f e q ( $( MAKECMDGOALS ) , d i s t c l e a n )
2013-06-28 12:46:00 +04:00
SUBDIRS = conf include man test scripts \
2012-02-28 22:35:04 +04:00
libdaemon lib tools daemons libdm \
2018-05-11 19:55:55 +03:00
udev po liblvm python device_mapper
2012-10-15 17:15:59 +04:00
tools.distclean : test .distclean
2001-12-11 19:26:34 +03:00
e n d i f
2010-04-06 13:54:11 +04:00
DISTCLEAN_DIRS += lcov_reports*
DISTCLEAN_TARGETS += config.cache config.log config.status make.tmpl
2001-12-11 19:26:34 +03:00
2001-09-21 16:37:43 +04:00
i n c l u d e m a k e . t m p l
2020-01-16 17:03:42 +03:00
i n c l u d e $( top_srcdir ) / b a s e / M a k e f i l e
libdm : include $( top_builddir ) /base /libbase .a
libdaemon : include $( top_builddir ) /base /libbase .a
lib : libdm libdaemon $( top_builddir ) /base /libbase .a
liblvm : lib $( top_builddir ) /base /libbase .a
daemons : lib libdaemon tools $( top_builddir ) /base /libbase .a
tools : lib libdaemon device -mapper $( top_builddir ) /base /libbase .a
2008-11-01 01:29:44 +03:00
po : tools daemons
2017-02-14 12:24:25 +03:00
man : tools
2017-02-14 16:24:31 +03:00
all_man : tools
2012-08-01 15:54:32 +04:00
scripts : liblvm libdm
2020-01-16 17:03:42 +03:00
test : tools daemons $( top_builddir ) /base /libbase .a
unit-test : lib $( top_builddir ) /base /libbase .a
2018-05-12 19:14:53 +03:00
run-unit-test : unit -test
2002-01-21 19:02:55 +03:00
2010-08-02 17:56:34 +04:00
lib.device-mapper : include .device -mapper
2008-11-04 01:14:30 +03:00
libdm.device-mapper : include .device -mapper
2010-08-02 16:10:35 +04:00
liblvm.device-mapper : include .device -mapper
2008-11-04 02:01:21 +03:00
daemons.device-mapper : libdm .device -mapper
2008-11-01 05:19:19 +03:00
tools.device-mapper : libdm .device -mapper
2013-09-05 13:32:42 +04:00
scripts.device-mapper : include .device -mapper
2008-11-04 18:55:27 +03:00
device-mapper : tools .device -mapper daemons .device -mapper man .device -mapper
2008-11-01 05:19:19 +03:00
2004-02-14 01:56:45 +03:00
i f e q ( "@INTL@" , "yes" )
lib.pofile : include .pofile
tools.pofile : lib .pofile
2004-06-24 12:02:38 +04:00
daemons.pofile : lib .pofile
2008-11-01 01:29:44 +03:00
po.pofile : tools .pofile daemons .pofile
2004-02-14 01:56:45 +03:00
pofile : po .pofile
e n d i f
2002-01-21 19:02:55 +03:00
2012-10-12 05:08:47 +04:00
i f e q ( "@PYTHON_BINDINGS@" , "yes" )
python : liblvm
e n d i f
2010-03-29 18:11:17 +04:00
i f n e q ( "$(CFLOW_CMD)" , "" )
tools.cflow : libdm .cflow lib .cflow
daemons.cflow : tools .cflow
cflow : include .cflow
2006-04-19 19:33:07 +04:00
e n d i f
i f n e q ( "@CSCOPE_CMD@" , "" )
2010-03-29 18:07:56 +04:00
cscope.out :
@CSCOPE_CMD@ -b -R -s$( top_srcdir)
2006-04-19 19:33:07 +04:00
all : cscope .out
e n d i f
2010-03-29 18:07:56 +04:00
DISTCLEAN_TARGETS += cscope.out
2015-05-13 16:43:55 +03:00
CLEAN_DIRS += autom4te.cache
2007-09-18 18:00:42 +04:00
2018-05-11 19:55:55 +03: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 17:28:52 +04:00
$( MAKE) -C test $( @)
2008-06-27 19:35:09 +04:00
2017-03-14 03:47:46 +03:00
conf.generate man.generate : tools
2015-04-16 00:15:30 +03:00
2015-05-11 22:48:11 +03: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 15:28:55 +03:00
dist :
2015-05-11 22:48:11 +03: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 15:28:55 +03:00
rpm : dist
2015-05-11 22:48:11 +03: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
2019-07-02 16:18:40 +03:00
DM_VER = $$ ( cut -d' ' -f1 $( top_srcdir) /VERSION_DM | cut -d- -f1) ; \
GIT_VER = $$ ( cd $( top_srcdir) ; git describe | cut -s -d- --output-delimiter= . -f2,3) ; \
2015-05-11 22:48:11 +03:00
sed -e " s,\(device_mapper_version\) [0-9.]* $$ ,\1 $$ DM_VER, " \
-e " s,^\(Version:[^0-9%]*\)[0-9.]* $$ ,\1 $( LVM_VER) , " \
2019-07-02 16:18:40 +03:00
-e " s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 $$ {GIT_VER:- " 0"}," \
2015-05-11 22:48:11 +03:00
$( top_srcdir) /spec/source.inc >$( rpmbuilddir) /SOURCES/source.inc
2015-05-13 16:43:55 +03:00
rpmbuild -v --define " _topdir $( rpmbuilddir) " -ba $( top_srcdir) /spec/lvm2.spec
2015-05-11 15:28:55 +03:00
2017-03-14 03:47:46 +03:00
generate : conf .generate man .generate
2015-04-16 00:15:30 +03:00
$( MAKE) -C conf generate
2017-03-14 03:47:46 +03:00
$( MAKE) -C man generate
2015-04-16 00:15:30 +03:00
2015-09-15 15:14:16 +03:00
all_man :
$( MAKE) -C man all_man
2010-05-20 17:47:21 +04:00
install_system_dirs :
2010-11-23 00:39:47 +03:00
$( INSTALL_DIR) $( DESTDIR) $( DEFAULT_SYS_DIR)
2010-05-20 17:47:21 +04: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 17:55:42 +04:00
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_RUN_DIR)
2010-05-20 17:47:21 +04:00
$( INSTALL_ROOT_DATA) /dev/null $( DESTDIR) $( DEFAULT_CACHE_DIR) /.cache
2018-05-12 19:14:53 +03:00
install_initscripts :
2010-05-20 18:45:14 +04:00
$( MAKE) -C scripts install_initscripts
2012-07-31 18:46:24 +04:00
install_systemd_generators :
$( MAKE) -C scripts install_systemd_generators
2014-03-13 16:01:06 +04:00
$( MAKE) -C man install_systemd_generators
2012-07-31 18:46:24 +04:00
2011-07-28 16:57:26 +04:00
install_systemd_units :
$( MAKE) -C scripts install_systemd_units
2015-09-15 15:14:16 +03:00
install_all_man :
$( MAKE) -C man install_all_man
2015-08-28 15:03:18 +03:00
2012-10-12 05:08:47 +04: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 21:55:10 +04:00
install_tmpfiles_configuration :
$( MAKE) -C scripts install_tmpfiles_configuration
2015-03-19 12:23:57 +03:00
LCOV_TRACES = libdm.info lib.info liblvm.info tools.info \
libdaemon/client.info libdaemon/server.info \
2018-05-12 01:47:53 +03:00
test/unit.info \
2016-02-26 12:14:39 +03:00
daemons/clvmd.info \
daemons/dmeventd.info \
daemons/lvmetad.info \
daemons/lvmlockd.info \
daemons/lvmpolld.info
2015-03-19 12:23:57 +03:00
2010-04-06 13:50:07 +04:00
CLEAN_TARGETS += $( LCOV_TRACES)
2010-03-29 18:06:06 +04:00
i f n e q ( "$(LCOV)" , "" )
2010-04-06 13:50:07 +04:00
.PHONY : lcov -reset lcov lcov -dated $( LCOV_TRACES )
2008-06-27 19:35:09 +04:00
2008-06-27 23:24:17 +04:00
i f e q ( $( MAKECMDGOALS ) , l c o v - d a t e d )
2010-04-06 13:50:07 +04:00
LCOV_REPORTS_DIR := lcov_reports-$( shell date +%Y%m%d%k%M%S)
lcov-dated : lcov
2008-06-27 23:24:17 +04:00
e l s e
2010-04-06 13:50:07 +04:00
LCOV_REPORTS_DIR := lcov_reports
2008-06-27 23:24:17 +04:00
e n d i f
2008-06-27 19:35:09 +04:00
2008-06-27 23:24:17 +04:00
lcov-reset :
2010-04-06 13:50:07 +04:00
$( LCOV) --zerocounters $( addprefix -d , $( basename $( LCOV_TRACES) ) )
# maybe use subdirs processing to create tracefiles...
$(LCOV_TRACES) :
2012-03-23 13:39:03 +04:00
$( LCOV) -b $( basename $@ ) -d $( basename $@ ) \
--ignore-errors source -c -o - | $( SED) \
2010-04-06 13:50:07 +04:00
-e "s/\(dmeventd_lvm.[ch]\)/plugins\/lvm2\/\1/" \
2012-03-23 13:39:03 +04:00
-e "s/dmeventd_\(mirror\|snapshot\|thin\|raid\)\.c/plugins\/\1\/dmeventd_\1\.c/" \
2010-04-06 13:50:07 +04:00
>$@
2008-06-27 19:35:09 +04:00
2010-03-29 18:06:06 +04:00
i f n e q ( "$(GENHTML)" , "" )
2010-04-06 13:50:07 +04:00
lcov : $( LCOV_TRACES )
$( RM) -r $( LCOV_REPORTS_DIR)
$( MKDIR_P) $( LCOV_REPORTS_DIR)
for i in $( LCOV_TRACES) ; do \
2015-04-14 14:28:26 +03:00
test -s $$ i -a $$ ( wc -w <$$ i) -ge 100 && lc = " $$ lc $$ i " ; \
2010-04-06 13:50:07 +04:00
done ; \
2010-04-06 15:53:53 +04:00
test -z " $$ lc " || $( GENHTML) -p @abs_top_builddir@ \
2010-04-06 13:50:07 +04:00
-o $( LCOV_REPORTS_DIR) $$ lc
2008-06-27 19:35:09 +04:00
e n d i f
e n d i f
2010-07-20 18:38:44 +04:00
2009-10-02 14:09:02 +04:00
i f n e q ( $( shell which ctags ) , )
.PHONY : tags
tags :
2015-09-07 14:44:14 +03:00
test -z " $( shell find $( top_srcdir) -type f -name '*.[ch]' -newer tags 2>/dev/null | head -1) " || $( RM) tags
2015-10-12 01:10:37 +03:00
test -f tags || find $( top_srcdir) -maxdepth 5 -type f -name '*.[ch]' -exec ctags -a '{}' +
2009-10-02 14:09:02 +04:00
2015-09-07 14:44:14 +03:00
CLEAN_TARGETS += tags
2009-10-02 14:09:02 +04:00
e n d i f