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
2021-04-08 20:44:53 +03:00
SUBDIRS = libdm conf daemons include lib libdaemon man scripts 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
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-06-08 18:33:47 +03:00
udev po
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
2023-07-13 13:27:09 +03:00
DISTCLEAN_DIRS += lcov_reports* autom4te.cache
2010-04-06 13:54:11 +04:00
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
2018-12-15 03:55:11 +03:00
i n c l u d e $( top_srcdir ) / b a s e / M a k e f i l e
i n c l u d e $( top_srcdir ) / d e v i c e _ m a p p e r / M a k e f i l e
i n c l u d e $( top_srcdir ) / t e s t / u n i t / M a k e f i l e
2022-09-27 17:06:06 +03:00
lib : include libdaemon $( BASE_TARGET ) $( DEVICE_MAPPER_TARGET )
2012-02-28 22:35:04 +04:00
daemons : lib libdaemon tools
2018-12-15 03:55:11 +03:00
scripts : lib
tools : lib libdaemon
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
2018-05-11 19:55:55 +03:00
test : tools daemons
2018-12-15 03:55:11 +03:00
unit-test run-unit-test : test
2002-01-21 19:02:55 +03:00
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
2008-11-04 18:55:27 +03:00
device-mapper : tools .device -mapper daemons .device -mapper man .device -mapper
2021-02-28 03:19:23 +03:00
device_mapper : 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
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
2021-04-09 16:27:12 +03:00
CSCOPE_DIRS = base daemons device_mapper include lib libdaemon scripts tools libdm test
2006-04-19 19:33:07 +04:00
i f n e q ( "@CSCOPE_CMD@" , "" )
2010-03-29 18:07:56 +04:00
cscope.out :
2021-04-04 12:25:54 +03:00
@CSCOPE_CMD@ -b -R $( patsubst %,-s%,$( addprefix $( srcdir) /,$( CSCOPE_DIRS) ) )
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-07-10 21:39:29 +03:00
check check_system check_cluster check_local check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock : 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
DM_VER = $$ ( cut -d- -f1 $( top_srcdir) /VERSION_DM) ; \
GIT_VER = $$ ( cd $( top_srcdir) ; git describe | cut -d- --output-delimiter= . -f2,3 || echo 0) ; \
2021-03-02 23:21:38 +03:00
$( SED) -e " s,\(device_mapper_version\) [0-9.]* $$ ,\1 $$ DM_VER, " \
2015-05-11 22:48:11 +03:00
-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
2021-03-08 16:10:17 +03:00
V = $( V) 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)
2023-11-29 17:09:36 +03:00
$( INSTALL_ROOT_DIR) $( DESTDIR) $( DEFAULT_SYS_DIR) /devices
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-02-22 21:55:10 +04:00
install_tmpfiles_configuration :
$( MAKE) -C scripts install_tmpfiles_configuration
2021-02-25 19:40:53 +03:00
help :
@echo -e "\nAvailable targets:"
@echo " all Default target."
@echo " all_man Build all man pages with generators."
@echo " clean Remove all compile files."
@echo " device-mapper Device mapper part of lvm2."
@echo " dist Generate distributable file."
@echo " distclean Remove all build files."
@echo " generate Generate man pages for sources."
@echo " help Display callable targets."
@echo " install Install all files."
@echo " install_all_man Install all man pages."
@echo " install_cluster Install cmirrord."
@echo " install_device-mapper Install device mapper files."
@echo " install_initscripts Install initialization scripts."
@echo " install_lvm2 Install lvm2 files."
@echo " install_systemd_units Install systemd units."
@echo " lcov Generate lcov output."
@echo " lcov-dated Generate lcov with timedate suffix."
@echo " lcov-reset Reset lcov counters"
@echo " man Build man pages."
2023-02-11 18:10:19 +03:00
@echo " print-VARIABLE Resolve make variable."
2021-02-25 19:40:53 +03:00
@echo " rpm Build rpm."
@echo " run-unit-test Run unit tests."
@echo " tags Generate c/etags."
2010-03-29 18:06:06 +04:00
i f n e q ( "$(LCOV)" , "" )
2018-11-23 15:07:50 +03:00
.PHONY : lcov -reset lcov lcov -dated
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 :
2018-11-23 15:07:50 +03:00
$( LCOV) --zerocounters --directory $( top_builddir)
2008-06-27 19:35:09 +04:00
2010-03-29 18:06:06 +04:00
i f n e q ( "$(GENHTML)" , "" )
2018-11-23 15:07:50 +03:00
lcov :
$( RM) -rf $( LCOV_REPORTS_DIR)
2010-04-06 13:50:07 +04:00
$( MKDIR_P) $( LCOV_REPORTS_DIR)
2018-11-30 14:54:34 +03:00
$( LCOV) --capture --directory $( top_builddir) --ignore-errors source \
--output-file $( LCOV_REPORTS_DIR) /out.info
-test ! -s $( LCOV_REPORTS_DIR) /out.info || \
$( GENHTML) -o $( LCOV_REPORTS_DIR) --ignore-errors source \
$( LCOV_REPORTS_DIR) /out.info
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
2018-11-30 23:59:08 +03:00
i f n e q ( $( shell which ctags 2>/dev /null ) , )
2009-10-02 14:09:02 +04:00
.PHONY : tags
tags :
2021-04-09 16:27:12 +03:00
test -z " $( shell find $( addprefix $( top_srcdir) /,$( CSCOPE_DIRS) ) -type f -name '*.[ch]' -newer tags 2>/dev/null | head -1) " || $( RM) tags
test -f tags || find $( addprefix $( top_srcdir) /,$( CSCOPE_DIRS) ) -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