]>
Commit | Line | Data |
---|---|---|
795ca3e5 | 1 | # |
6606c3ae | 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. |
e2c766d3 | 3 | # Copyright (C) 2004-2018 Red Hat, Inc. All rights reserved. |
795ca3e5 | 4 | # |
7f8f8bfa | 5 | # This file is part of LVM2. |
795ca3e5 | 6 | # |
6606c3ae AK |
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. | |
795ca3e5 | 10 | # |
6606c3ae AK |
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, | |
fcbef05a | 13 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
795ca3e5 AK |
14 | |
15 | srcdir = @srcdir@ | |
16 | top_srcdir = @top_srcdir@ | |
db8b5af9 | 17 | top_builddir = @top_builddir@ |
7de61533 ZK |
18 | abs_top_builddir = @abs_top_builddir@ |
19 | abs_top_srcdir = @abs_top_srcdir@ | |
795ca3e5 | 20 | |
aee0cd65 | 21 | SUBDIRS = libdm conf daemons include lib libdaemon man scripts tools |
69792976 | 22 | |
5d518f1f AK |
23 | ifeq ("@UDEV_RULES@", "yes") |
24 | SUBDIRS += udev | |
25 | endif | |
26 | ||
69792976 AK |
27 | ifeq ("@INTL@", "yes") |
28 | SUBDIRS += po | |
29 | endif | |
30 | ||
9b2be901 ZK |
31 | ifeq ($(MAKECMDGOALS),clean) |
32 | SUBDIRS += test | |
33 | endif | |
40dbaac8 | 34 | # FIXME Should use intermediate Makefiles here! |
5b82db9a | 35 | ifeq ($(MAKECMDGOALS),distclean) |
6d1ed225 | 36 | SUBDIRS = conf include man test scripts \ |
7126d8c2 | 37 | libdaemon lib tools daemons libdm \ |
ae961a19 | 38 | udev po |
895ee616 | 39 | tools.distclean: test.distclean |
5b82db9a | 40 | endif |
f8712c6c | 41 | DISTCLEAN_DIRS += lcov_reports* autom4te.cache |
e83968fa | 42 | DISTCLEAN_TARGETS += config.cache config.log config.status make.tmpl |
5b82db9a | 43 | |
795ca3e5 AK |
44 | include make.tmpl |
45 | ||
94237354 ZK |
46 | include $(top_srcdir)/base/Makefile |
47 | include $(top_srcdir)/device_mapper/Makefile | |
48 | include $(top_srcdir)/test/unit/Makefile | |
49 | ||
c1ab9fb3 | 50 | lib: include libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET) |
7126d8c2 | 51 | daemons: lib libdaemon tools |
94237354 ZK |
52 | scripts: lib |
53 | tools: lib libdaemon | |
b7edb5bf | 54 | po: tools daemons |
22457ed4 | 55 | man: tools |
c868562a | 56 | all_man: tools |
79b29613 | 57 | test: tools daemons |
5125629f | 58 | unit-test run-unit-test: test libdm |
751acb38 | 59 | |
d4b9af44 | 60 | daemons.device-mapper: libdm.device-mapper |
0782ad50 | 61 | tools.device-mapper: libdm.device-mapper |
a479de2e | 62 | device-mapper: tools.device-mapper daemons.device-mapper man.device-mapper |
5509e764 | 63 | device_mapper: device-mapper |
0782ad50 | 64 | |
69792976 AK |
65 | ifeq ("@INTL@", "yes") |
66 | lib.pofile: include.pofile | |
67 | tools.pofile: lib.pofile | |
d3c8211f | 68 | daemons.pofile: lib.pofile |
b7edb5bf | 69 | po.pofile: tools.pofile daemons.pofile |
69792976 AK |
70 | pofile: po.pofile |
71 | endif | |
751acb38 | 72 | |
b41f5924 ZK |
73 | ifneq ("$(CFLOW_CMD)", "") |
74 | tools.cflow: libdm.cflow lib.cflow | |
75 | daemons.cflow: tools.cflow | |
76 | cflow: include.cflow | |
8a2fc586 AK |
77 | endif |
78 | ||
2e84dd47 | 79 | CSCOPE_DIRS = base daemons device_mapper include lib libdaemon scripts tools libdm test |
8a2fc586 | 80 | ifneq ("@CSCOPE_CMD@", "") |
08db4eeb | 81 | cscope.out: |
9452e62e | 82 | @CSCOPE_CMD@ -b -R $(patsubst %,-s%,$(addprefix $(srcdir)/,$(CSCOPE_DIRS))) |
8a2fc586 AK |
83 | all: cscope.out |
84 | endif | |
08db4eeb | 85 | DISTCLEAN_TARGETS += cscope.out |
a8fc483c | 86 | CLEAN_DIRS += autom4te.cache |
f0f8fbc6 | 87 | |
117160b2 | 88 | check check_system check_cluster check_local check_lvmpolld check_lvmlockd_test check_lvmlockd_dlm check_lvmlockd_sanlock: test |
a2263de0 | 89 | $(MAKE) -C test $(@) |
fddafd51 | 90 | |
ca905681 | 91 | conf.generate man.generate: tools |
47ed4cdc | 92 | |
9c2a6de6 ZK |
93 | # how to use parenthesis in makefiles |
94 | leftparen:=( | |
95 | LVM_VER := $(firstword $(subst $(leftparen), ,$(LVM_VERSION))) | |
96 | VER := LVM2.$(LVM_VER) | |
97 | # release file name | |
98 | FILE_VER := $(VER).tgz | |
99 | CLEAN_TARGETS += $(FILE_VER) | |
100 | CLEAN_DIRS += $(rpmbuilddir) | |
7de61533 ZK |
101 | |
102 | dist: | |
9c2a6de6 ZK |
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) | |
7de61533 ZK |
105 | |
106 | rpm: dist | |
9c2a6de6 ZK |
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);\ | |
e080e35c | 115 | $(SED) -e "s,\(device_mapper_version\) [0-9.]*$$,\1 $$DM_VER," \ |
9c2a6de6 ZK |
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 | |
7df4a132 | 119 | V=$(V) rpmbuild -v --define "_topdir $(rpmbuilddir)" -ba $(top_srcdir)/spec/lvm2.spec |
7de61533 | 120 | |
ca905681 | 121 | generate: conf.generate man.generate |
47ed4cdc | 122 | $(MAKE) -C conf generate |
ca905681 | 123 | $(MAKE) -C man generate |
47ed4cdc | 124 | |
548c09ac AK |
125 | all_man: |
126 | $(MAKE) -C man all_man | |
127 | ||
3399ae32 | 128 | install_system_dirs: |
9cd9dab0 | 129 | $(INSTALL_DIR) $(DESTDIR)$(DEFAULT_SYS_DIR) |
ee31ba50 | 130 | $(INSTALL_ROOT_DIR) $(DESTDIR)$(DEFAULT_SYS_DIR)/devices |
3399ae32 AK |
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) | |
8bae0a1e | 135 | $(INSTALL_ROOT_DIR) $(DESTDIR)$(DEFAULT_RUN_DIR) |
3399ae32 AK |
136 | $(INSTALL_ROOT_DATA) /dev/null $(DESTDIR)$(DEFAULT_CACHE_DIR)/.cache |
137 | ||
e2c766d3 | 138 | install_initscripts: |
3e730d47 AK |
139 | $(MAKE) -C scripts install_initscripts |
140 | ||
fa68466e PR |
141 | install_systemd_generators: |
142 | $(MAKE) -C scripts install_systemd_generators | |
031666ef | 143 | $(MAKE) -C man install_systemd_generators |
fa68466e | 144 | |
395d204d PR |
145 | install_systemd_units: |
146 | $(MAKE) -C scripts install_systemd_units | |
147 | ||
548c09ac AK |
148 | install_all_man: |
149 | $(MAKE) -C man install_all_man | |
cc17210b | 150 | |
4417a8bd PR |
151 | install_tmpfiles_configuration: |
152 | $(MAKE) -C scripts install_tmpfiles_configuration | |
153 | ||
9d190d6b ZK |
154 | help: |
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." | |
31076942 | 175 | @echo " print-VARIABLE Resolve make variable." |
9d190d6b ZK |
176 | @echo " rpm Build rpm." |
177 | @echo " run-unit-test Run unit tests." | |
178 | @echo " tags Generate c/etags." | |
179 | ||
a6fd0319 | 180 | ifneq ("$(LCOV)", "") |
483ed8f7 | 181 | .PHONY: lcov-reset lcov lcov-dated |
fddafd51 | 182 | |
5556819a | 183 | ifeq ($(MAKECMDGOALS),lcov-dated) |
6a27e819 ZK |
184 | LCOV_REPORTS_DIR := lcov_reports-$(shell date +%Y%m%d%k%M%S) |
185 | lcov-dated: lcov | |
5556819a | 186 | else |
6a27e819 | 187 | LCOV_REPORTS_DIR := lcov_reports |
5556819a | 188 | endif |
fddafd51 | 189 | |
5556819a | 190 | lcov-reset: |
483ed8f7 | 191 | $(LCOV) --zerocounters --directory $(top_builddir) |
fddafd51 | 192 | |
a6fd0319 | 193 | ifneq ("$(GENHTML)", "") |
483ed8f7 ZK |
194 | lcov: |
195 | $(RM) -rf $(LCOV_REPORTS_DIR) | |
6a27e819 | 196 | $(MKDIR_P) $(LCOV_REPORTS_DIR) |
2b864aeb | 197 | $(LCOV) --capture --directory $(top_builddir) --ignore-errors source \ |
7fb280ce ZK |
198 | --output-file $(LCOV_REPORTS_DIR)/out.info |
199 | -test ! -s $(LCOV_REPORTS_DIR)/out.info || \ | |
2b864aeb | 200 | $(GENHTML) -o $(LCOV_REPORTS_DIR) --ignore-errors source \ |
7fb280ce | 201 | $(LCOV_REPORTS_DIR)/out.info |
fddafd51 ZK |
202 | endif |
203 | ||
fddafd51 | 204 | endif |
1033d120 | 205 | |
a1e5b883 | 206 | ifneq ($(shell which ctags 2>/dev/null),) |
beb65056 | 207 | .PHONY: tags |
beb65056 | 208 | tags: |
2e84dd47 ZK |
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 '{}' + | |
beb65056 | 211 | |
acfc5695 | 212 | CLEAN_TARGETS += tags |
beb65056 | 213 | endif |