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