2001-09-21 16:37:43 +04:00
# @configure_input@
#
2004-03-30 23:35:44 +04:00
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
2001-09-21 16:37:43 +04:00
#
2007-09-21 14:16:45 +04:00
# This file is part of LVM2.
2001-09-21 16:37:43 +04:00
#
2004-03-30 23:35:44 +04:00
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
2001-09-21 16:37:43 +04:00
#
2004-03-30 23:35:44 +04:00
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2001-09-21 16:37:43 +04:00
SHELL = /bin/sh
@SET_MAKE@
CC = @CC@
RANLIB = @RANLIB@
SHELL = /bin/sh
INSTALL = @INSTALL@
2004-02-14 01:56:45 +03:00
MSGFMT = @MSGFMT@
2001-09-21 16:37:43 +04:00
LN_S = @LN_S@
2001-11-16 13:40:16 +03:00
LIBS = @LIBS@
2006-05-10 01:23:51 +04:00
DEFS += @DEFS@
2003-10-22 01:59:42 +04:00
CFLAGS += @CFLAGS@
2004-03-26 16:21:12 +03:00
CLDFLAGS += @CLDFLAGS@
2004-06-28 18:01:24 +04:00
LDDEPS += @LDDEPS@
LDFLAGS += @LDFLAGS@
2006-01-31 17:52:30 +03:00
LIB_SUFFIX = @LIB_SUFFIX@
2001-09-21 16:37:43 +04:00
# Setup directory variables
2004-03-17 22:37:44 +03:00
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(DESTDIR)@bindir@
2004-04-14 21:39:55 +04:00
confdir = $(DESTDIR)@CONFDIR@/lvm
2004-03-26 16:21:12 +03:00
includedir = $(DESTDIR)@includedir@
2004-03-17 22:37:44 +03:00
libdir = $(DESTDIR)@libdir@
sbindir = $(DESTDIR)@sbindir@
infodir = $(DESTDIR)@infodir@
mandir = $(DESTDIR)@mandir@
localedir = $(DESTDIR)@LOCALEDIR@
2004-04-14 22:00:23 +04:00
staticdir = $(DESTDIR)@STATICDIR@
2001-09-21 16:37:43 +04:00
# setup misc variables
# define the ownership variables for the binaries and man pages
2004-03-26 16:21:12 +03:00
OWNER = @OWNER@
GROUP = @GROUP@
2001-09-21 16:37:43 +04:00
# The number of jobs to run, if blank, defaults to the make standard
ifndef MAKEFLAGS
MAKEFLAGS = @JOBS@
endif
2006-04-19 19:33:07 +04:00
.SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib
2001-09-21 16:37:43 +04:00
2007-04-27 23:26:57 +04:00
CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wmissing-noreturn -Wformat-security
2001-11-13 17:17:50 +03:00
2006-05-10 01:23:51 +04:00
#CFLAGS + = - W - Wconversion - Wpointer - arith - Wredundant - decls - Wbad - function - cast - Wcast - qual
#CFLAGS + = - pedantic - std = gnu99
2002-12-20 02:25:55 +03:00
2004-06-29 17:29:25 +04:00
CFLAGS += @COPTIMISE_FLAG@
2002-12-20 02:25:55 +03:00
ifeq ("@DEBUG@", "yes")
2006-04-19 19:33:07 +04:00
CFLAGS += -g -fno-omit-frame-pointer
DEFS += -DDEBUG
DEFS += -DDEBUG_MEM
2002-12-20 02:25:55 +03:00
endif
2001-11-13 17:17:50 +03:00
2004-02-14 01:56:45 +03:00
ifeq ("@INTL@", "yes")
2006-04-19 19:33:07 +04:00
DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
2004-02-14 01:56:45 +03:00
endif
2007-01-09 23:31:08 +03:00
ifneq ("@DMDIR@", "")
LDFLAGS += -L@DMDIR@/lib/ioctl
2007-01-11 20:12:27 +03:00
ifeq ("@DMEVENTD@", "yes")
LDFLAGS += -L@DMDIR@/dmeventd
endif
2007-01-09 23:31:08 +03:00
endif
2004-06-28 18:01:24 +04:00
LDFLAGS += -L$(top_srcdir)/lib -L$(libdir)
2001-11-13 17:17:50 +03:00
2006-04-19 19:33:07 +04:00
#DEFS + = - DDEBUG_POOL
#DEFS + = - DBOUNDS_CHECK
2004-03-26 16:21:12 +03:00
#CFLAGS + = - pg
2004-06-28 18:01:24 +04:00
#LDFLAGS + = - pg
2004-03-26 16:21:12 +03:00
STRIP=
#STRIP = - s
2002-12-20 02:25:55 +03:00
2002-11-18 17:04:08 +03:00
LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \
awk -F '.' '{printf "%s.%s",$$1,$$2}')
2008-05-20 00:06:34 +04:00
INCLUDES += -I$(top_srcdir)/include
2001-09-21 16:37:43 +04:00
2007-01-09 23:31:08 +03:00
ifneq ("@DMDIR@", "")
2008-05-20 00:06:34 +04:00
INCLUDES += -I@DMDIR@/include
2007-01-09 23:31:08 +03:00
endif
2002-01-18 19:43:19 +03:00
ifdef DESTDIR
2008-05-20 00:06:34 +04:00
INCLUDES += -I$(DESTDIR)/usr/include
2002-01-18 19:43:19 +03:00
endif
2004-03-26 16:21:12 +03:00
INC_LNS = $(top_srcdir)/include/.symlinks_created
2001-12-03 23:23:53 +03:00
2004-03-26 16:21:12 +03:00
DEPS = $(top_srcdir)/make.tmpl $(top_srcdir)/VERSION Makefile $(INC_LNS)
2001-11-28 18:00:49 +03:00
2004-03-26 16:21:12 +03:00
OBJECTS = $(SOURCES:%.c=%.o)
POTFILES = $(SOURCES:%.c=%.pot)
2001-09-21 16:37:43 +04:00
2006-04-19 19:33:07 +04:00
.PHONY: all install install_cluster pofile distclean clean cflow
2004-08-18 22:57:40 +04:00
.PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
2006-04-19 19:33:07 +04:00
.PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow)
2004-08-18 22:57:40 +04:00
2001-09-21 16:37:43 +04:00
SUBDIRS.install := $(SUBDIRS:=.install)
2004-08-18 22:57:40 +04:00
SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster)
2004-02-14 01:56:45 +03:00
SUBDIRS.pofile := $(SUBDIRS:=.pofile)
2006-04-19 19:33:07 +04:00
SUBDIRS.cflow := $(SUBDIRS:=.cflow)
2001-09-21 16:37:43 +04:00
SUBDIRS.clean := $(SUBDIRS:=.clean)
SUBDIRS.distclean := $(SUBDIRS:=.distclean)
2004-04-05 20:29:37 +04:00
TARGETS += $(LIB_SHARED) $(LIB_STATIC)
2001-09-21 16:37:43 +04:00
all: $(SUBDIRS) $(TARGETS)
install: all $(SUBDIRS.install)
2004-08-18 22:57:40 +04:00
install_cluster: all $(SUBDIRS.install_cluster)
2001-09-21 16:37:43 +04:00
$(SUBDIRS):
$(MAKE) -C $@
2003-05-06 15:58:55 +04:00
$(SUBDIRS.install): $(SUBDIRS)
2001-09-21 16:37:43 +04:00
$(MAKE) -C $(@:.install=) install
2004-08-18 22:57:40 +04:00
$(SUBDIRS.install_cluster): $(SUBDIRS)
$(MAKE) -C $(@:.install_cluster=) install_cluster
2001-09-21 16:37:43 +04:00
$(SUBDIRS.clean):
2002-11-18 17:04:08 +03:00
-$(MAKE) -C $(@:.clean=) clean
2001-09-21 16:37:43 +04:00
$(SUBDIRS.distclean):
2002-11-18 17:04:08 +03:00
-$(MAKE) -C $(@:.distclean=) distclean
2001-09-21 16:37:43 +04:00
2004-02-14 01:56:45 +03:00
ifeq ("@INTL@", "yes")
pofile: $(SUBDIRS.pofile) $(POTFILES)
$(SUBDIRS.pofile):
$(MAKE) -C $(@:.pofile=) pofile
endif
2006-04-19 19:33:07 +04:00
ifneq ("@CFLOW_CMD@", "")
cflow: $(SUBDIRS.cflow)
$(SUBDIRS.cflow):
$(MAKE) -C $(@:.cflow=) cflow
endif
2004-03-26 16:21:12 +03:00
$(TARGETS): $(OBJECTS)
2001-09-21 16:37:43 +04:00
%.o: %.c
2008-05-20 00:06:34 +04:00
$(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@
2001-09-21 16:37:43 +04:00
2004-04-06 19:14:23 +04:00
%.pot: %.c Makefile
2008-05-20 00:06:34 +04:00
$(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
2006-04-19 19:33:07 +04:00
$(DEFS) $(CFLAGS) $< > $@
2004-02-14 01:56:45 +03:00
2002-11-18 17:04:08 +03:00
%.so: %.o
2008-05-20 00:06:34 +04:00
$(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@
2002-11-18 17:04:08 +03:00
2006-01-31 17:52:30 +03:00
ifeq ("@LIB_SUFFIX@","so")
2004-06-28 18:01:24 +04:00
$(LIB_SHARED): $(OBJECTS) $(LDDEPS)
2006-01-31 17:52:30 +03:00
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
2007-01-11 20:12:27 +03:00
$(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
2006-01-31 17:52:30 +03:00
endif
ifeq ("@LIB_SUFFIX@","dylib")
$(LIB_SHARED): $(OBJECTS) $(LDDEPS)
$(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \
2007-01-11 20:12:27 +03:00
$(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
2006-01-31 17:52:30 +03:00
endif
2004-03-26 16:21:12 +03:00
2006-02-02 22:16:47 +03:00
%.so: %.a
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
2007-01-11 20:12:27 +03:00
$(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \
@CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@
2006-02-02 22:16:47 +03:00
2004-03-26 16:21:12 +03:00
$(LIB_STATIC): $(OBJECTS)
$(RM) $@
$(AR) rs $@ $(OBJECTS)
2002-11-18 17:04:08 +03:00
2001-09-21 16:37:43 +04:00
%.d: %.c
2004-03-26 16:21:12 +03:00
set -e; \
FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
2008-05-20 00:06:34 +04:00
$(CC) -MM $(INCLUDES) $(DEFS) $(CFLAGS) $< | \
2004-03-26 16:21:12 +03:00
sed "s/\(.*\)\.o[ :]*/$ $ FILE . o $ $ FILE . d $ $ FILE . pot : $ $ DEPS /g" > $@; \
[ -s $@ ] || $(RM) $@
2001-09-21 16:37:43 +04:00
2004-02-14 01:56:45 +03:00
%.mo: %.po
$(MSGFMT) -o $@ $<
2001-09-21 16:37:43 +04:00
clean: $(SUBDIRS.clean)
2004-03-26 16:21:12 +03:00
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
2004-06-28 18:01:24 +04:00
$(SOURCES:%.c=%.pot) $(LDDEPS)
2001-09-21 16:37:43 +04:00
distclean: $(SUBDIRS.distclean)
2006-05-17 00:53:13 +04:00
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(DISTCLEAN_TARGETS) \
$(SOURCES:%.c=%.d) $(SOURCES:%.c=%.pot) $(LDDEPS) \
2004-03-26 16:21:12 +03:00
config.cache config.log config.status \
Makefile make.tmpl core \
version.h lvm2.po
.export.sym: .exported_symbols
set -e; (echo "Base {"; echo " global:"; \
sed "s/^/ /;s/$$/;/" < $<; \
echo " local:"; echo " *;"; echo "};") > $@
2001-09-21 16:37:43 +04:00
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
ifdef SOURCES
-include $(SOURCES:.c=.d)
endif
endif
endif