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