]> sourceware.org Git - lvm2.git/blame - make.tmpl.in
devices: fix dev_dm_uuid
[lvm2.git] / make.tmpl.in
CommitLineData
795ca3e5
AK
1# @configure_input@
2#
6606c3ae 3# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
93c2614e 4# Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
795ca3e5 5#
7f8f8bfa 6# This file is part of LVM2.
795ca3e5 7#
6606c3ae
AK
8# This copyrighted material is made available to anyone wishing to use,
9# modify, copy, or redistribute it subject to the terms and conditions
10# of the GNU General Public License v.2.
795ca3e5 11#
6606c3ae
AK
12# You should have received a copy of the GNU General Public License
13# along with this program; if not, write to the Free Software Foundation,
fcbef05a 14# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
795ca3e5 15
fa58fc32 16
2c7b9130
ZK
17V ?= $(if ("@SILENT_RULES@","yes"),,1)
18Q := $(if $(V),,@)
19SHOW := $(if $(V),@true,@echo)
7a475bef 20
25c841af 21SHELL = @SHELL@
795ca3e5
AK
22
23@SET_MAKE@
24
36c5bb40
AK
25# Allow environment to override any built-in default value for CC.
26# If there is a built-in default, CC is NOT set to @CC@ here.
f42b2d4b 27CC ?= @CC@
36c5bb40
AK
28
29# If $(CC) holds the usual built-in default value of 'cc' then replace it with
30# the configured value.
31# (To avoid this and force the use of 'cc' from the environment, supply its
32# full path.)
33ifeq ($(CC), cc)
34 CC = @CC@
35endif
36
795ca3e5 37RANLIB = @RANLIB@
795ca3e5 38INSTALL = @INSTALL@
5556819a 39MKDIR_P = @MKDIR_P@
69792976 40MSGFMT = @MSGFMT@
5556819a
AK
41LCOV = @LCOV@
42GENHTML = @GENHTML@
795ca3e5 43LN_S = @LN_S@
5951ef33 44SED = @SED@
87d73a9b 45CFLOW_CMD = @CFLOW_CMD@
aaa2e046 46AWK = @AWK@
5987562c 47CHMOD = @CHMOD@
fc0e4929
ZK
48EGREP = @EGREP@
49GREP = @GREP@
50SORT = @SORT@
51WC = @WC@
4b4a210e 52AR = @AR@
1dc1a1ce 53RM = rm -f
fc0e4929 54
5987562c
AK
55PYTHON2 = @PYTHON2@
56PYTHON3 = @PYTHON3@
57PYCOMPILE = $(top_srcdir)/autoconf/py-compile
5951ef33 58
aee0cd65 59LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(RT_LIBS) $(M_LIBS)
d106ac04 60LVMLIBS = $(DMEVENT_LIBS) $(READLINE_LIBS) $(EDITLINE_LIBS) $(LIBSYSTEMD_LIBS) $(BLKID_LIBS) $(AIO_LIBS) $(LIBS)
f8f6ec92 61# Extra libraries always linked with static binaries
c8868041 62STATIC_LIBS = $(PTHREAD_LIBS) $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS) $(M_LIBS)
72b2cb61 63DEFS += @DEFS@
d13e87b9 64# FIXME set this only where it's needed, not globally?
6fb2552e 65CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
4791a4fc 66CPPFLAGS ?= @CPPFLAGS@
2232e82d 67LDFLAGS ?= @LDFLAGS@
86ac529b 68STATIC_LDFLAGS += @STATIC_LDFLAGS@
84510264 69CLDFLAGS += @CLDFLAGS@
bf09a320 70ELDFLAGS += @ELDFLAGS@
80992638 71LDDEPS += @LDDEPS@
e4c11ad1 72LIB_SUFFIX = @LIB_SUFFIX@
b73e1cd4
ZK
73USE_TRACKING = @USE_TRACKING@
74
19a2c6e0 75DL_LIBS = @DL_LIBS@
92b53a80 76RT_LIBS = @RT_LIBS@
c1bd76d6 77M_LIBS = @M_LIBS@
57b5bc9c 78AIO_CFLAGS = @AIO_CFLAGS@
b73e1cd4
ZK
79AIO_LIBS = @AIO_LIBS@
80BLKID_CFLAGS = @BLKID_CFLAGS@
81BLKID_LIBS = @BLKID_LIBS@
c8868041 82BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
b73e1cd4
ZK
83CPG_CFLAGS = @CPG_CFLAGS@
84CPG_LIBS = @CPG_LIBS@
85EDITLINE_CFLAGS = @EDITLINE_CFLAGS@
86EDITLINE_LIBS = @EDITLINE_LIBS@
c23d09bb
ZK
87LIBDLM_CFLAGS = @LIBDLM_CFLAGS@
88LIBDLM_LIBS = @LIBDLM_LIBS@
89LIBDLMCONTROL_CFLAGS = @LIBDLMCONTROL_CFLAGS@
90LIBDLMCONTROL_LIBS = @LIBDLMCONTROL_LIBS@
91LIBSANLOCKCLIENT_CFLAGS = @LIBSANLOCKCLIENT_CFLAGS@
92LIBSANLOCKCLIENT_LIBS = @LIBSANLOCKCLIENT_LIBS@
93LIBSEAGATEILM_CFLAGS = @LIBSEAGATEILM_CFLAGS@
94LIBSEAGATEILM_LIBS = @LIBSEAGATEILM_LIBS@
d106ac04
ZK
95LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@
96LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@
f30875db 97PTHREAD_LIBS = @PTHREAD_LIBS@
b73e1cd4 98READLINE_CFLAGS = @READLINE_CFLAGS@
539f4a77 99READLINE_LIBS = @READLINE_LIBS@
f8f6ec92 100SELINUX_LIBS = @SELINUX_LIBS@
c8868041 101SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
7a595d73 102UDEV_CFLAGS = @UDEV_CFLAGS@
db724a44 103UDEV_LIBS = @UDEV_LIBS@
c8868041 104UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
d571eab3 105VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
b73e1cd4 106VALGRIND_LIBS = @VALGRIND_LIBS@
795ca3e5
AK
107
108# Setup directory variables
639c84c1
AK
109prefix = @prefix@
110exec_prefix = @exec_prefix@
5d518f1f 111udev_prefix = @udev_prefix@
4417a8bd 112sysconfdir = @sysconfdir@
ee3cfa41 113rootdir = $(DESTDIR)/
639c84c1 114bindir = $(DESTDIR)@bindir@
c6a6ce6c 115confdir = $(DESTDIR)@CONFDIR@/lvm
4547218a 116profiledir = $(confdir)/@DEFAULT_PROFILE_SUBDIR@
84510264 117includedir = $(DESTDIR)@includedir@
639c84c1 118libdir = $(DESTDIR)@libdir@
9d6a92b4 119libexecdir = $(DESTDIR)@libexecdir@
68f2de6d 120usrlibdir = $(DESTDIR)@usrlibdir@
639c84c1 121sbindir = $(DESTDIR)@sbindir@
68f2de6d 122usrsbindir = $(DESTDIR)@usrsbindir@
bf75c304 123datarootdir = @datarootdir@
7f8d9422 124datadir = $(DESTDIR)@datadir@
bf75c304
AK
125infodir = $(DESTDIR)@infodir@
126mandir = $(DESTDIR)@mandir@
dc49e1cd 127localedir = $(DESTDIR)@localedir@
0a62c911 128staticdir = $(DESTDIR)@STATICDIR@
5d518f1f 129udevdir = $(DESTDIR)@udevdir@
fff111fe 130pkgconfigdir = $(usrlibdir)/pkgconfig
4417a8bd 131initdir = $(DESTDIR)$(sysconfdir)/rc.d/init.d
5987562c
AK
132dbusconfdir = $(DESTDIR)$(sysconfdir)/dbus-1/system.d
133dbusservicedir = $(datadir)/dbus-1/system-services
fa68466e 134systemd_unit_dir = $(DESTDIR)@systemdsystemunitdir@
a31ab7c1 135systemd_generator_dir = $(DESTDIR)$(SYSTEMD_GENERATOR_DIR)
fd41dd8f 136systemd_dir = $(DESTDIR)@systemdutildir@
4417a8bd 137tmpfiles_dir = $(DESTDIR)@tmpfilesdir@
349da06c 138ocf_scriptdir = $(DESTDIR)@OCFDIR@
85b43664 139PYTHON_PREFIX = $(prefix)
5987562c
AK
140
141# N.B. No $(DESTDIR) prefix here.
142python2dir = @PYTHON2DIR@
143python3dir = @PYTHON3DIR@
afcae066 144
2c7b9130
ZK
145# Define macro NewLine for use in $(foreach) with 2 blank lines
146ifeq (1, $(firstword $(V)))
147define newline
148
149
150endef
151else
152define newline
153;
154endef
155endif
156
5227ae53 157USRLIB_RELPATH = $(shell echo $(abspath $(usrlibdir) $(libdir)) | \
aaa2e046 158 $(AWK) -f $(top_srcdir)/scripts/relpath.awk)
795ca3e5 159
a31ab7c1 160SYSTEMD_GENERATOR_DIR = @systemdutildir@/system-generators
3399ae32
AK
161DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@
162DEFAULT_ARCHIVE_DIR = $(DEFAULT_SYS_DIR)/@DEFAULT_ARCHIVE_SUBDIR@
163DEFAULT_BACKUP_DIR = $(DEFAULT_SYS_DIR)/@DEFAULT_BACKUP_SUBDIR@
164DEFAULT_CACHE_DIR = $(DEFAULT_SYS_DIR)/@DEFAULT_CACHE_SUBDIR@
21554ab5 165DEFAULT_PROFILE_DIR = $(DEFAULT_SYS_DIR)/@DEFAULT_PROFILE_SUBDIR@
3399ae32 166DEFAULT_LOCK_DIR = @DEFAULT_LOCK_DIR@
1fad9a68 167DEFAULT_RUN_DIR = @DEFAULT_RUN_DIR@
c1b5f38b 168DEFAULT_PID_DIR = @DEFAULT_PID_DIR@
93c2614e 169DEFAULT_MANGLING = @MANGLING@
a9d7a9d1 170DEFAULT_DMEVENTD_EXIT_ON_PATH = @DEFAULT_DMEVENTD_EXIT_ON_PATH@
3399ae32 171
2c7b9130
ZK
172#----------------------------------------------------------------------
173# From http://blog.melski.net/tag/debugging-makefiles/
174#
175# Usage: make print-CC print-CXX print-LD
176#----------------------------------------------------------------------
177print-%:
178 @echo '$*=$($*)'
179 @echo ' origin = $(origin $*)'
180 @echo ' flavor = $(flavor $*)'
181 @echo ' value = $(value $*)'
182
c737d348
ZK
183# Setup vpath search paths for some suffixes
184vpath %.c $(srcdir)
bf1f22cc 185vpath %.cpp $(srcdir)
c737d348
ZK
186vpath %.in $(srcdir)
187vpath %.po $(srcdir)
188vpath %.exported_symbols $(srcdir)
189
2c44337b 190interface = @interface@
aee0cd65 191interfacebuilddir = $(top_builddir)/libdm/$(interface)
a8fc483c 192rpmbuilddir = $(abs_top_builddir)/build
2c44337b 193
795ca3e5
AK
194# The number of jobs to run, if blank, defaults to the make standard
195ifndef MAKEFLAGS
196MAKEFLAGS = @JOBS@
197endif
198
3a58e08b
ZK
199# Hiding dir entering makes hard for editors to look for files
200#ifneq (1, $(firstword $(V)))
201#MAKEFLAGS += --no-print-directory
202#endif
2c7b9130 203
23b059e7
ZK
204# Handle installation of files
205ifeq ("@WRITE_INSTALL@", "yes")
206# leaving defaults
7171260b 207M_INSTALL_SCRIPT = -m 755
23b059e7
ZK
208M_INSTALL_DATA = -m 644
209else
210M_INSTALL_PROGRAM = -m 555
211M_INSTALL_DATA = -m 444
212endif
213INSTALL_PROGRAM = $(INSTALL) $(M_INSTALL_PROGRAM) $(STRIP)
214INSTALL_DATA = $(INSTALL) -p $(M_INSTALL_DATA)
215INSTALL_WDATA = $(INSTALL) -p -m 644
216
a532faa7
ZK
217INSTALL_DIR = $(INSTALL) -m 755 -d
218INSTALL_ROOT_DIR = $(INSTALL) -m 700 -d
219INSTALL_ROOT_DATA = $(INSTALL) -m 600
85409909 220INSTALL_SCRIPT = $(INSTALL) -p $(M_INSTALL_PROGRAM)
3399ae32 221
1dc1a1ce 222.SUFFIXES:
bf1f22cc 223.SUFFIXES: .c .cpp .d .o .so .a .po .pot .mo .dylib
795ca3e5 224
918e867a 225ifeq ("$(notdir $(CC))", "gcc")
e7e499e8
ZK
226WFLAGS +=\
227 -Wall\
228 -Wcast-align\
229 -Wfloat-equal\
230 -Wformat-security\
231 -Winline\
e7e499e8
ZK
232 -Wmissing-format-attribute\
233 -Wmissing-include-dirs\
234 -Wmissing-noreturn\
235 -Wpointer-arith\
236 -Wredundant-decls\
237 -Wshadow\
238 -Wundef\
e7e499e8
ZK
239 -Wwrite-strings
240
241WCFLAGS +=\
c6d96efc 242 -Wmissing-declarations\
e7e499e8
ZK
243 -Wmissing-prototypes\
244 -Wnested-externs\
245 -Wold-style-definition\
c6d96efc
ZK
246 -Wstrict-prototypes\
247 -Wuninitialized
c9c23d41 248
d95751cb 249ifeq ("@HAVE_WJUMP@", "yes")
e7e499e8 250WCFLAGS += -Wjump-misses-init
d95751cb
ZK
251endif
252
7943a131 253ifeq ("@HAVE_WCLOBBERED@", "yes")
e7e499e8
ZK
254WFLAGS +=\
255 -Wclobbered\
256 -Wempty-body\
257 -Wignored-qualifiers\
258 -Wlogical-op\
259 -Wtype-limits
260
261WCFLAGS +=\
262 -Wmissing-parameter-type\
263 -Wold-style-declaration\
264 -Woverride-init
0982c5c7
ZK
265endif
266
267ifeq ("@HAVE_WSYNCNAND@", "yes")
268WFLAGS += -Wsync-nand
7943a131 269endif
918e867a 270endif
7943a131 271
a65ab773 272ifeq ("@HAVE_FULL_RELRO@", "yes")
b14f29ab 273comma := ,
a8009f72 274ifneq ("@STATIC_LINK@", "yes")
b14f29ab 275ifeq (,$(findstring -z$(comma)relro,$(LDFLAGS)))
a8009f72
ZK
276 LDFLAGS += -Wl,-z,relro
277endif
b14f29ab 278ifeq (,$(findstring -z$(comma)now,$(LDFLAGS)))
a8009f72
ZK
279 LDFLAGS += -Wl,-z,now
280endif
b0c0e8bd
ZK
281# TODO: think about configure option for this flag
282# for now leave decision on distro maitainer
283#ifeq (,$(findstring -z$(comma)pack-relative-relocs,$(LDFLAGS)))
284# LDFLAGS += -Wl,-z,pack-relative-relocs
285#endif
a8009f72
ZK
286# For systems with old readline library that requires extra libs to link with
287# we stick to default --no-as-needed and we avoid adding --as-needed flag
b0c0e8bd 288ifneq (-l,$(findstring -l,$(filter-out %readline,$(READLINE_LIBS))))
a8009f72
ZK
289ifeq (,$(findstring --as-needed,$(LDFLAGS)))
290 LDFLAGS += -Wl,--as-needed
07844565 291endif
a65ab773 292endif
07844565
ZK
293
294ifeq ("@HAVE_PIE@", "yes")
295 EXTRA_EXEC_CFLAGS += -fPIE
296 EXTRA_EXEC_LDFLAGS += -pie -fPIE
a65ab773
PR
297endif
298endif
a8009f72 299endif
a65ab773 300
c9c23d41 301#WFLAGS += -W -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
e7e499e8 302#WFLAGS += -Wsign-compare -Wunused-parameter -Wmissing-field-initializers
c9c23d41 303#WFLAGS += -Wconversion -Wbad-function-cast -Wcast-qual -Waggregate-return -Wpacked
4b795cc3
ZK
304#WFLAGS += -pedantic -std=gnu99
305#DEFS += -DDEBUG_CRC32
8ef2b021 306
6fb2552e
ZK
307#
308# Avoid recursive extension of CFLAGS
309# by checking whether CFLAGS already has fPIC string
310#
311ifeq (,$(findstring fPIC,$(CFLAGS)))
312
313CFLAGS += -fPIC
8ce0cbda 314
8ef2b021 315ifeq ("@DEBUG@", "yes")
2232e82d
ZK
316ifeq (,$(findstring -g,$(CFLAGS)))
317 CFLAGS += -g
318endif
319 CFLAGS += -fno-omit-frame-pointer
8a2fc586 320 DEFS += -DDEBUG
81d19574 321 # memory debugging is not thread-safe yet
9dc1f51d 322 ifneq ("@BUILD_DMEVENTD@", "yes")
9dc1f51d
ZK
323 ifneq ("@BUILD_LVMLOCKD@", "yes")
324 ifneq ("@BUILD_LVMPOLLD@", "yes")
81d19574
MB
325 DEFS += -DDEBUG_MEM
326 endif
2232e82d
ZK
327 endif
328 endif
8ef2b021 329endif
03a8a07d 330
6fb2552e
ZK
331# end of fPIC protection
332endif
333
95dd5bc7 334ifeq ("@BUILD_DMEVENTD@", "yes")
cbfdb873 335 DMEVENT_LIBS = -L$(top_builddir)/daemons/dmeventd -ldevmapper-event -L$(interfacebuilddir) -ldevmapper
a479de2e
AK
336endif
337
aec5e573 338# Combination of DEBUG_POOL and DEBUG_ENFORCE_POOL_LOCKING is not supported.
8a2fc586 339#DEFS += -DDEBUG_POOL
ed463ccf
ZK
340# Default pool locking is using the crc checksum. With mprotect memory
341# enforcing compilation faulty memory write could be easily found.
342#DEFS += -DDEBUG_ENFORCE_POOL_LOCKING
8a2fc586 343#DEFS += -DBOUNDS_CHECK
84510264 344
6d21438d
ZK
345# LVM is not supposed to use mmap while devices are suspended.
346# This code causes a core dump if gets called.
347#DEFS += -DDEBUG_MEMLOCK
348
84510264 349#CFLAGS += -pg
80992638 350#LDFLAGS += -pg
84510264
AK
351
352STRIP=
353#STRIP = -s
8ef2b021 354
5951ef33
AK
355LVM_VERSION := $(shell cat $(top_srcdir)/VERSION)
356
047f82ee 357LIB_VERSION_LVM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION)
2c44337b 358
047f82ee 359LIB_VERSION_DM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION_DM)
5a52dca9 360
047f82ee 361LIB_VERSION_APP := $(shell $(AWK) -F '[(). ]' '{printf "%s.%s",$$1,$$4}' $(top_srcdir)/VERSION)
bf456146 362
18aa541c 363INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include -include configure.h
5c878167 364
4a90b0c4 365#VDO_INCLUDES=-I@VDO_INCLUDE@
5c878167 366
db8b5af9 367DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
6846af66 368 $(top_builddir)/Makefile
14c61d2d 369
bf1f22cc 370OBJECTS = $(SOURCES:%.c=%.o) $(CXXSOURCES:%.cpp=%.o)
84510264 371POTFILES = $(SOURCES:%.c=%.pot)
795ca3e5 372
7cbd4a74
ZK
373.PHONY: all pofile distclean clean cleandir cflow device-mapper
374.PHONY: install install_cluster install_device-mapper install_lvm2
5987562c 375.PHONY: install_dbus_service
180b3dea 376.PHONY: install_lib_shared install_dm_plugin install_lvm2_plugin
548c09ac 377.PHONY: install_ocf install_systemd_generators install_all_man all_man man help
ee3cfa41 378.PHONY: python_bindings install_python_bindings
cab8ea7c 379.PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
8a2fc586 380.PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow)
0782ad50 381.PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper)
47ed4cdc 382.PHONY: $(SUBDIRS.generate) generate
cab8ea7c 383
0782ad50 384SUBDIRS.device-mapper := $(SUBDIRS:=.device-mapper)
795ca3e5 385SUBDIRS.install := $(SUBDIRS:=.install)
cab8ea7c 386SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster)
0782ad50 387SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper)
0b502933 388SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2)
e40d44be 389SUBDIRS.install_ocf := $(SUBDIRS:=.install_ocf)
69792976 390SUBDIRS.pofile := $(SUBDIRS:=.pofile)
8a2fc586 391SUBDIRS.cflow := $(SUBDIRS:=.cflow)
795ca3e5
AK
392SUBDIRS.clean := $(SUBDIRS:=.clean)
393SUBDIRS.distclean := $(SUBDIRS:=.distclean)
394
b1624753 395TARGETS += $(LIB_STATIC)
dc8837f0
AJ
396ifeq ("@SHARED_LINK@", "yes")
397 TARGETS += $(LIB_SHARED)
398endif
d68a82ec 399
94237354
ZK
400INTERNAL_LIBS = \
401 $(top_builddir)/libdaemon/client/libdaemonclient.a \
232918fb
JT
402 $(top_builddir)/device_mapper/libdevice-mapper.a \
403 $(top_builddir)/base/libbase.a
94237354
ZK
404LVMINTERNAL_LIBS = $(top_builddir)/lib/liblvm-internal.a $(INTERNAL_LIBS)
405
406all: $(SUBDIRS) $(TARGETS)
795ca3e5 407
da29afe0
ZK
408install: $(SUBDIRS.install)
409install_cluster: $(SUBDIRS.install_cluster)
0782ad50 410install_device-mapper: $(SUBDIRS.install_device-mapper)
5509e764 411install_device_mapper: install_device-mapper
0b502933 412install_lvm2: $(SUBDIRS.install_lvm2)
e40d44be 413install_ocf: $(SUBDIRS.install_ocf)
b41f5924 414cflow: $(SUBDIRS.cflow)
795ca3e5 415
94237354 416$(SUBDIRS): $(SUBDIRS.device-mapper)
795ca3e5
AK
417 $(MAKE) -C $@
418
0782ad50
AK
419$(SUBDIRS.device-mapper):
420 $(MAKE) -C $(@:.device-mapper=) device-mapper
421
3ba1348c 422$(SUBDIRS.install): $(SUBDIRS)
795ca3e5
AK
423 $(MAKE) -C $(@:.install=) install
424
cab8ea7c
AK
425$(SUBDIRS.install_cluster): $(SUBDIRS)
426 $(MAKE) -C $(@:.install_cluster=) install_cluster
427
77b69aa7 428$(SUBDIRS.install_device-mapper): device-mapper
0782ad50
AK
429 $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper
430
0b502933
MB
431$(SUBDIRS.install_lvm2): $(SUBDIRS)
432 $(MAKE) -C $(@:.install_lvm2=) install_lvm2
433
e40d44be
ZK
434$(SUBDIRS.install_ocf):
435 $(MAKE) -C $(@:.install_ocf=) install_ocf
436
795ca3e5 437$(SUBDIRS.clean):
5a52dca9 438 -$(MAKE) -C $(@:.clean=) clean
795ca3e5
AK
439
440$(SUBDIRS.distclean):
5a52dca9 441 -$(MAKE) -C $(@:.distclean=) distclean
795ca3e5 442
b41f5924
ZK
443$(SUBDIRS.cflow):
444 $(MAKE) -C $(@:.cflow=) cflow
445
69792976
AK
446ifeq ("@INTL@", "yes")
447pofile: $(SUBDIRS.pofile) $(POTFILES)
448
449$(SUBDIRS.pofile):
450 $(MAKE) -C $(@:.pofile=) pofile
451endif
452
47ed4cdc
DT
453$(SUBDIRS.generate):
454 $(MAKE) -C $(@:.generate=) generate
455
b41f5924
ZK
456ifneq ("$(CFLOW_LIST_TARGET)", "")
457CLEAN_CFLOW += $(CFLOW_LIST_TARGET)
458$(CFLOW_LIST_TARGET): $(CFLOW_LIST)
3d26bde1 459 echo "CFLOW_SOURCES += $(addprefix $(abs_srcdir)/, $(CFLOW_LIST))" > $@
b41f5924
ZK
460cflow: $(CFLOW_LIST_TARGET)
461endif
8a2fc586 462
b41f5924
ZK
463ifneq ("$(CFLOW_TARGET)", "")
464CLEAN_CFLOW += \
465 $(CFLOW_TARGET).cflow \
466 $(CFLOW_TARGET).xref \
467 $(CFLOW_TARGET).tree \
468 $(CFLOW_TARGET).rtree \
469 $(CFLOW_TARGET).rxref
470
471ifneq ("$(CFLOW_CMD)", "")
472CFLOW_FLAGS +=\
3d26bde1 473 --cpp="$(CC) -E $(INCLUDES) $(VALGRIND_CFLAGS) $(BLKID_CFLAGS) $(DEFS)" \
b41f5924 474 --symbol _ISbit:wrapper \
f370cda7 475 --symbol __asm__:wrapper \
b41f5924 476 --symbol __attribute__:wrapper \
f370cda7
ZK
477 --symbol __inline:=inline \
478 --symbol __inline__:=inline \
b41f5924 479 --symbol __const:type \
3d26bde1 480 --symbol __const__:wrapper \
b41f5924 481 --symbol __extension__:wrapper \
3d26bde1 482 --symbol __leaf__:wrapper \
b41f5924
ZK
483 --symbol __nonnull:wrapper \
484 --symbol __nothrow__:wrapper \
485 --symbol __pure__:wrapper \
486 --symbol __REDIRECT:wrapper \
487 --symbol __REDIRECT_NTH:wrapper \
f370cda7 488 --symbol __restrict:=restrict \
3d26bde1 489 --symbol __wur:wrapper
b41f5924
ZK
490
491$(CFLOW_TARGET).cflow: $(CFLOW_SOURCES)
492 $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) $(CFLOW_SOURCES)
493$(CFLOW_TARGET).rxref: $(CFLOW_SOURCES)
494 $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) -r --omit-arguments $(CFLOW_SOURCES)
495$(CFLOW_TARGET).tree: $(CFLOW_SOURCES)
496 $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) --omit-arguments -T -b $(CFLOW_SOURCES)
497$(CFLOW_TARGET).xref: $(CFLOW_SOURCES)
498 $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) --omit-arguments -x $(CFLOW_SOURCES)
499#$(CFLOW_TARGET).rtree: $(CFLOW_SOURCES)
500# $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) -r --omit-arguments -T -b $(CFLOW_SOURCES)
501cflow: $(CFLOW_TARGET).cflow $(CFLOW_TARGET).tree $(CFLOW_TARGET).rxref $(CFLOW_TARGET).xref
502#$(CFLOW_TARGET).rtree
503endif
8a2fc586
AK
504endif
505
1dc1a1ce
AK
506.LIBPATTERNS = lib%.so lib%.a
507
6846af66
ZK
508DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
509
972b5352
JT
510# still needed in 2018 for 32bit builds
511DEFS+=-D_FILE_OFFSET_BITS=64
512
6846af66 513%.o: %.c $(DEPS)
88ad83e3 514 $(SHOW) " [CC] $(<F)"
48d04afa 515 @mkdir -p $(@D)
4791a4fc 516 $(Q) $(CC) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $(CPPFLAGS) $< -o $@
795ca3e5 517
6846af66 518%.o: %.cpp $(DEPS)
88ad83e3 519 $(SHOW) " [CXX] $(<F)"
48d04afa 520 @mkdir -p $(@D)
ebf33323 521 $(Q) $(CXX) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(CXXFLAGS) $(CXXFLAGS_$@) $< -o $@
bf1f22cc 522
48d04afa 523%.pot: %.c $(DEPS)
88ad83e3 524 $(SHOW) " [CC] $(<F)"
48d04afa 525 @mkdir -p $(@D)
4791a4fc 526 $(Q) $(CC) -E $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) -include $(top_builddir)/po/pogen.h $(DEFS) $(WFLAGS) $(CFLAGS) $(CPPFLAGS) $< >$@
69792976 527
5a52dca9 528%.so: %.o
88ad83e3 529 $(SHOW) " [CC] $(<F)"
f022da9e 530 $(Q) $(CC) -c $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $< $(LIBS) -o $@
5a52dca9 531
23b059e7
ZK
532ifneq (,$(LIB_SHARED))
533
534TARGETS += $(LIB_SHARED).$(LIB_VERSION)
535$(LIB_SHARED).$(LIB_VERSION): $(OBJECTS) $(LDDEPS)
88ad83e3 536 $(SHOW) " [CC] $@"
e4c11ad1 537ifeq ("@LIB_SUFFIX@","so")
7a475bef 538 $(Q) $(CC) -shared -Wl,-soname,$(notdir $@) \
f022da9e 539 $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
e4c11ad1 540endif
e4c11ad1 541ifeq ("@LIB_SUFFIX@","dylib")
7a475bef 542 $(Q) $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \
f022da9e 543 $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
23b059e7
ZK
544endif
545
546$(LIB_SHARED): $(LIB_SHARED).$(LIB_VERSION)
88ad83e3 547 $(SHOW) " [LN] $@"
7a475bef 548 $(Q) $(LN_S) -f $(<F) $@
23b059e7 549
30c3bbcd
ZK
550CLEAN_TARGETS += $(LDDEPS) .exported_symbols_generated
551
23b059e7 552install_lib_shared: $(LIB_SHARED)
88ad83e3 553 $(SHOW) " [INSTALL] $<"
7a475bef
JT
554 $(Q) $(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION)
555 $(Q) $(INSTALL_DIR) $(usrlibdir)
556 $(Q) $(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
23b059e7 557
e7e499e8 558# FIXME: plugins are installed to subdirs
180b3dea
ZK
559# and for compatibility links in libdir are created
560# when the code is fixed links could be removed.
561install_dm_plugin: $(LIB_SHARED)
88ad83e3 562 $(SHOW) " [INSTALL] $<"
7a475bef
JT
563 $(Q) $(INSTALL_PROGRAM) -D $< $(libdir)/device-mapper/$(<F)
564 $(Q) $(LN_S) -f device-mapper/$(<F) $(libdir)/$(<F)
180b3dea
ZK
565
566install_lvm2_plugin: $(LIB_SHARED)
88ad83e3 567 $(SHOW) " [INSTALL] $<"
7a475bef
JT
568 $(Q) $(INSTALL_PROGRAM) -D $< $(libdir)/lvm2/$(<F)
569 $(Q) $(LN_S) -f lvm2/$(<F) $(libdir)/$(<F)
570 $(Q) $(LN_S) -f $(<F) $(libdir)/$(<F).$(LIB_VERSION)
e4c11ad1 571endif
84510264
AK
572
573$(LIB_STATIC): $(OBJECTS)
88ad83e3 574 $(SHOW) " [AR] $@"
7a475bef
JT
575 $(Q) $(RM) $@
576 $(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
5a52dca9 577
6846af66
ZK
578%.d:
579.PRECIOUS: %.d
29abba37 580
69792976 581%.mo: %.po
88ad83e3 582 $(SHOW) " [MSGFMT] $(<F)"
7a475bef 583 $(Q) $(MSGFMT) -o $@ $<
69792976 584
30c3bbcd
ZK
585CLEAN_TARGETS += \
586 $(SOURCES:%.c=%.d) $(SOURCES:%.c=%.gcno) $(SOURCES:%.c=%.gcda) \
587 $(SOURCES2:%.c=%.o) $(SOURCES2:%.c=%.d) $(SOURCES2:%.c=%.gcno) $(SOURCES2:%.c=%.gcda) \
588 $(POTFILES) $(CLEAN_CFLOW)
589
7cbd4a74 590cleandir:
88ad83e3 591 $(SHOW) " [CLEANDIR]"
30c3bbcd 592ifneq (,$(firstword $(CLEAN_DIRS)))
ceb2f0ad 593 $(Q) $(RM) -r $(CLEAN_DIRS)
30c3bbcd 594endif
ceb2f0ad 595 $(Q) $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) core
795ca3e5 596
7cbd4a74
ZK
597clean: $(SUBDIRS.clean) cleandir
598
599distclean: cleandir $(SUBDIRS.distclean)
88ad83e3 600 $(SHOW) " [DISTCLEAN]"
30c3bbcd 601ifneq (,$(firstword $(DISTCLEAN_DIRS)))
ceb2f0ad 602 $(Q) $(RM) -r $(DISTCLEAN_DIRS)
30c3bbcd 603endif
ceb2f0ad 604 $(Q) $(RM) $(DISTCLEAN_TARGETS) Makefile
84510264 605
797c18d5 606.exported_symbols_generated: $(EXPORTED_HEADER) .exported_symbols $(DEPS)
7a475bef 607 $(Q) set -e; \
8b205571 608 ( cat $(srcdir)/.exported_symbols; \
bf2b1986 609 if test -n "$(EXPORTED_HEADER)"; then \
4b795cc3 610 $(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
2e4a66a7 611 $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
8b205571
AK
612 fi \
613 ) > $@
614
797c18d5 615EXPORTED_UC := $(shell echo $(EXPORTED_FN_PREFIX) | tr '[a-z]' '[A-Z]')
bf2b1986 616EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.exported_symbols.$(EXPORTED_UC)_[0-9_]*[0-9])
797c18d5 617
bf2b1986
ZK
618.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS)
619ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
7a475bef 620 $(Q) set -e; (echo "Base {"; echo " global:";\
f2489d9d 621 $(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
40b277ae 622 echo " local:"; echo " *;";\
4f9e7f69 623 echo "};";\
4f9e7f69 624 ) > $@
797c18d5 625else
7a475bef 626 $(Q) set -e;\
f2489d9d 627 R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
797c18d5 628 test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
40b277ae
ZK
629 LAST=;\
630 for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -nt_ -k5 ); do\
797c18d5 631 echo "$${i##*.} {"; echo " global:";\
f2489d9d 632 $(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
40b277ae
ZK
633 if test -z "$$LAST"; then echo " local:"; echo " *;";fi;\
634 echo "}$$LAST;";\
635 LAST=" $${i##*.}";\
636 done > $@
797c18d5
ZK
637endif
638
52b07672 639ifeq ("$(USE_TRACKING)","yes")
94237354
ZK
640ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
641 help check check_local check_cluster check_lvmpolld run-unit-test tags))
2c7b9130 642.SECONDARY:
94237354 643# Note: no tabs before -include
e8679820 644 -include $(SOURCES:.c=.d) $(SOURCES2:.c=.d) $(CXXSOURCES:.cpp=.d)
b41f5924 645endif
fc4f0d3f 646endif
This page took 0.258829 seconds and 6 git commands to generate.