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