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