libmultipath/checkers: make RADOS checker optional
[multipath-tools/.git] / Makefile.inc
1 #
2 # Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
3 #
4
5 #
6 # Allow to force some libraries to be used statically. (Uncomment one of the
7 # following lines or define the values when calling make.)
8 #
9 # WITH_LOCAL_LIBDM      = 1
10 # WITH_LOCAL_LIBSYSFS   = 1
11 #
12 # Uncomment to disable RADOS support (e.g. if rados headers are missing).
13 # ENABLE_RADOS = 0
14
15 ifeq ($(TOPDIR),)
16         TOPDIR  = ..
17 endif
18
19 ifndef LIB
20         ifeq ($(shell test -d /lib64 && echo 1),1)
21                 LIB=lib64
22         else
23                 LIB=lib
24         endif
25 endif
26
27 ifndef RUN
28         ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
29                 RUN=run
30         else
31                 RUN=var/run
32         endif
33 endif
34
35 ifndef SYSTEMD
36         ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1)
37                 SYSTEMD = $(shell systemctl --version 2> /dev/null |  sed -n 's/systemd \([0-9]*\)/\1/p')
38         endif
39 endif
40
41 ifndef SYSTEMDPATH
42         SYSTEMDPATH=usr/lib
43 endif
44
45 prefix          =
46 exec_prefix     = $(prefix)
47 bindir          = $(exec_prefix)/sbin
48 libudevdir      = $(prefix)/$(SYSTEMDPATH)/udev
49 udevrulesdir    = $(libudevdir)/rules.d
50 multipathdir    = $(TOPDIR)/libmultipath
51 man8dir         = $(prefix)/usr/share/man/man8
52 man5dir         = $(prefix)/usr/share/man/man5
53 man3dir         = $(prefix)/usr/share/man/man3
54 syslibdir       = $(prefix)/$(LIB)
55 incdir          = $(prefix)/usr/include
56 libdir          = $(prefix)/$(LIB)/multipath
57 unitdir         = $(prefix)/$(SYSTEMDPATH)/systemd/system
58 mpathpersistdir = $(TOPDIR)/libmpathpersist
59 mpathcmddir     = $(TOPDIR)/libmpathcmd
60 thirdpartydir   = $(TOPDIR)/third-party
61 libdmmpdir      = $(TOPDIR)/libdmmp
62 includedir      = $(prefix)/usr/include
63 pkgconfdir      = $(prefix)/usr/share/pkgconfig
64
65 GZIP            = gzip -9 -c
66 RM              = rm -f
67 LN              = ln -sf
68 INSTALL_PROGRAM = install
69
70 OPTFLAGS        = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \
71                   -Werror=implicit-function-declaration -Werror=format-security \
72                   -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \
73                   -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong \
74                   --param=ssp-buffer-size=4
75
76 CFLAGS          = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
77 SHARED_FLAGS    = -shared
78
79 # Check whether a function with name $1 has been declared in header file $2.
80 check_func =                                                                   \
81     $(shell                                                                    \
82         if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
83            found=1;                                                            \
84            status="yes";                                                       \
85         else                                                                   \
86            found=0;                                                            \
87            status="no";                                                        \
88         fi;                                                                    \
89         echo 1>&2 "Checking for $1 in $2 ... $$status";                        \
90         echo "$$found"                                                         \
91     )
92
93 %.o:    %.c
94         $(CC) $(CFLAGS) -c -o $@ $<