]>
Commit | Line | Data |
---|---|---|
795ca3e5 AK |
1 | # @configure_input@ |
2 | # | |
6606c3ae | 3 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. |
ec6a6fbe | 4 | # Copyright (C) 2004-2009 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, | |
14 | # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
795ca3e5 AK |
15 | |
16 | SHELL = /bin/sh | |
17 | ||
18 | @SET_MAKE@ | |
19 | ||
20 | CC = @CC@ | |
21 | RANLIB = @RANLIB@ | |
22 | SHELL = /bin/sh | |
23 | INSTALL = @INSTALL@ | |
5556819a | 24 | MKDIR_P = @MKDIR_P@ |
69792976 | 25 | MSGFMT = @MSGFMT@ |
5556819a AK |
26 | LCOV = @LCOV@ |
27 | GENHTML = @GENHTML@ | |
795ca3e5 | 28 | LN_S = @LN_S@ |
5951ef33 | 29 | SED = @SED@ |
87d73a9b | 30 | CFLOW_CMD = @CFLOW_CMD@ |
aaa2e046 | 31 | AWK = @AWK@ |
5951ef33 | 32 | |
5f68d858 | 33 | LIBS = @LIBS@ |
f8f6ec92 | 34 | # Extra libraries always linked with static binaries |
db724a44 | 35 | STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) |
72b2cb61 | 36 | DEFS += @DEFS@ |
e8fad838 | 37 | CFLAGS += @CFLAGS@ |
84510264 | 38 | CLDFLAGS += @CLDFLAGS@ |
80992638 AK |
39 | LDDEPS += @LDDEPS@ |
40 | LDFLAGS += @LDFLAGS@ | |
e4c11ad1 | 41 | LIB_SUFFIX = @LIB_SUFFIX@ |
19a2c6e0 ZK |
42 | LVMINTERNAL_LIBS = -llvm-internal $(DL_LIBS) |
43 | DL_LIBS = @DL_LIBS@ | |
f30875db | 44 | PTHREAD_LIBS = @PTHREAD_LIBS@ |
539f4a77 | 45 | READLINE_LIBS = @READLINE_LIBS@ |
f8f6ec92 | 46 | SELINUX_LIBS = @SELINUX_LIBS@ |
db724a44 | 47 | UDEV_LIBS = @UDEV_LIBS@ |
795ca3e5 AK |
48 | |
49 | # Setup directory variables | |
639c84c1 AK |
50 | prefix = @prefix@ |
51 | exec_prefix = @exec_prefix@ | |
5d518f1f | 52 | udev_prefix = @udev_prefix@ |
639c84c1 | 53 | bindir = $(DESTDIR)@bindir@ |
4a7f3eb2 | 54 | confdir = $(DESTDIR)@CONFDIR@/lvm |
84510264 | 55 | includedir = $(DESTDIR)@includedir@ |
639c84c1 | 56 | libdir = $(DESTDIR)@libdir@ |
68f2de6d | 57 | usrlibdir = $(DESTDIR)@usrlibdir@ |
639c84c1 | 58 | sbindir = $(DESTDIR)@sbindir@ |
68f2de6d | 59 | usrsbindir = $(DESTDIR)@usrsbindir@ |
c2fa9fa9 | 60 | datarootdir = $(DESTDIR)@datarootdir@ |
c474c082 ZK |
61 | infodir = $(datarootdir)/info |
62 | mandir = $(datarootdir)/man | |
639c84c1 | 63 | localedir = $(DESTDIR)@LOCALEDIR@ |
0a62c911 | 64 | staticdir = $(DESTDIR)@STATICDIR@ |
5d518f1f | 65 | udevdir = $(DESTDIR)@udevdir@ |
fff111fe | 66 | pkgconfigdir = $(usrlibdir)/pkgconfig |
5227ae53 | 67 | USRLIB_RELPATH = $(shell echo $(abspath $(usrlibdir) $(libdir)) | \ |
aaa2e046 | 68 | $(AWK) -f $(top_srcdir)/scripts/relpath.awk) |
795ca3e5 | 69 | |
c737d348 ZK |
70 | # Setup vpath search paths for some suffixes |
71 | vpath %.c $(srcdir) | |
72 | vpath %.in $(srcdir) | |
73 | vpath %.po $(srcdir) | |
74 | vpath %.exported_symbols $(srcdir) | |
75 | ||
2c44337b | 76 | interface = @interface@ |
f7729ec6 | 77 | interfacebuilddir = $(top_builddir)/libdm/$(interface) |
2c44337b | 78 | |
795ca3e5 AK |
79 | # The number of jobs to run, if blank, defaults to the make standard |
80 | ifndef MAKEFLAGS | |
81 | MAKEFLAGS = @JOBS@ | |
82 | endif | |
83 | ||
23b059e7 ZK |
84 | # Handle installation of files |
85 | ifeq ("@WRITE_INSTALL@", "yes") | |
86 | # leaving defaults | |
87 | M_INSTALL_PROGRAM = | |
88 | M_INSTALL_DATA = -m 644 | |
89 | else | |
90 | M_INSTALL_PROGRAM = -m 555 | |
91 | M_INSTALL_DATA = -m 444 | |
92 | endif | |
93 | INSTALL_PROGRAM = $(INSTALL) $(M_INSTALL_PROGRAM) $(STRIP) | |
94 | INSTALL_DATA = $(INSTALL) -p $(M_INSTALL_DATA) | |
95 | INSTALL_WDATA = $(INSTALL) -p -m 644 | |
96 | ||
8a2fc586 | 97 | .SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib |
795ca3e5 | 98 | |
7c03887b | 99 | CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissing-noreturn -Wformat-security |
03a8a07d | 100 | |
72b2cb61 AK |
101 | #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual |
102 | #CFLAGS += -pedantic -std=gnu99 | |
8ef2b021 | 103 | |
8ce0cbda AK |
104 | CFLAGS += @COPTIMISE_FLAG@ |
105 | ||
8ef2b021 | 106 | ifeq ("@DEBUG@", "yes") |
8a2fc586 AK |
107 | CFLAGS += -g -fno-omit-frame-pointer |
108 | DEFS += -DDEBUG | |
81d19574 MB |
109 | # memory debugging is not thread-safe yet |
110 | ifneq ("@DMEVENTD@", "yes") | |
111 | DEFS += -DDEBUG_MEM | |
112 | endif | |
8ef2b021 | 113 | endif |
03a8a07d | 114 | |
69792976 | 115 | ifeq ("@INTL@", "yes") |
8a2fc586 | 116 | DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\" |
69792976 AK |
117 | endif |
118 | ||
db8b5af9 AK |
119 | LDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib |
120 | CLDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib | |
03a8a07d | 121 | |
a479de2e | 122 | ifeq ("@DMEVENTD@", "yes") |
db8b5af9 AK |
123 | LDFLAGS += -L$(top_builddir)/daemons/dmeventd |
124 | CLDFLAGS += -L$(top_builddir)/daemons/dmeventd | |
a479de2e AK |
125 | endif |
126 | ||
e50d0e97 AK |
127 | ifeq ("@DM_COMPAT@", "yes") |
128 | DEFS += -DDM_COMPAT | |
129 | endif | |
130 | ||
131 | ifeq ("@DM_IOCTLS@", "yes") | |
132 | DEFS += -DDM_IOCTLS | |
133 | endif | |
134 | ||
8a2fc586 AK |
135 | #DEFS += -DDEBUG_POOL |
136 | #DEFS += -DBOUNDS_CHECK | |
84510264 AK |
137 | |
138 | #CFLAGS += -pg | |
80992638 | 139 | #LDFLAGS += -pg |
84510264 AK |
140 | |
141 | STRIP= | |
142 | #STRIP = -s | |
8ef2b021 | 143 | |
5951ef33 AK |
144 | LVM_VERSION := $(shell cat $(top_srcdir)/VERSION) |
145 | ||
047f82ee | 146 | LIB_VERSION_LVM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION) |
2c44337b | 147 | |
047f82ee | 148 | LIB_VERSION_DM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION_DM) |
5a52dca9 | 149 | |
047f82ee | 150 | LIB_VERSION_APP := $(shell $(AWK) -F '[(). ]' '{printf "%s.%s",$$1,$$4}' $(top_srcdir)/VERSION) |
bf456146 | 151 | |
db8b5af9 | 152 | INCLUDES += -I. -I$(top_builddir)/include |
795ca3e5 | 153 | |
db8b5af9 | 154 | INC_LNS = $(top_builddir)/include/.symlinks_created |
a03f2320 | 155 | |
db8b5af9 AK |
156 | DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \ |
157 | $(top_builddir)/Makefile $(INC_LNS) | |
14c61d2d | 158 | |
84510264 AK |
159 | OBJECTS = $(SOURCES:%.c=%.o) |
160 | POTFILES = $(SOURCES:%.c=%.pot) | |
795ca3e5 | 161 | |
7cbd4a74 ZK |
162 | .PHONY: all pofile distclean clean cleandir cflow device-mapper |
163 | .PHONY: install install_cluster install_device-mapper install_lvm2 | |
180b3dea | 164 | .PHONY: install_lib_shared install_dm_plugin install_lvm2_plugin |
cab8ea7c | 165 | .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean) |
8a2fc586 | 166 | .PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow) |
0782ad50 | 167 | .PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper) |
cab8ea7c | 168 | |
0782ad50 | 169 | SUBDIRS.device-mapper := $(SUBDIRS:=.device-mapper) |
795ca3e5 | 170 | SUBDIRS.install := $(SUBDIRS:=.install) |
cab8ea7c | 171 | SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster) |
0782ad50 | 172 | SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper) |
0b502933 | 173 | SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2) |
69792976 | 174 | SUBDIRS.pofile := $(SUBDIRS:=.pofile) |
8a2fc586 | 175 | SUBDIRS.cflow := $(SUBDIRS:=.cflow) |
795ca3e5 AK |
176 | SUBDIRS.clean := $(SUBDIRS:=.clean) |
177 | SUBDIRS.distclean := $(SUBDIRS:=.distclean) | |
178 | ||
23b059e7 | 179 | TARGETS += $(LIB_SHARED) $(LIB_STATIC) |
d68a82ec | 180 | |
795ca3e5 AK |
181 | all: $(SUBDIRS) $(TARGETS) |
182 | ||
183 | install: all $(SUBDIRS.install) | |
cab8ea7c | 184 | install_cluster: all $(SUBDIRS.install_cluster) |
0782ad50 | 185 | install_device-mapper: $(SUBDIRS.install_device-mapper) |
0b502933 | 186 | install_lvm2: $(SUBDIRS.install_lvm2) |
b41f5924 | 187 | cflow: $(SUBDIRS.cflow) |
795ca3e5 | 188 | |
bef749c9 | 189 | $(SUBDIRS): $(SUBDIRS.device-mapper) |
795ca3e5 AK |
190 | $(MAKE) -C $@ |
191 | ||
0782ad50 AK |
192 | $(SUBDIRS.device-mapper): |
193 | $(MAKE) -C $(@:.device-mapper=) device-mapper | |
194 | ||
3ba1348c | 195 | $(SUBDIRS.install): $(SUBDIRS) |
795ca3e5 AK |
196 | $(MAKE) -C $(@:.install=) install |
197 | ||
cab8ea7c AK |
198 | $(SUBDIRS.install_cluster): $(SUBDIRS) |
199 | $(MAKE) -C $(@:.install_cluster=) install_cluster | |
200 | ||
77b69aa7 | 201 | $(SUBDIRS.install_device-mapper): device-mapper |
0782ad50 AK |
202 | $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper |
203 | ||
0b502933 MB |
204 | $(SUBDIRS.install_lvm2): $(SUBDIRS) |
205 | $(MAKE) -C $(@:.install_lvm2=) install_lvm2 | |
206 | ||
795ca3e5 | 207 | $(SUBDIRS.clean): |
5a52dca9 | 208 | -$(MAKE) -C $(@:.clean=) clean |
795ca3e5 AK |
209 | |
210 | $(SUBDIRS.distclean): | |
5a52dca9 | 211 | -$(MAKE) -C $(@:.distclean=) distclean |
795ca3e5 | 212 | |
b41f5924 ZK |
213 | $(SUBDIRS.cflow): |
214 | $(MAKE) -C $(@:.cflow=) cflow | |
215 | ||
69792976 AK |
216 | ifeq ("@INTL@", "yes") |
217 | pofile: $(SUBDIRS.pofile) $(POTFILES) | |
218 | ||
219 | $(SUBDIRS.pofile): | |
220 | $(MAKE) -C $(@:.pofile=) pofile | |
221 | endif | |
222 | ||
b41f5924 ZK |
223 | ifneq ("$(CFLOW_LIST_TARGET)", "") |
224 | CLEAN_CFLOW += $(CFLOW_LIST_TARGET) | |
225 | $(CFLOW_LIST_TARGET): $(CFLOW_LIST) | |
226 | echo "CFLOW_SOURCES += $(addprefix \ | |
227 | \$$(top_srcdir)$(subst $(top_srcdir),,$(srcdir))/, $(CFLOW_LIST))" > $@ | |
228 | cflow: $(CFLOW_LIST_TARGET) | |
229 | endif | |
8a2fc586 | 230 | |
b41f5924 ZK |
231 | ifneq ("$(CFLOW_TARGET)", "") |
232 | CLEAN_CFLOW += \ | |
233 | $(CFLOW_TARGET).cflow \ | |
234 | $(CFLOW_TARGET).xref \ | |
235 | $(CFLOW_TARGET).tree \ | |
236 | $(CFLOW_TARGET).rtree \ | |
237 | $(CFLOW_TARGET).rxref | |
238 | ||
239 | ifneq ("$(CFLOW_CMD)", "") | |
240 | CFLOW_FLAGS +=\ | |
241 | --cpp="$(CC) -E" \ | |
242 | --symbol _ISbit:wrapper \ | |
243 | --symbol __attribute__:wrapper \ | |
244 | --symbol __const__:wrapper \ | |
245 | --symbol __const:type \ | |
246 | --symbol __restrict:type \ | |
247 | --symbol __extension__:wrapper \ | |
248 | --symbol __nonnull:wrapper \ | |
249 | --symbol __nothrow__:wrapper \ | |
250 | --symbol __pure__:wrapper \ | |
251 | --symbol __REDIRECT:wrapper \ | |
252 | --symbol __REDIRECT_NTH:wrapper \ | |
253 | --symbol __wur:wrapper \ | |
254 | -I$(top_srcdir)/libdm \ | |
255 | -I$(top_srcdir)/libdm/ioctl \ | |
256 | -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2/ \ | |
257 | $(INCLUDES) $(DEFS) | |
258 | ||
259 | $(CFLOW_TARGET).cflow: $(CFLOW_SOURCES) | |
260 | $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) $(CFLOW_SOURCES) | |
261 | $(CFLOW_TARGET).rxref: $(CFLOW_SOURCES) | |
262 | $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) -r --omit-arguments $(CFLOW_SOURCES) | |
263 | $(CFLOW_TARGET).tree: $(CFLOW_SOURCES) | |
264 | $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) --omit-arguments -T -b $(CFLOW_SOURCES) | |
265 | $(CFLOW_TARGET).xref: $(CFLOW_SOURCES) | |
266 | $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) --omit-arguments -x $(CFLOW_SOURCES) | |
267 | #$(CFLOW_TARGET).rtree: $(CFLOW_SOURCES) | |
268 | # $(CFLOW_CMD) -o$@ $(CFLOW_FLAGS) -r --omit-arguments -T -b $(CFLOW_SOURCES) | |
269 | cflow: $(CFLOW_TARGET).cflow $(CFLOW_TARGET).tree $(CFLOW_TARGET).rxref $(CFLOW_TARGET).xref | |
270 | #$(CFLOW_TARGET).rtree | |
271 | endif | |
8a2fc586 AK |
272 | endif |
273 | ||
84510264 AK |
274 | $(TARGETS): $(OBJECTS) |
275 | ||
795ca3e5 | 276 | %.o: %.c |
25fbec5b | 277 | $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@ |
795ca3e5 | 278 | |
c5ff6dfa | 279 | %.pot: %.c Makefile |
25fbec5b | 280 | $(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \ |
8a2fc586 | 281 | $(DEFS) $(CFLAGS) $< > $@ |
69792976 | 282 | |
5a52dca9 | 283 | %.so: %.o |
b34447e2 | 284 | $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(CLDFLAGS) $< $(LIBS) -o $@ |
5a52dca9 | 285 | |
23b059e7 ZK |
286 | ifneq (,$(LIB_SHARED)) |
287 | ||
288 | TARGETS += $(LIB_SHARED).$(LIB_VERSION) | |
289 | $(LIB_SHARED).$(LIB_VERSION): $(OBJECTS) $(LDDEPS) | |
e4c11ad1 | 290 | ifeq ("@LIB_SUFFIX@","so") |
23b059e7 ZK |
291 | $(CC) -shared -Wl,-soname,$(notdir $@) \ |
292 | $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ | |
e4c11ad1 | 293 | endif |
e4c11ad1 | 294 | ifeq ("@LIB_SUFFIX@","dylib") |
e4c11ad1 | 295 | $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \ |
23b059e7 ZK |
296 | $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ |
297 | endif | |
298 | ||
299 | $(LIB_SHARED): $(LIB_SHARED).$(LIB_VERSION) | |
300 | $(LN_S) -f $(<F) $@ | |
301 | ||
302 | install_lib_shared: $(LIB_SHARED) | |
303 | $(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION) | |
304 | $(INSTALL) -d $(usrlibdir) | |
5227ae53 | 305 | $(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F) |
23b059e7 | 306 | |
180b3dea ZK |
307 | # FIXME: plugins are installed to subdirs |
308 | # and for compatibility links in libdir are created | |
309 | # when the code is fixed links could be removed. | |
310 | install_dm_plugin: $(LIB_SHARED) | |
311 | $(INSTALL_PROGRAM) -D $< $(libdir)/device-mapper/$(<F) | |
312 | $(LN_S) -f device-mapper/$(<F) $(libdir)/$(<F) | |
180b3dea ZK |
313 | |
314 | install_lvm2_plugin: $(LIB_SHARED) | |
315 | $(INSTALL_PROGRAM) -D $< $(libdir)/lvm2/$(<F) | |
316 | $(LN_S) -f lvm2/$(<F) $(libdir)/$(<F) | |
317 | $(LN_S) -f $(<F) $(libdir)/$(<F).$(LIB_VERSION) | |
e4c11ad1 | 318 | endif |
84510264 AK |
319 | |
320 | $(LIB_STATIC): $(OBJECTS) | |
321 | $(RM) $@ | |
322 | $(AR) rs $@ $(OBJECTS) | |
5a52dca9 | 323 | |
795ca3e5 | 324 | %.d: %.c |
db8b5af9 | 325 | $(MKDIR_P) $(dir $@); \ |
84510264 AK |
326 | set -e; \ |
327 | FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \ | |
328 | DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \ | |
db8b5af9 AK |
329 | $(CC) -MM $(INCLUDES) $(DEFS) $(CFLAGS) -o $@ $<; \ |
330 | sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \ | |
84510264 | 331 | [ -s $@ ] || $(RM) $@ |
795ca3e5 | 332 | |
69792976 AK |
333 | %.mo: %.po |
334 | $(MSGFMT) -o $@ $< | |
335 | ||
7cbd4a74 | 336 | cleandir: |
b7be589e | 337 | $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(CLEAN_CFLOW) $(LDDEPS) \ |
7cbd4a74 ZK |
338 | $(POTFILES) $(SOURCES:%.c=%.d) $(SOURCES:%.c=%.gcno) $(SOURCES:%.c=%.gcda) \ |
339 | $(SOURCES2:%.c=%.o) $(SOURCES2:%.c=%.d) $(SOURCES2:%.c=%.gcno) $(SOURCES2:%.c=%.gcda) | |
795ca3e5 | 340 | |
7cbd4a74 ZK |
341 | clean: $(SUBDIRS.clean) cleandir |
342 | ||
343 | distclean: cleandir $(SUBDIRS.distclean) | |
e83968fa ZK |
344 | test -z "$(DISTCLEAN_DIRS)" || $(RM) -r $(DISTCLEAN_DIRS) |
345 | $(RM) $(DISTCLEAN_TARGETS) Makefile core | |
84510264 AK |
346 | |
347 | .export.sym: .exported_symbols | |
348 | set -e; (echo "Base {"; echo " global:"; \ | |
349 | sed "s/^/ /;s/$$/;/" < $<; \ | |
350 | echo " local:"; echo " *;"; echo "};") > $@ | |
795ca3e5 | 351 | |
04812472 | 352 | ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov)) |
795ca3e5 AK |
353 | ifdef SOURCES |
354 | -include $(SOURCES:.c=.d) | |
355 | endif | |
3649fa9e PR |
356 | ifdef SOURCES2 |
357 | -include $(SOURCES2:.c=.d) | |
358 | endif | |
b41f5924 | 359 | endif |