]> sourceware.org Git - lvm2.git/blob - make.tmpl.in
linking parms missing from o->so conversion.
[lvm2.git] / make.tmpl.in
1 # @configure_input@
2 #
3 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
4 # Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
5 #
6 # This file is part of LVM2.
7 #
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.
11 #
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
15
16 SHELL = /bin/sh
17
18 @SET_MAKE@
19
20 CC = @CC@
21 RANLIB = @RANLIB@
22 SHELL = /bin/sh
23 INSTALL = @INSTALL@
24 MKDIR_P = @MKDIR_P@
25 MSGFMT = @MSGFMT@
26 LCOV = @LCOV@
27 GENHTML = @GENHTML@
28 LN_S = @LN_S@
29 SED = @SED@
30
31 LIBS = @LIBS@
32 DEFS += @DEFS@
33 CFLAGS += @CFLAGS@
34 CLDFLAGS += @CLDFLAGS@
35 LDDEPS += @LDDEPS@
36 LDFLAGS += @LDFLAGS@
37 LIB_SUFFIX = @LIB_SUFFIX@
38
39 # Setup directory variables
40 prefix = @prefix@
41 exec_prefix = @exec_prefix@
42 udev_prefix = @udev_prefix@
43 bindir = $(DESTDIR)@bindir@
44 confdir = $(DESTDIR)@CONFDIR@/lvm
45 includedir = $(DESTDIR)@includedir@
46 libdir = $(DESTDIR)@libdir@
47 usrlibdir = $(DESTDIR)@usrlibdir@
48 sbindir = $(DESTDIR)@sbindir@
49 usrsbindir = $(DESTDIR)@usrsbindir@
50 infodir = $(DESTDIR)@infodir@
51 mandir = $(DESTDIR)@mandir@
52 localedir = $(DESTDIR)@LOCALEDIR@
53 staticdir = $(DESTDIR)@STATICDIR@
54 udevdir = $(DESTDIR)@udevdir@
55
56 interface = @interface@
57 interfacedir = $(top_srcdir)/libdm/$(interface)
58
59 # setup misc variables
60 # define the ownership variables for the binaries and man pages
61 OWNER = @OWNER@
62 GROUP = @GROUP@
63
64 # The number of jobs to run, if blank, defaults to the make standard
65 ifndef MAKEFLAGS
66 MAKEFLAGS = @JOBS@
67 endif
68
69 .SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib
70
71 CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissing-noreturn -Wformat-security
72
73 #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual
74 #CFLAGS += -pedantic -std=gnu99
75
76 CFLAGS += @COPTIMISE_FLAG@
77
78 ifeq ("@DEBUG@", "yes")
79 CFLAGS += -g -fno-omit-frame-pointer
80 DEFS += -DDEBUG
81 DEFS += -DDEBUG_MEM
82 endif
83
84 ifeq ("@INTL@", "yes")
85 DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
86 endif
87
88 LDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib
89 CLDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib
90
91 ifeq ("@DMEVENTD@", "yes")
92 LDFLAGS += -L$(top_builddir)/daemons/dmeventd
93 CLDFLAGS += -L$(top_builddir)/daemons/dmeventd
94 endif
95
96 ifeq ("@DM_COMPAT@", "yes")
97 DEFS += -DDM_COMPAT
98 endif
99
100 ifeq ("@DM_IOCTLS@", "yes")
101 DEFS += -DDM_IOCTLS
102 endif
103
104 #DEFS += -DDEBUG_POOL
105 #DEFS += -DBOUNDS_CHECK
106
107 #CFLAGS += -pg
108 #LDFLAGS += -pg
109
110 STRIP=
111 #STRIP = -s
112
113 LVM_VERSION := $(shell cat $(top_srcdir)/VERSION)
114
115 LIB_VERSION_LVM := $(shell cat $(top_srcdir)/VERSION | \
116 awk -F '.' '{printf "%s.%s",$$1,$$2}')
117
118 LIB_VERSION_DM := $(shell cat $(top_srcdir)/VERSION_DM | \
119 awk -F '.' '{printf "%s.%s",$$1,$$2}')
120
121 LIB_VERSION_APP := $(shell cat $(top_srcdir)/VERSION | \
122 awk -F '[(). ]' '{printf "%s.%s",$$1,$$4}')
123
124 INCLUDES += -I. -I$(top_builddir)/include
125
126 INC_LNS = $(top_builddir)/include/.symlinks_created
127
128 DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
129 $(top_builddir)/Makefile $(INC_LNS)
130
131 OBJECTS = $(SOURCES:%.c=%.o)
132 POTFILES = $(SOURCES:%.c=%.pot)
133
134 .PHONY: all install install_cluster pofile distclean clean cflow device-mapper
135 .PHONY: install_device-mapper install_lvm2
136 .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
137 .PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow)
138 .PHONY: $(SUBDIRS.device-mapper) $(SUBDIRS.install-device-mapper)
139
140 SUBDIRS.device-mapper := $(SUBDIRS:=.device-mapper)
141 SUBDIRS.install := $(SUBDIRS:=.install)
142 SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster)
143 SUBDIRS.install_device-mapper := $(SUBDIRS:=.install_device-mapper)
144 SUBDIRS.install_lvm2 := $(SUBDIRS:=.install_lvm2)
145 SUBDIRS.pofile := $(SUBDIRS:=.pofile)
146 SUBDIRS.cflow := $(SUBDIRS:=.cflow)
147 SUBDIRS.clean := $(SUBDIRS:=.clean)
148 SUBDIRS.distclean := $(SUBDIRS:=.distclean)
149
150 TARGETS += $(LIB_SHARED) $(LIB_STATIC) $(VERSIONED_SHLIB)
151
152 all: $(SUBDIRS) $(TARGETS)
153
154 install: all $(SUBDIRS.install)
155 install_cluster: all $(SUBDIRS.install_cluster)
156 install_device-mapper: $(SUBDIRS.install_device-mapper)
157 install_lvm2: $(SUBDIRS.install_lvm2)
158
159 $(SUBDIRS): $(SUBDIRS.device-mapper)
160 $(MAKE) -C $@
161
162 $(SUBDIRS.device-mapper):
163 $(MAKE) -C $(@:.device-mapper=) device-mapper
164
165 $(SUBDIRS.install): $(SUBDIRS)
166 $(MAKE) -C $(@:.install=) install
167
168 $(SUBDIRS.install_cluster): $(SUBDIRS)
169 $(MAKE) -C $(@:.install_cluster=) install_cluster
170
171 $(SUBDIRS.install_device-mapper): device-mapper
172 $(MAKE) -C $(@:.install_device-mapper=) install_device-mapper
173
174 $(SUBDIRS.install_lvm2): $(SUBDIRS)
175 $(MAKE) -C $(@:.install_lvm2=) install_lvm2
176
177 $(SUBDIRS.clean):
178 -$(MAKE) -C $(@:.clean=) clean
179
180 $(SUBDIRS.distclean):
181 -$(MAKE) -C $(@:.distclean=) distclean
182
183 ifeq ("@INTL@", "yes")
184 pofile: $(SUBDIRS.pofile) $(POTFILES)
185
186 $(SUBDIRS.pofile):
187 $(MAKE) -C $(@:.pofile=) pofile
188 endif
189
190 ifneq ("@CFLOW_CMD@", "")
191 cflow: $(SUBDIRS.cflow)
192
193 $(SUBDIRS.cflow):
194 $(MAKE) -C $(@:.cflow=) cflow
195 endif
196
197 $(TARGETS): $(OBJECTS)
198
199 %.o: %.c
200 $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@
201
202 %.pot: %.c Makefile
203 $(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
204 $(DEFS) $(CFLAGS) $< > $@
205
206 %.so: %.o
207 $(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $(CLDFLAGS) $< $(LIBS) -o $@
208
209 ifeq ("@LIB_SUFFIX@","so")
210 $(LIB_SHARED): $(OBJECTS) $(LDDEPS)
211 $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
212 $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
213 endif
214
215 ifeq ("@LIB_SUFFIX@","dylib")
216 $(LIB_SHARED): $(OBJECTS) $(LDDEPS)
217 $(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \
218 $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
219 endif
220
221 %.so: %.a
222 $(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
223 $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \
224 @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@
225
226 $(LIB_STATIC): $(OBJECTS)
227 $(RM) $@
228 $(AR) rs $@ $(OBJECTS)
229
230 %.d: %.c
231 $(MKDIR_P) $(dir $@); \
232 set -e; \
233 FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
234 DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
235 $(CC) -MM $(INCLUDES) $(DEFS) $(CFLAGS) -o $@ $<; \
236 sed -i "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" $@; \
237 [ -s $@ ] || $(RM) $@
238
239 %.mo: %.po
240 $(MSGFMT) -o $@ $<
241
242 clean: $(SUBDIRS.clean)
243 $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
244 $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
245 $(SOURCES:%.c=%.gcda) $(LDDEPS)
246
247 distclean: $(SUBDIRS.distclean)
248 $(RM) -rf $(DISTCLEAN_DIRS)
249 $(RM) $(DISTCLEAN_TARGETS) \
250 $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
251 $(SOURCES2:%.c=%.d) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
252 $(SOURCES:%.c=%.gcda) $(LDDEPS) \
253 config.cache config.log config.status \
254 Makefile make.tmpl core \
255 lvm-version.h
256
257 .export.sym: .exported_symbols
258 set -e; (echo "Base {"; echo " global:"; \
259 sed "s/^/ /;s/$$/;/" < $<; \
260 echo " local:"; echo " *;"; echo "};") > $@
261
262 ifneq ($(MAKECMDGOALS),clean)
263 ifneq ($(MAKECMDGOALS),distclean)
264 ifdef SOURCES
265 -include $(SOURCES:.c=.d)
266 endif
267 ifdef SOURCES2
268 -include $(SOURCES2:.c=.d)
269 endif
270 endif
271 endif
272
This page took 0.046964 seconds and 6 git commands to generate.