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