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