fc0f3d64faca347367dda09f7c271ddcbc862329
[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 LIBDEPS = -lpthread -ldl -ldevmapper -ludev
11 ifdef SYSTEMD
12         ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
13                 LIBDEPS += -lsystemd
14         else
15                 LIBDEPS += -lsystemd-daemon
16         endif
17 endif
18
19 OBJS = memory.o parser.o vector.o devmapper.o callout.o \
20        hwtable.o blacklist.o util.o dmparser.o config.o \
21        structs.o discovery.o propsel.o dict.o \
22        pgpolicies.o debug.o defaults.o uevent.o \
23        switchgroup.o uxsock.o print.o alias.o log_pthread.o \
24        log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
25        lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o
26
27 LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
28
29 ifneq ($(strip $(LIBDM_API_FLUSH)),0)
30         CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
31 endif
32
33 LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h)
34
35 ifneq ($(strip $(LIBDM_API_COOKIE)),0)
36         CFLAGS += -DLIBDM_API_COOKIE
37 endif
38
39 LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_resolve_buffer_size' /usr/include/libudev.h)
40
41 ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0)
42         CFLAGS += -DLIBUDEV_API_RECVBUF
43 endif
44
45 ifdef SYSTEMD
46         CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
47 endif
48
49 LIBDM_API_DEFERRED = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_deferred_remove' /usr/include/libdevmapper.h)
50
51 ifneq ($(strip $(LIBDM_API_DEFERRED)),0)
52         CFLAGS += -DLIBDM_API_DEFERRED
53 endif
54
55 all: $(LIBS)
56
57 $(LIBS): $(OBJS)
58         $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS)
59         ln -sf $@ $(DEVLIB)
60
61 install:
62         $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
63         $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
64         $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
65
66 uninstall:
67         rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
68
69 clean:
70         rm -f core *.a *.o *.gz *.so *.so.*