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