]>
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@ |
5951ef33 | 31 | |
5f68d858 | 32 | LIBS = @LIBS@ |
f8f6ec92 ZK |
33 | # Extra libraries always linked with static binaries |
34 | STATIC_LIBS = $(SELINUX_LIBS) | |
72b2cb61 | 35 | DEFS += @DEFS@ |
e8fad838 | 36 | CFLAGS += @CFLAGS@ |
84510264 | 37 | CLDFLAGS += @CLDFLAGS@ |
80992638 AK |
38 | LDDEPS += @LDDEPS@ |
39 | LDFLAGS += @LDFLAGS@ | |
e4c11ad1 | 40 | LIB_SUFFIX = @LIB_SUFFIX@ |
19a2c6e0 ZK |
41 | LVMINTERNAL_LIBS = -llvm-internal $(DL_LIBS) |
42 | DL_LIBS = @DL_LIBS@ | |
f30875db | 43 | PTHREAD_LIBS = @PTHREAD_LIBS@ |
539f4a77 | 44 | READLINE_LIBS = @READLINE_LIBS@ |
f8f6ec92 | 45 | SELINUX_LIBS = @SELINUX_LIBS@ |
795ca3e5 AK |
46 | |
47 | # Setup directory variables | |
639c84c1 AK |
48 | prefix = @prefix@ |
49 | exec_prefix = @exec_prefix@ | |
5d518f1f | 50 | udev_prefix = @udev_prefix@ |
639c84c1 | 51 | bindir = $(DESTDIR)@bindir@ |
4a7f3eb2 | 52 | confdir = $(DESTDIR)@CONFDIR@/lvm |
84510264 | 53 | includedir = $(DESTDIR)@includedir@ |
639c84c1 | 54 | libdir = $(DESTDIR)@libdir@ |
68f2de6d | 55 | usrlibdir = $(DESTDIR)@usrlibdir@ |
639c84c1 | 56 | sbindir = $(DESTDIR)@sbindir@ |
68f2de6d | 57 | usrsbindir = $(DESTDIR)@usrsbindir@ |
c2fa9fa9 | 58 | datarootdir = $(DESTDIR)@datarootdir@ |
639c84c1 AK |
59 | infodir = $(DESTDIR)@infodir@ |
60 | mandir = $(DESTDIR)@mandir@ | |
61 | localedir = $(DESTDIR)@LOCALEDIR@ | |
0a62c911 | 62 | staticdir = $(DESTDIR)@STATICDIR@ |
5d518f1f | 63 | udevdir = $(DESTDIR)@udevdir@ |
795ca3e5 | 64 | |
2c44337b | 65 | interface = @interface@ |
f7729ec6 | 66 | interfacebuilddir = $(top_builddir)/libdm/$(interface) |
2c44337b | 67 | |
795ca3e5 AK |
68 | # setup misc variables |
69 | # define the ownership variables for the binaries and man pages | |
84510264 AK |
70 | OWNER = @OWNER@ |
71 | GROUP = @GROUP@ | |
795ca3e5 AK |
72 | |
73 | # The number of jobs to run, if blank, defaults to the make standard | |
74 | ifndef MAKEFLAGS | |
75 | MAKEFLAGS = @JOBS@ | |
76 | endif | |
77 | ||
8a2fc586 | 78 | .SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib |
795ca3e5 | 79 | |
7c03887b | 80 | CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissing-noreturn -Wformat-security |
03a8a07d | 81 | |
72b2cb61 AK |
82 | #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual |
83 | #CFLAGS += -pedantic -std=gnu99 | |
8ef2b021 | 84 | |
8ce0cbda AK |
85 | CFLAGS += @COPTIMISE_FLAG@ |
86 | ||
8ef2b021 | 87 | ifeq ("@DEBUG@", "yes") |
8a2fc586 AK |
88 | CFLAGS += -g -fno-omit-frame-pointer |
89 | DEFS += -DDEBUG | |
81d19574 MB |
90 | # memory debugging is not thread-safe yet |
91 | ifneq ("@DMEVENTD@", "yes") | |
92 | DEFS += -DDEBUG_MEM | |
93 | endif | |
8ef2b021 | 94 | endif |
03a8a07d | 95 | |
69792976 | 96 | ifeq ("@INTL@", "yes") |
8a2fc586 | 97 | DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\" |
69792976 AK |
98 | endif |
99 | ||
db8b5af9 AK |
100 | LDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib |
101 | CLDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib | |
03a8a07d | 102 | |
a479de2e | 103 | ifeq ("@DMEVENTD@", "yes") |
db8b5af9 AK |
104 | LDFLAGS += -L$(top_builddir)/daemons/dmeventd |
105 | CLDFLAGS += -L$(top_builddir)/daemons/dmeventd | |
a479de2e AK |
106 | endif |
107 | ||
e50d0e97 AK |
108 | ifeq ("@DM_COMPAT@", "yes") |
109 | DEFS += -DDM_COMPAT | |
110 | endif | |
111 | ||
112 | ifeq ("@DM_IOCTLS@", "yes") | |
113 | DEFS += -DDM_IOCTLS | |
114 | endif | |
115 | ||
8a2fc586 AK |
116 | #DEFS += -DDEBUG_POOL |
117 | #DEFS += -DBOUNDS_CHECK | |
84510264 AK |
118 | |
119 | #CFLAGS += -pg | |
80992638 | 120 | #LDFLAGS += -pg |
84510264 AK |
121 | |
122 | STRIP= | |
123 | #STRIP = -s | |
8ef2b021 | 124 | |
5951ef33 AK |
125 | LVM_VERSION := $(shell cat $(top_srcdir)/VERSION) |
126 | ||
2c44337b AK |
127 | LIB_VERSION_LVM := $(shell cat $(top_srcdir)/VERSION | \ |
128 | awk -F '.' '{printf "%s.%s",$$1,$$2}') | |
129 | ||
130 | LIB_VERSION_DM := $(shell cat $(top_srcdir)/VERSION_DM | \ | |
131 | awk -F '.' '{printf "%s.%s",$$1,$$2}') | |
5a52dca9 | 132 | |
bf456146 AK |
133 | LIB_VERSION_APP := $(shell cat $(top_srcdir)/VERSION | \ |
134 | awk -F '[(). ]' '{printf "%s.%s",$$1,$$4}') | |
135 | ||
db8b5af9 | 136 | INCLUDES += -I. -I$(top_builddir)/include |
795ca3e5 | 137 | |
db8b5af9 | 138 | INC_LNS = $(top_builddir)/include/.symlinks_created |
a03f2320 | 139 | |
db8b5af9 AK |
140 | DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \ |
141 | $(top_builddir)/Makefile $(INC_LNS) | |
14c61d2d | 142 | |
84510264 AK |
143 | OBJECTS = $(SOURCES:%.c=%.o) |
144 | POTFILES = $(SOURCES:%.c=%.pot) | |
795ca3e5 | 145 | |
77b69aa7 | 146 | .PHONY: all install install_cluster pofile distclean clean cflow device-mapper |
0b502933 | 147 | .PHONY: install_device-mapper install_lvm2 |
cab8ea7c | 148 | .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean) |
8a2fc586 | 149 | .PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow) |
0782ad50 | 150 | .PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper) |
cab8ea7c | 151 | |
0782ad50 | 152 | SUBDIRS.device-mapper := $(SUBDIRS:=.device-mapper) |
795ca3e5 | 153 | SUBDIRS.install := $(SUBDIRS:=.install) |
cab8ea7c | 154 | SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster) |
0782ad50 | 155 | SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper) |
0b502933 | 156 | SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2) |
69792976 | 157 | SUBDIRS.pofile := $(SUBDIRS:=.pofile) |
8a2fc586 | 158 | SUBDIRS.cflow := $(SUBDIRS:=.cflow) |
795ca3e5 AK |
159 | SUBDIRS.clean := $(SUBDIRS:=.clean) |
160 | SUBDIRS.distclean := $(SUBDIRS:=.distclean) | |
161 | ||
2c44337b | 162 | TARGETS += $(LIB_SHARED) $(LIB_STATIC) $(VERSIONED_SHLIB) |
d68a82ec | 163 | |
795ca3e5 AK |
164 | all: $(SUBDIRS) $(TARGETS) |
165 | ||
166 | install: all $(SUBDIRS.install) | |
cab8ea7c | 167 | install_cluster: all $(SUBDIRS.install_cluster) |
0782ad50 | 168 | install_device-mapper: $(SUBDIRS.install_device-mapper) |
0b502933 | 169 | install_lvm2: $(SUBDIRS.install_lvm2) |
795ca3e5 | 170 | |
bef749c9 | 171 | $(SUBDIRS): $(SUBDIRS.device-mapper) |
795ca3e5 AK |
172 | $(MAKE) -C $@ |
173 | ||
0782ad50 AK |
174 | $(SUBDIRS.device-mapper): |
175 | $(MAKE) -C $(@:.device-mapper=) device-mapper | |
176 | ||
3ba1348c | 177 | $(SUBDIRS.install): $(SUBDIRS) |
795ca3e5 AK |
178 | $(MAKE) -C $(@:.install=) install |
179 | ||
cab8ea7c AK |
180 | $(SUBDIRS.install_cluster): $(SUBDIRS) |
181 | $(MAKE) -C $(@:.install_cluster=) install_cluster | |
182 | ||
77b69aa7 | 183 | $(SUBDIRS.install_device-mapper): device-mapper |
0782ad50 AK |
184 | $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper |
185 | ||
0b502933 MB |
186 | $(SUBDIRS.install_lvm2): $(SUBDIRS) |
187 | $(MAKE) -C $(@:.install_lvm2=) install_lvm2 | |
188 | ||
795ca3e5 | 189 | $(SUBDIRS.clean): |
5a52dca9 | 190 | -$(MAKE) -C $(@:.clean=) clean |
795ca3e5 AK |
191 | |
192 | $(SUBDIRS.distclean): | |
5a52dca9 | 193 | -$(MAKE) -C $(@:.distclean=) distclean |
795ca3e5 | 194 | |
69792976 AK |
195 | ifeq ("@INTL@", "yes") |
196 | pofile: $(SUBDIRS.pofile) $(POTFILES) | |
197 | ||
198 | $(SUBDIRS.pofile): | |
199 | $(MAKE) -C $(@:.pofile=) pofile | |
200 | endif | |
201 | ||
8a2fc586 AK |
202 | ifneq ("@CFLOW_CMD@", "") |
203 | cflow: $(SUBDIRS.cflow) | |
204 | ||
205 | $(SUBDIRS.cflow): | |
206 | $(MAKE) -C $(@:.cflow=) cflow | |
207 | endif | |
208 | ||
84510264 AK |
209 | $(TARGETS): $(OBJECTS) |
210 | ||
795ca3e5 | 211 | %.o: %.c |
25fbec5b | 212 | $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@ |
795ca3e5 | 213 | |
c5ff6dfa | 214 | %.pot: %.c Makefile |
25fbec5b | 215 | $(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \ |
8a2fc586 | 216 | $(DEFS) $(CFLAGS) $< > $@ |
69792976 | 217 | |
5a52dca9 | 218 | %.so: %.o |
b34447e2 | 219 | $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(CLDFLAGS) $< $(LIBS) -o $@ |
5a52dca9 | 220 | |
e4c11ad1 | 221 | ifeq ("@LIB_SUFFIX@","so") |
80992638 | 222 | $(LIB_SHARED): $(OBJECTS) $(LDDEPS) |
e4c11ad1 | 223 | $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ |
3b007b27 | 224 | $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ |
e4c11ad1 AK |
225 | endif |
226 | ||
227 | ifeq ("@LIB_SUFFIX@","dylib") | |
228 | $(LIB_SHARED): $(OBJECTS) $(LDDEPS) | |
229 | $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \ | |
3b007b27 | 230 | $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@ |
e4c11ad1 | 231 | endif |
84510264 | 232 | |
f0c9fe01 AK |
233 | %.so: %.a |
234 | $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ | |
3b007b27 AK |
235 | $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \ |
236 | @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ | |
f0c9fe01 | 237 | |
84510264 AK |
238 | $(LIB_STATIC): $(OBJECTS) |
239 | $(RM) $@ | |
240 | $(AR) rs $@ $(OBJECTS) | |
5a52dca9 | 241 | |
795ca3e5 | 242 | %.d: %.c |
db8b5af9 | 243 | $(MKDIR_P) $(dir $@); \ |
84510264 AK |
244 | set -e; \ |
245 | FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \ | |
246 | DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \ | |
db8b5af9 AK |
247 | $(CC) -MM $(INCLUDES) $(DEFS) $(CFLAGS) -o $@ $<; \ |
248 | sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \ | |
84510264 | 249 | [ -s $@ ] || $(RM) $@ |
795ca3e5 | 250 | |
69792976 AK |
251 | %.mo: %.po |
252 | $(MSGFMT) -o $@ $< | |
253 | ||
795ca3e5 | 254 | clean: $(SUBDIRS.clean) |
84510264 | 255 | $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \ |
3649fa9e | 256 | $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \ |
5556819a | 257 | $(SOURCES:%.c=%.gcda) $(LDDEPS) |
795ca3e5 | 258 | |
5556819a AK |
259 | distclean: $(SUBDIRS.distclean) |
260 | $(RM) -rf $(DISTCLEAN_DIRS) | |
fddafd51 | 261 | $(RM) $(DISTCLEAN_TARGETS) \ |
5556819a | 262 | $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \ |
3649fa9e | 263 | $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \ |
5556819a | 264 | $(SOURCES:%.c=%.gcda) $(LDDEPS) \ |
84510264 AK |
265 | config.cache config.log config.status \ |
266 | Makefile make.tmpl core \ | |
ac7d7207 | 267 | lvm-version.h |
84510264 AK |
268 | |
269 | .export.sym: .exported_symbols | |
270 | set -e; (echo "Base {"; echo " global:"; \ | |
271 | sed "s/^/ /;s/$$/;/" < $<; \ | |
272 | echo " local:"; echo " *;"; echo "};") > $@ | |
795ca3e5 AK |
273 | |
274 | ifneq ($(MAKECMDGOALS),clean) | |
275 | ifneq ($(MAKECMDGOALS),distclean) | |
276 | ifdef SOURCES | |
277 | -include $(SOURCES:.c=.d) | |
278 | endif | |
3649fa9e PR |
279 | ifdef SOURCES2 |
280 | -include $(SOURCES2:.c=.d) | |
281 | endif | |
795ca3e5 AK |
282 | endif |
283 | endif | |
284 |