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