]> sourceware.org Git - lvm2.git/blame_incremental - make.tmpl.in
dev-type: detect mixed dos partition with gpt's PMBR
[lvm2.git] / make.tmpl.in
... / ...
CommitLineData
1# @configure_input@
2#
3# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
4# Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
5#
6# This file is part of LVM2.
7#
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.
11#
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,
14# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
16
17V ?= $(if ("@SILENT_RULES@","yes"),,1)
18Q := $(if $(V),,@)
19SHOW := $(if $(V),@true,@echo)
20
21SHELL = @SHELL@
22
23@SET_MAKE@
24
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.
27CC ?= @CC@
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
37RANLIB = @RANLIB@
38INSTALL = @INSTALL@
39MKDIR_P = @MKDIR_P@
40MSGFMT = @MSGFMT@
41LCOV = @LCOV@
42GENHTML = @GENHTML@
43LN_S = @LN_S@
44SED = @SED@
45CFLOW_CMD = @CFLOW_CMD@
46AWK = @AWK@
47CHMOD = @CHMOD@
48EGREP = @EGREP@
49GREP = @GREP@
50SORT = @SORT@
51WC = @WC@
52AR = @AR@
53RM = rm -f
54
55PYTHON2 = @PYTHON2@
56PYTHON3 = @PYTHON3@
57PYCOMPILE = $(top_srcdir)/autoconf/py-compile
58
59LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(RT_LIBS) $(M_LIBS)
60LVMLIBS = $(DMEVENT_LIBS) $(READLINE_LIBS) $(EDITLINE_LIBS) $(LIBSYSTEMD_LIBS) $(BLKID_LIBS) $(AIO_LIBS) $(LIBS)
61# Extra libraries always linked with static binaries
62STATIC_LIBS = $(PTHREAD_LIBS) $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS) $(M_LIBS)
63DEFS += @DEFS@
64# FIXME set this only where it's needed, not globally?
65CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
66CPPFLAGS ?= @CPPFLAGS@
67LDFLAGS ?= @LDFLAGS@
68STATIC_LDFLAGS += @STATIC_LDFLAGS@
69CLDFLAGS += @CLDFLAGS@
70ELDFLAGS += @ELDFLAGS@
71LDDEPS += @LDDEPS@
72LIB_SUFFIX = @LIB_SUFFIX@
73USE_TRACKING = @USE_TRACKING@
74
75DL_LIBS = @DL_LIBS@
76RT_LIBS = @RT_LIBS@
77M_LIBS = @M_LIBS@
78AIO_CFLAGS = @AIO_CFLAGS@
79AIO_LIBS = @AIO_LIBS@
80BLKID_CFLAGS = @BLKID_CFLAGS@
81BLKID_LIBS = @BLKID_LIBS@
82BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
83CPG_CFLAGS = @CPG_CFLAGS@
84CPG_LIBS = @CPG_LIBS@
85EDITLINE_CFLAGS = @EDITLINE_CFLAGS@
86EDITLINE_LIBS = @EDITLINE_LIBS@
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@
95LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@
96LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@
97PTHREAD_LIBS = @PTHREAD_LIBS@
98READLINE_CFLAGS = @READLINE_CFLAGS@
99READLINE_LIBS = @READLINE_LIBS@
100SELINUX_LIBS = @SELINUX_LIBS@
101SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
102UDEV_CFLAGS = @UDEV_CFLAGS@
103UDEV_LIBS = @UDEV_LIBS@
104UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
105VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
106VALGRIND_LIBS = @VALGRIND_LIBS@
107
108# Setup directory variables
109prefix = @prefix@
110exec_prefix = @exec_prefix@
111udev_prefix = @udev_prefix@
112sysconfdir = @sysconfdir@
113rootdir = $(DESTDIR)/
114bindir = $(DESTDIR)@bindir@
115confdir = $(DESTDIR)@CONFDIR@/lvm
116profiledir = $(confdir)/@DEFAULT_PROFILE_SUBDIR@
117includedir = $(DESTDIR)@includedir@
118libdir = $(DESTDIR)@libdir@
119libexecdir = $(DESTDIR)@libexecdir@
120usrlibdir = $(DESTDIR)@usrlibdir@
121sbindir = $(DESTDIR)@sbindir@
122usrsbindir = $(DESTDIR)@usrsbindir@
123datarootdir = @datarootdir@
124datadir = $(DESTDIR)@datadir@
125infodir = $(DESTDIR)@infodir@
126mandir = $(DESTDIR)@mandir@
127localedir = $(DESTDIR)@localedir@
128staticdir = $(DESTDIR)@STATICDIR@
129udevdir = $(DESTDIR)@udevdir@
130pkgconfigdir = $(usrlibdir)/pkgconfig
131initdir = $(DESTDIR)$(sysconfdir)/rc.d/init.d
132dbusconfdir = $(DESTDIR)$(sysconfdir)/dbus-1/system.d
133dbusservicedir = $(datadir)/dbus-1/system-services
134systemd_unit_dir = $(DESTDIR)@systemdsystemunitdir@
135systemd_generator_dir = $(DESTDIR)$(SYSTEMD_GENERATOR_DIR)
136systemd_dir = $(DESTDIR)@systemdutildir@
137tmpfiles_dir = $(DESTDIR)@tmpfilesdir@
138ocf_scriptdir = $(DESTDIR)@OCFDIR@
139PYTHON_PREFIX = $(prefix)
140
141# N.B. No $(DESTDIR) prefix here.
142python2dir = @PYTHON2DIR@
143python3dir = @PYTHON3DIR@
144
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
157USRLIB_RELPATH = $(shell echo $(abspath $(usrlibdir) $(libdir)) | \
158 $(AWK) -f $(top_srcdir)/scripts/relpath.awk)
159
160SYSTEMD_GENERATOR_DIR = @systemdutildir@/system-generators
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@
165DEFAULT_PROFILE_DIR = $(DEFAULT_SYS_DIR)/@DEFAULT_PROFILE_SUBDIR@
166DEFAULT_LOCK_DIR = @DEFAULT_LOCK_DIR@
167DEFAULT_RUN_DIR = @DEFAULT_RUN_DIR@
168DEFAULT_PID_DIR = @DEFAULT_PID_DIR@
169DEFAULT_MANGLING = @MANGLING@
170DEFAULT_DMEVENTD_EXIT_ON_PATH = @DEFAULT_DMEVENTD_EXIT_ON_PATH@
171
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
183# Setup vpath search paths for some suffixes
184vpath %.c $(srcdir)
185vpath %.cpp $(srcdir)
186vpath %.in $(srcdir)
187vpath %.po $(srcdir)
188vpath %.exported_symbols $(srcdir)
189
190interface = @interface@
191interfacebuilddir = $(top_builddir)/libdm/$(interface)
192rpmbuilddir = $(abs_top_builddir)/build
193
194# The number of jobs to run, if blank, defaults to the make standard
195ifndef MAKEFLAGS
196MAKEFLAGS = @JOBS@
197endif
198
199# Hiding dir entering makes hard for editors to look for files
200#ifneq (1, $(firstword $(V)))
201#MAKEFLAGS += --no-print-directory
202#endif
203
204# Handle installation of files
205ifeq ("@WRITE_INSTALL@", "yes")
206# leaving defaults
207M_INSTALL_SCRIPT = -m 755
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
217INSTALL_DIR = $(INSTALL) -m 755 -d
218INSTALL_ROOT_DIR = $(INSTALL) -m 700 -d
219INSTALL_ROOT_DATA = $(INSTALL) -m 600
220INSTALL_SCRIPT = $(INSTALL) -p $(M_INSTALL_PROGRAM)
221
222.SUFFIXES:
223.SUFFIXES: .c .cpp .d .o .so .a .po .pot .mo .dylib
224
225ifeq ("$(notdir $(CC))", "gcc")
226WFLAGS +=\
227 -Wall\
228 -Wcast-align\
229 -Wfloat-equal\
230 -Wformat-security\
231 -Winline\
232 -Wmissing-format-attribute\
233 -Wmissing-include-dirs\
234 -Wmissing-noreturn\
235 -Wpointer-arith\
236 -Wredundant-decls\
237 -Wshadow\
238 -Wundef\
239 -Wwrite-strings
240
241WCFLAGS +=\
242 -Wmissing-declarations\
243 -Wmissing-prototypes\
244 -Wnested-externs\
245 -Wold-style-definition\
246 -Wstrict-prototypes\
247 -Wuninitialized
248
249ifeq ("@HAVE_WJUMP@", "yes")
250WCFLAGS += -Wjump-misses-init
251endif
252
253ifeq ("@HAVE_WCLOBBERED@", "yes")
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
265endif
266
267ifeq ("@HAVE_WSYNCNAND@", "yes")
268WFLAGS += -Wsync-nand
269endif
270endif
271
272ifeq ("@HAVE_FULL_RELRO@", "yes")
273comma := ,
274ifneq ("@STATIC_LINK@", "yes")
275ifeq (,$(findstring -z$(comma)relro,$(LDFLAGS)))
276 LDFLAGS += -Wl,-z,relro
277endif
278ifeq (,$(findstring -z$(comma)now,$(LDFLAGS)))
279 LDFLAGS += -Wl,-z,now
280endif
281# TODO: think about configure option for this flag
282# for now leave decision on distro maintainer
283#ifeq (,$(findstring -z$(comma)pack-relative-relocs,$(LDFLAGS)))
284# LDFLAGS += -Wl,-z,pack-relative-relocs
285#endif
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
288ifneq (-l,$(findstring -l,$(filter-out %readline,$(READLINE_LIBS))))
289ifeq (,$(findstring --as-needed,$(LDFLAGS)))
290 LDFLAGS += -Wl,--as-needed
291endif
292endif
293
294ifeq ("@HAVE_PIE@", "yes")
295 EXTRA_EXEC_CFLAGS += -fPIE
296 EXTRA_EXEC_LDFLAGS += -pie -fPIE
297endif
298endif
299endif
300
301#WFLAGS += -W -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
302#WFLAGS += -Wsign-compare -Wunused-parameter -Wmissing-field-initializers
303#WFLAGS += -Wconversion -Wbad-function-cast -Wcast-qual -Waggregate-return -Wpacked
304#WFLAGS += -pedantic -std=gnu99
305#DEFS += -DDEBUG_CRC32
306
307#
308# Avoid recursive extension of CFLAGS
309# by checking whether CFLAGS already has fPIC string
310#
311ifeq (,$(findstring fPIC,$(CFLAGS)))
312
313CFLAGS += -fPIC
314
315ifeq ("@DEBUG@", "yes")
316ifeq (,$(findstring -g,$(CFLAGS)))
317 CFLAGS += -g
318endif
319 CFLAGS += -fno-omit-frame-pointer
320 DEFS += -DDEBUG
321 # memory debugging is not thread-safe yet
322 ifneq ("@BUILD_DMEVENTD@", "yes")
323 ifneq ("@BUILD_LVMLOCKD@", "yes")
324 ifneq ("@BUILD_LVMPOLLD@", "yes")
325 DEFS += -DDEBUG_MEM
326 endif
327 endif
328 endif
329endif
330
331# end of fPIC protection
332endif
333
334ifeq ("@BUILD_DMEVENTD@", "yes")
335 DMEVENT_LIBS = -L$(top_builddir)/daemons/dmeventd -ldevmapper-event -L$(interfacebuilddir) -ldevmapper
336endif
337
338# Combination of DEBUG_POOL and DEBUG_ENFORCE_POOL_LOCKING is not supported.
339#DEFS += -DDEBUG_POOL
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
343#DEFS += -DBOUNDS_CHECK
344
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
349#CFLAGS += -pg
350#LDFLAGS += -pg
351
352STRIP=
353#STRIP = -s
354
355LVM_VERSION := $(shell cat $(top_srcdir)/VERSION)
356
357LIB_VERSION_LVM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION)
358
359LIB_VERSION_DM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION_DM)
360
361LIB_VERSION_APP := $(shell $(AWK) -F '[(). ]' '{printf "%s.%s",$$1,$$4}' $(top_srcdir)/VERSION)
362
363INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include -include configure.h
364
365#VDO_INCLUDES=-I@VDO_INCLUDE@
366
367DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
368 $(top_builddir)/Makefile
369
370OBJECTS = $(SOURCES:%.c=%.o) $(CXXSOURCES:%.cpp=%.o)
371POTFILES = $(SOURCES:%.c=%.pot)
372
373.PHONY: all pofile distclean clean cleandir cflow device-mapper
374.PHONY: install install_cluster install_device-mapper install_lvm2
375.PHONY: install_dbus_service
376.PHONY: install_lib_shared install_dm_plugin install_lvm2_plugin
377.PHONY: install_ocf install_systemd_generators install_all_man all_man man help
378.PHONY: python_bindings install_python_bindings
379.PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
380.PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow)
381.PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper)
382.PHONY: $(SUBDIRS.generate) generate
383
384SUBDIRS.device-mapper := $(SUBDIRS:=.device-mapper)
385SUBDIRS.install := $(SUBDIRS:=.install)
386SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster)
387SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper)
388SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2)
389SUBDIRS.install_ocf := $(SUBDIRS:=.install_ocf)
390SUBDIRS.pofile := $(SUBDIRS:=.pofile)
391SUBDIRS.cflow := $(SUBDIRS:=.cflow)
392SUBDIRS.clean := $(SUBDIRS:=.clean)
393SUBDIRS.distclean := $(SUBDIRS:=.distclean)
394
395TARGETS += $(LIB_STATIC)
396ifeq ("@SHARED_LINK@", "yes")
397 TARGETS += $(LIB_SHARED)
398endif
399
400INTERNAL_LIBS = \
401 $(top_builddir)/libdaemon/client/libdaemonclient.a \
402 $(top_builddir)/device_mapper/libdevice-mapper.a \
403 $(top_builddir)/base/libbase.a
404LVMINTERNAL_LIBS = $(top_builddir)/lib/liblvm-internal.a $(INTERNAL_LIBS)
405
406all: $(SUBDIRS) $(TARGETS)
407
408install: $(SUBDIRS.install)
409install_cluster: $(SUBDIRS.install_cluster)
410install_device-mapper: $(SUBDIRS.install_device-mapper)
411install_device_mapper: install_device-mapper
412install_lvm2: $(SUBDIRS.install_lvm2)
413install_ocf: $(SUBDIRS.install_ocf)
414cflow: $(SUBDIRS.cflow)
415
416$(SUBDIRS): $(SUBDIRS.device-mapper)
417 $(MAKE) -C $@
418
419$(SUBDIRS.device-mapper):
420 $(MAKE) -C $(@:.device-mapper=) device-mapper
421
422$(SUBDIRS.install): $(SUBDIRS)
423 $(MAKE) -C $(@:.install=) install
424
425$(SUBDIRS.install_cluster): $(SUBDIRS)
426 $(MAKE) -C $(@:.install_cluster=) install_cluster
427
428$(SUBDIRS.install_device-mapper): device-mapper
429 $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper
430
431$(SUBDIRS.install_lvm2): $(SUBDIRS)
432 $(MAKE) -C $(@:.install_lvm2=) install_lvm2
433
434$(SUBDIRS.install_ocf):
435 $(MAKE) -C $(@:.install_ocf=) install_ocf
436
437$(SUBDIRS.clean):
438 -$(MAKE) -C $(@:.clean=) clean
439
440$(SUBDIRS.distclean):
441 -$(MAKE) -C $(@:.distclean=) distclean
442
443$(SUBDIRS.cflow):
444 $(MAKE) -C $(@:.cflow=) cflow
445
446ifeq ("@INTL@", "yes")
447pofile: $(SUBDIRS.pofile) $(POTFILES)
448
449$(SUBDIRS.pofile):
450 $(MAKE) -C $(@:.pofile=) pofile
451endif
452
453$(SUBDIRS.generate):
454 $(MAKE) -C $(@:.generate=) generate
455
456ifneq ("$(CFLOW_LIST_TARGET)", "")
457CLEAN_CFLOW += $(CFLOW_LIST_TARGET)
458$(CFLOW_LIST_TARGET): $(CFLOW_LIST)
459 echo "CFLOW_SOURCES += $(addprefix $(abs_srcdir)/, $(CFLOW_LIST))" > $@
460cflow: $(CFLOW_LIST_TARGET)
461endif
462
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 +=\
473 --cpp="$(CC) -E $(INCLUDES) $(VALGRIND_CFLAGS) $(BLKID_CFLAGS) $(DEFS)" \
474 --symbol _ISbit:wrapper \
475 --symbol __asm__:wrapper \
476 --symbol __attribute__:wrapper \
477 --symbol __inline:=inline \
478 --symbol __inline__:=inline \
479 --symbol __const:type \
480 --symbol __const__:wrapper \
481 --symbol __extension__:wrapper \
482 --symbol __leaf__:wrapper \
483 --symbol __nonnull:wrapper \
484 --symbol __nothrow__:wrapper \
485 --symbol __pure__:wrapper \
486 --symbol __REDIRECT:wrapper \
487 --symbol __REDIRECT_NTH:wrapper \
488 --symbol __restrict:=restrict \
489 --symbol __wur:wrapper
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
504endif
505
506.LIBPATTERNS = lib%.so lib%.a
507
508DEPFLAGS=-MT $@ -MMD -MP -MF $*.d
509
510# still needed in 2018 for 32bit builds
511DEFS+=-D_FILE_OFFSET_BITS=64
512
513%.o: %.c $(DEPS)
514 $(SHOW) " [CC] $(<F)"
515 @mkdir -p $(@D)
516 $(Q) $(CC) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(WCFLAGS) $(CFLAGS) $(CFLAGS_$@) $(CPPFLAGS) $< -o $@
517
518%.o: %.cpp $(DEPS)
519 $(SHOW) " [CXX] $(<F)"
520 @mkdir -p $(@D)
521 $(Q) $(CXX) $(DEPFLAGS) -c $(INCLUDES) $(VALGRIND_CFLAGS) $(DEFS) $(DEFS_$@) $(WFLAGS) $(CXXFLAGS) $(CXXFLAGS_$@) $< -o $@
522
523%.pot: %.c $(DEPS)
524 $(SHOW) " [CC] $(<F)"
525 @mkdir -p $(@D)
526 $(Q) $(CC) -E $(INCLUDES) $(VALGRIND_CFLAGS) $(PROGS_CFLAGS) -include $(top_builddir)/po/pogen.h $(DEFS) $(WFLAGS) $(CFLAGS) $(CPPFLAGS) $< >$@
527
528%.so: %.o
529 $(SHOW) " [CC] $(<F)"
530 $(Q) $(CC) -c $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $< $(LIBS) -o $@
531
532ifneq (,$(LIB_SHARED))
533
534TARGETS += $(LIB_SHARED).$(LIB_VERSION)
535$(LIB_SHARED).$(LIB_VERSION): $(OBJECTS) $(LDDEPS)
536 $(SHOW) " [CC] $@"
537ifeq ("@LIB_SUFFIX@","so")
538 $(Q) $(CC) -shared -Wl,-soname,$(notdir $@) \
539 $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
540endif
541ifeq ("@LIB_SUFFIX@","dylib")
542 $(Q) $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \
543 $(CFLAGS) $(LDFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
544endif
545
546$(LIB_SHARED): $(LIB_SHARED).$(LIB_VERSION)
547 $(SHOW) " [LN] $@"
548 $(Q) $(LN_S) -f $(<F) $@
549
550CLEAN_TARGETS += $(LDDEPS) .exported_symbols_generated
551
552install_lib_shared: $(LIB_SHARED)
553 $(SHOW) " [INSTALL] $<"
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)
557
558# FIXME: plugins are installed to subdirs
559# and for compatibility links in libdir are created
560# when the code is fixed links could be removed.
561install_dm_plugin: $(LIB_SHARED)
562 $(SHOW) " [INSTALL] $<"
563 $(Q) $(INSTALL_PROGRAM) -D $< $(libdir)/device-mapper/$(<F)
564 $(Q) $(LN_S) -f device-mapper/$(<F) $(libdir)/$(<F)
565
566install_lvm2_plugin: $(LIB_SHARED)
567 $(SHOW) " [INSTALL] $<"
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)
571endif
572
573$(LIB_STATIC): $(OBJECTS)
574 $(SHOW) " [AR] $@"
575 $(Q) $(RM) $@
576 $(Q) $(AR) rsv $@ $(OBJECTS) > /dev/null
577
578%.d:
579.PRECIOUS: %.d
580
581%.mo: %.po
582 $(SHOW) " [MSGFMT] $(<F)"
583 $(Q) $(MSGFMT) -o $@ $<
584
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
590cleandir:
591 $(SHOW) " [CLEANDIR]"
592ifneq (,$(firstword $(CLEAN_DIRS)))
593 $(Q) $(RM) -r $(CLEAN_DIRS)
594endif
595 $(Q) $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) core
596
597clean: $(SUBDIRS.clean) cleandir
598
599distclean: cleandir $(SUBDIRS.distclean)
600 $(SHOW) " [DISTCLEAN]"
601ifneq (,$(firstword $(DISTCLEAN_DIRS)))
602 $(Q) $(RM) -r $(DISTCLEAN_DIRS)
603endif
604 $(Q) $(RM) $(DISTCLEAN_TARGETS) Makefile
605
606.exported_symbols_generated: $(EXPORTED_HEADER) .exported_symbols $(DEPS)
607 $(Q) set -e; \
608 ( cat $(srcdir)/.exported_symbols; \
609 if test -n "$(EXPORTED_HEADER)"; then \
610 $(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
611 $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
612 fi \
613 ) > $@
614
615EXPORTED_UC := $(shell echo $(EXPORTED_FN_PREFIX) | tr '[a-z]' '[A-Z]')
616EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.exported_symbols.$(EXPORTED_UC)_[0-9_]*[0-9])
617
618.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS)
619ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
620 $(Q) set -e; (echo "Base {"; echo " global:";\
621 $(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
622 echo " local:"; echo " *;";\
623 echo "};";\
624 ) > $@
625else
626 $(Q) set -e;\
627 R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
628 test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
629 LAST=;\
630 for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -nt_ -k5 ); do\
631 echo "$${i##*.} {"; echo " global:";\
632 $(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
633 if test -z "$$LAST"; then echo " local:"; echo " *;";fi;\
634 echo "}$$LAST;";\
635 LAST=" $${i##*.}";\
636 done > $@
637endif
638
639ifeq ("$(USE_TRACKING)","yes")
640ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
641 help check check_local check_cluster check_lvmpolld run-unit-test tags))
642.SECONDARY:
643# Note: no tabs before -include
644 -include $(SOURCES:.c=.d) $(SOURCES2:.c=.d) $(CXXSOURCES:.cpp=.d)
645endif
646endif
This page took 0.032922 seconds and 6 git commands to generate.