2 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 # Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved.
5 # This file is part of LVM2.
7 # This copyrighted material is made available to anyone wishing to use,
8 # modify, copy, or redistribute it subject to the terms and conditions
9 # of the GNU General Public License v.2.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software Foundation,
13 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 top_srcdir
= @top_srcdir@
17 top_builddir
= @top_builddir@
18 abs_top_builddir
= @abs_top_builddir@
19 abs_top_srcdir
= @abs_top_srcdir@
21 SUBDIRS
= libdm conf daemons
include lib libdaemon man scripts tools
23 ifeq ("@UDEV_RULES@", "yes")
27 ifeq ("@INTL@", "yes")
31 ifeq ($(MAKECMDGOALS
),clean)
34 # FIXME Should use intermediate Makefiles here!
35 ifeq ($(MAKECMDGOALS
),distclean)
36 SUBDIRS
= conf
include man
test scripts \
37 libdaemon lib tools daemons libdm \
39 tools.
distclean: test.
distclean
41 DISTCLEAN_DIRS
+= lcov_reports
* autom4te.cache
42 DISTCLEAN_TARGETS
+= config.cache config.log config.status make.tmpl
46 include $(top_srcdir
)/base
/Makefile
47 include $(top_srcdir
)/device_mapper
/Makefile
48 include $(top_srcdir
)/test/unit
/Makefile
50 lib
: include libdaemon
$(BASE_TARGET
) $(DEVICE_MAPPER_TARGET
)
51 daemons
: lib libdaemon tools
58 unit-test run-unit-test
: test libdm
60 daemons.device-mapper
: libdm.device-mapper
61 tools.device-mapper
: libdm.device-mapper
62 device-mapper
: tools.device-mapper daemons.device-mapper man.device-mapper
63 device_mapper
: device-mapper
65 ifeq ("@INTL@", "yes")
66 lib.pofile
: include.pofile
67 tools.pofile
: lib.pofile
68 daemons.pofile
: lib.pofile
69 po.pofile
: tools.pofile daemons.pofile
73 ifneq ("$(CFLOW_CMD)", "")
74 tools.cflow
: libdm.cflow lib.cflow
75 daemons.cflow
: tools.cflow
79 CSCOPE_DIRS
= base daemons device_mapper
include lib libdaemon scripts tools libdm
test
80 ifneq ("@CSCOPE_CMD@", "")
82 @CSCOPE_CMD@
-b
-R
$(patsubst %,-s
%,$(addprefix $(srcdir)/,$(CSCOPE_DIRS
)))
85 DISTCLEAN_TARGETS
+= cscope.out
86 CLEAN_DIRS
+= autom4te.cache
88 check check_system check_cluster check_local check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock
: test
91 conf.generate man.generate
: tools
93 # how to use parenthesis in makefiles
95 LVM_VER
:= $(firstword $(subst $(leftparen
), ,$(LVM_VERSION
)))
96 VER
:= LVM2.
$(LVM_VER
)
98 FILE_VER
:= $(VER
).tgz
99 CLEAN_TARGETS
+= $(FILE_VER
)
100 CLEAN_DIRS
+= $(rpmbuilddir
)
103 @echo
"Generating $(FILE_VER)";\
104 (cd
$(top_srcdir
); git ls-tree
-r HEAD
--name-only | xargs
tar --transform
"s,^,$(VER)/," -c
) | gzip
>$(FILE_VER
)
107 $(RM
) -r
$(rpmbuilddir
)/SOURCES
108 $(MKDIR_P
) $(rpmbuilddir
)/SOURCES
109 $(LN_S
) -f
$(abs_top_builddir
)/$(FILE_VER
) $(rpmbuilddir
)/SOURCES
110 $(LN_S
) -f
$(abs_top_srcdir
)/spec
/build.inc
$(rpmbuilddir
)/SOURCES
111 $(LN_S
) -f
$(abs_top_srcdir
)/spec
/macros.inc
$(rpmbuilddir
)/SOURCES
112 $(LN_S
) -f
$(abs_top_srcdir
)/spec
/packages.inc
$(rpmbuilddir
)/SOURCES
113 DM_VER
=$$(cut
-d-
-f1
$(top_srcdir
)/VERSION_DM
);\
114 GIT_VER
=$$(cd
$(top_srcdir
); git describe | cut
-d-
--output-delimiter
=.
-f2
,3 || echo
0);\
115 $(SED
) -e
"s,\(device_mapper_version\) [0-9.]*$$,\1 $$DM_VER," \
116 -e
"s,^\(Version:[^0-9%]*\)[0-9.]*$$,\1 $(LVM_VER)," \
117 -e
"s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 $$GIT_VER," \
118 $(top_srcdir
)/spec
/source.inc
>$(rpmbuilddir
)/SOURCES
/source.inc
119 V
=$(V
) rpmbuild
-v
--define "_topdir $(rpmbuilddir)" -ba
$(top_srcdir
)/spec
/lvm2.spec
121 generate
: conf.generate man.generate
122 $(MAKE
) -C conf generate
123 $(MAKE
) -C man generate
126 $(MAKE
) -C man all_man
129 $(INSTALL_DIR
) $(DESTDIR
)$(DEFAULT_SYS_DIR
)
130 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_SYS_DIR
)/devices
131 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_ARCHIVE_DIR
)
132 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_BACKUP_DIR
)
133 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_CACHE_DIR
)
134 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_LOCK_DIR
)
135 $(INSTALL_ROOT_DIR
) $(DESTDIR
)$(DEFAULT_RUN_DIR
)
136 $(INSTALL_ROOT_DATA
) /dev
/null
$(DESTDIR
)$(DEFAULT_CACHE_DIR
)/.cache
139 $(MAKE
) -C scripts install_initscripts
141 install_systemd_generators
:
142 $(MAKE
) -C scripts install_systemd_generators
143 $(MAKE
) -C man install_systemd_generators
145 install_systemd_units
:
146 $(MAKE
) -C scripts install_systemd_units
149 $(MAKE
) -C man install_all_man
151 install_tmpfiles_configuration
:
152 $(MAKE
) -C scripts install_tmpfiles_configuration
155 @echo
-e
"\nAvailable targets:"
156 @echo
" all Default target."
157 @echo
" all_man Build all man pages with generators."
158 @echo
" clean Remove all compile files."
159 @echo
" device-mapper Device mapper part of lvm2."
160 @echo
" dist Generate distributable file."
161 @echo
" distclean Remove all build files."
162 @echo
" generate Generate man pages for sources."
163 @echo
" help Display callable targets."
164 @echo
" install Install all files."
165 @echo
" install_all_man Install all man pages."
166 @echo
" install_cluster Install cmirrord."
167 @echo
" install_device-mapper Install device mapper files."
168 @echo
" install_initscripts Install initialization scripts."
169 @echo
" install_lvm2 Install lvm2 files."
170 @echo
" install_systemd_units Install systemd units."
171 @echo
" lcov Generate lcov output."
172 @echo
" lcov-dated Generate lcov with timedate suffix."
173 @echo
" lcov-reset Reset lcov counters"
174 @echo
" man Build man pages."
175 @echo
" print-VARIABLE Resolve make variable."
176 @echo
" rpm Build rpm."
177 @echo
" run-unit-test Run unit tests."
178 @echo
" tags Generate c/etags."
180 ifneq ("$(LCOV)", "")
181 .PHONY
: lcov-reset lcov lcov-dated
183 ifeq ($(MAKECMDGOALS
),lcov-dated
)
184 LCOV_REPORTS_DIR
:= lcov_reports-
$(shell date
+%Y
%m
%d
%k
%M
%S
)
187 LCOV_REPORTS_DIR
:= lcov_reports
191 $(LCOV
) --zerocounters
--directory
$(top_builddir
)
193 ifneq ("$(GENHTML)", "")
195 $(RM
) -rf
$(LCOV_REPORTS_DIR
)
196 $(MKDIR_P
) $(LCOV_REPORTS_DIR
)
197 $(LCOV
) --capture
--directory
$(top_builddir
) --ignore-errors source \
198 --output-file
$(LCOV_REPORTS_DIR
)/out.
info
199 -test ! -s
$(LCOV_REPORTS_DIR
)/out.
info || \
200 $(GENHTML
) -o
$(LCOV_REPORTS_DIR
) --ignore-errors source \
201 $(LCOV_REPORTS_DIR
)/out.
info
206 ifneq ($(shell which ctags
2>/dev
/null
),)
209 test -z
"$(shell find $(addprefix $(top_srcdir)/,$(CSCOPE_DIRS)) -type f -name '*.[ch]' -newer tags 2>/dev/null | head -1)" ||
$(RM
) tags
210 test -f
tags || find
$(addprefix $(top_srcdir
)/,$(CSCOPE_DIRS
)) -maxdepth
5 -type f
-name
'*.[ch]' -exec ctags
-a
'{}' +
212 CLEAN_TARGETS
+= tags