multipath-tools: replace leading spaces with tabs II
[multipath-tools/.git] / libmultipath / Makefile
1 # Makefile
2 #
3 # Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
4 #
5 include ../Makefile.inc
6
7 SONAME=0
8 DEVLIB = libmultipath.so
9 LIBS = $(DEVLIB).$(SONAME)
10 CFLAGS += -I$(mpathcmddir)
11 LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd
12 ifdef SYSTEMD
13         ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
14                 LIBDEPS += -lsystemd
15         else
16                 LIBDEPS += -lsystemd-daemon
17         endif
18 endif
19
20 OBJS = memory.o parser.o vector.o devmapper.o callout.o \
21         hwtable.o blacklist.o util.o dmparser.o config.o \
22         structs.o discovery.o propsel.o dict.o \
23         pgpolicies.o debug.o defaults.o uevent.o \
24         switchgroup.o uxsock.o print.o alias.o log_pthread.o \
25         log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
26         lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o
27
28 LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
29
30 ifneq ($(strip $(LIBDM_API_FLUSH)),0)
31         CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
32 endif
33
34 LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h)
35
36 ifneq ($(strip $(LIBDM_API_COOKIE)),0)
37         CFLAGS += -DLIBDM_API_COOKIE
38 endif
39
40 LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_receive_buffer_size' /usr/include/libudev.h)
41
42 ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0)
43         CFLAGS += -DLIBUDEV_API_RECVBUF
44 endif
45
46 ifdef SYSTEMD
47         CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
48 endif
49
50 LIBDM_API_DEFERRED = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_deferred_remove' /usr/include/libdevmapper.h)
51
52 ifneq ($(strip $(LIBDM_API_DEFERRED)),0)
53         CFLAGS += -DLIBDM_API_DEFERRED
54 endif
55
56 all: $(LIBS)
57
58 $(LIBS): $(OBJS)
59         $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS)
60         $(LN) $@ $(DEVLIB)
61
62 install:
63         $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
64         $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
65         $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
66         $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
67
68 uninstall:
69         $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
70         $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
71
72 clean:
73         $(RM) core *.a *.o *.gz *.so *.so.*