22d3844c340959afe60b5d0089fd44556e0196f7
[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
12 OBJS = memory.o parser.o vector.o devmapper.o \
13        hwtable.o blacklist.o util.o dmparser.o config.o \
14        structs.o discovery.o propsel.o dict.o \
15        pgpolicies.o debug.o regex.o defaults.o uevent.o \
16        switchgroup.o uxsock.o print.o alias.o log_pthread.o \
17        log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
18        lock.o waiter.o file.o wwids.o prioritizers/alua_rtpg.o
19
20 LIBDM_API_FLUSH = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_no_flush' /usr/include/libdevmapper.h)
21
22 ifneq ($(strip $(LIBDM_API_FLUSH)),0)
23         CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
24 endif
25
26 LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h)
27
28 ifneq ($(strip $(LIBDM_API_COOKIE)),0)
29         CFLAGS += -DLIBDM_API_COOKIE
30 endif
31
32 LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_resolve_buffer_size' /usr/include/libudev.h)
33
34 ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0)
35         CFLAGS += -DLIBUDEV_API_RECVBUF
36 endif
37
38
39 all: $(LIBS)
40
41 $(LIBS): $(OBJS)
42         $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS) $(LIBDEPS)
43         ln -sf $@ $(DEVLIB)
44
45 install:
46         $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
47         $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
48         $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
49
50 uninstall:
51         rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
52
53 clean:
54         rm -f core *.a *.o *.gz *.so *.so.*