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