f51786ddef8f83f48d05b92768d48a51dbf4eff9
[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 += $(LIB_CFLAGS) -I$(mpathcmddir)
11
12 LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd -lurcu -laio
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 file.o wwids.o prioritizers/alua_rtpg.o prkey.o \
46         io_err_stat.o dm-generic.o generic.o foreign.o
47
48 all: $(LIBS)
49
50 $(LIBS): $(OBJS)
51         $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
52         $(LN) $@ $(DEVLIB)
53
54 install:
55         $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
56         $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
57         $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
58         $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
59
60 uninstall:
61         $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
62         $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
63
64 clean: dep_clean
65         $(RM) core *.a *.o *.so *.so.* *.gz
66
67 include $(wildcard $(OBJS:.o=.d))
68
69 dep_clean:
70         $(RM) $(OBJS:.o=.d)