2
# Copyright (C) 2004-2005 Heinz Mauelshagen, Red Hat GmbH. All rights reserved.
4
# See file LICENSE at the top of this source tree for license information.
18
CLDFLAGS += @CLDFLAGS@
23
# Setup directory variables
24
prefix = $(DESTDIR)@prefix@
25
exec_prefix = $(DESTDIR)@exec_prefix@
27
ifeq ("@KLIBC@", "no")
30
includedir = @includedir@
34
libdir = $(DESTDIR)@KLIBC_LIB_DIR@
35
sbindir = $(DESTDIR)@KLIBC_SBIN_DIR@
36
includedir = $(DESTDIR)@KLIBC_INCLUDE_DIR@
42
# setup misc variables
43
# define the ownership variables for the binaries and man pages
46
DMRAID_LIB_VERSION = @DMRAID_LIB_VERSION@
48
# The number of jobs to run, if blank, defaults to the make standard
55
CFLAGS+=-fPIC -Wall -Wundef -Wcast-align -Wwrite-strings -Winline
57
ifeq ("@KLIBC@", "yes")
58
# These ones make klibc compiles very loud
59
CFLAGS+=-Wshadow -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
62
ifeq ("@DMRAID_TEST@", "yes")
66
# Don't allow for linking against DSO with static binary.
67
ifeq ("@STATIC_LINK@", "no")
68
CFLAGS+=-DDMRAID_AUTOREGISTER
71
ifeq ("@DEBUG@", "yes")
72
CFLAGS+=-g -fno-omit-frame-pointer -DDEBUG
74
ifeq ("@KLIBC@", "no")
81
ifeq ("@DEBUG_MALLOC@", "yes")
82
CFLAGS+=-DDEBUG_MALLOC
85
CFLAGS+=-D_LARGEFILE64_SOURCE
87
INCLUDES+=-I. -I$(top_srcdir)/include -I$(top_srcdir)/lib
92
INCLUDES+=-I$(DESTDIR)/usr/include
95
DEPS=$(top_srcdir)/make.tmpl $(top_srcdir)/tools/VERSION Makefile
97
OBJECTS=$(SOURCES:%.c=%.o)
99
SUBDIRS.install := $(SUBDIRS:=.install)
100
SUBDIRS.remove := $(SUBDIRS:=.remove)
101
SUBDIRS.clean := $(SUBDIRS:=.clean)
102
SUBDIRS.distclean := $(SUBDIRS:=.distclean)
104
.PHONY: all install distclean clean
105
.PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
106
.PHONY: $(SUBDIRS.remove)
108
all: $(SUBDIRS) $(TARGETS)
110
install: all $(SUBDIRS.install)
112
remove: $(SUBDIRS.remove)
117
$(SUBDIRS.install): $(SUBDIRS)
118
$(MAKE) -C $(@:.install=) install
120
$(SUBDIRS.remove): $(SUBDIRS)
121
$(MAKE) -C $(@:.remove=) remove
124
-$(MAKE) -C $(@:.clean=) clean
126
$(SUBDIRS.distclean):
127
-$(MAKE) -C $(@:.distclean=) distclean
129
$(TARGETS): $(OBJECTS)
132
$(CC) -MM -MF ${@:%.o=%.d} $(INCLUDES) $(CFLAGS) $<; \
133
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
135
%.so: $(OBJECTS) .export.sym
138
$(CC) -shared -Wl,-soname,$(notdir $@).$(DMRAID_LIB_VERSION) \
139
-Wl,--version-script,.export.sym $(OBJECTS) -o $@ -ldevmapper-event
141
$(LIB_STATIC): $(OBJECTS)
143
$(AR) r $@ $(OBJECTS)
146
clean: $(SUBDIRS.clean)
147
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d)
149
distclean: $(SUBDIRS.distclean)
150
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
152
config.cache config.log config.status \
153
Makefile make.tmpl core tools/version.h
155
ifneq ($(MAKECMDGOALS),clean)
156
ifneq ($(MAKECMDGOALS),distclean)
158
-include $(SOURCES:.c=.d)