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
2021-04-08 19:44:53 +02:00
SUBDIRS = libdm conf daemons include lib libdaemon man scripts 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
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-06-08 10:33:47 -05:00
udev po
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
2018-12-15 01:55:11 +01: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 09:06:06 -05:00
lib : include libdaemon $( BASE_TARGET ) $( DEVICE_MAPPER_TARGET )
2012-02-28 18:35:04 +00:00
daemons : lib libdaemon tools
2018-12-15 01:55:11 +01:00
scripts : lib
tools : lib libdaemon
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
2018-05-11 18:55:55 +02:00
test : tools daemons
2018-12-15 01:55:11 +01:00
unit-test run-unit-test : test
2002-01-21 16:02:55 +00:00
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
2008-11-04 15:55:27 +00:00
device-mapper : tools .device -mapper daemons .device -mapper man .device -mapper
2021-02-28 01:19:23 +01:00
device_mapper : 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
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
2021-04-09 15:27:12 +02:00
CSCOPE_DIRS = base daemons device_mapper include lib libdaemon scripts tools libdm test
2006-04-19 15:33:07 +00:00
i f n e q ( "@CSCOPE_CMD@" , "" )
2010-03-29 14:07:56 +00:00
cscope.out :
2021-04-04 11:25:54 +02:00
@CSCOPE_CMD@ -b -R $( patsubst %,-s%,$( addprefix $( srcdir) /,$( CSCOPE_DIRS) ) )
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-07-10 13:39:29 -05:00
check check_system check_cluster check_local check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock : 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) ; \
2021-03-02 21:21:38 +01:00
$( SED) -e " s,\(device_mapper_version\) [0-9.]* $$ ,\1 $$ DM_VER, " \
2015-05-11 21:48:11 +02: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 14:10:17 +01:00
V = $( V) 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-02-22 17:55:10 +00:00
install_tmpfiles_configuration :
$( MAKE) -C scripts install_tmpfiles_configuration
2021-02-25 17:40:53 +01: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."
@echo " rpm Build rpm."
@echo " run-unit-test Run unit tests."
@echo " tags Generate c/etags."
2010-03-29 14:06:06 +00:00
i f n e q ( "$(LCOV)" , "" )
2018-11-23 13:07:50 +01:00
.PHONY : lcov -reset lcov lcov -dated
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 :
2018-11-23 13:07:50 +01:00
$( LCOV) --zerocounters --directory $( top_builddir)
2008-06-27 15:35:09 +00:00
2010-03-29 14:06:06 +00:00
i f n e q ( "$(GENHTML)" , "" )
2018-11-23 13:07:50 +01:00
lcov :
$( RM) -rf $( LCOV_REPORTS_DIR)
2010-04-06 09:50:07 +00:00
$( MKDIR_P) $( LCOV_REPORTS_DIR)
2018-11-30 12:54:34 +01: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 15:35:09 +00:00
e n d i f
e n d i f
2010-07-20 14:38:44 +00:00
2018-11-30 21:59:08 +01:00
i f n e q ( $( shell which ctags 2>/dev /null ) , )
2009-10-02 12:09:02 +02:00
.PHONY : tags
tags :
2021-04-09 15:27:12 +02: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 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