multipathd: don't update priority of failed paths
[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 ifeq ($(TOPDIR),)
13         TOPDIR  = ..
14 endif
15
16 ifndef LIB
17         ifeq ($(shell test -d /lib64 && echo 1),1)
18                 LIB=lib64
19         else
20                 LIB=lib
21         endif
22 endif
23
24 ifndef RUN
25         ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
26                 RUN=run
27         else
28                 RUN=var/run
29         endif
30 endif
31
32 ifndef SYSTEMD
33         ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1)
34                 SYSTEMD = $(shell systemctl --version 2> /dev/null |  sed -n 's/systemd \([0-9]*\)/\1/p')
35         endif
36 endif
37
38 ifndef SYSTEMDPATH
39         SYSTEMDPATH=usr/lib
40 endif
41
42 prefix          =
43 exec_prefix     = $(prefix)
44 bindir          = $(exec_prefix)/sbin
45 libudevdir      = $(prefix)/$(SYSTEMDPATH)/udev
46 udevrulesdir    = $(libudevdir)/rules.d
47 multipathdir    = $(TOPDIR)/libmultipath
48 man8dir         = $(prefix)/usr/share/man/man8
49 man5dir         = $(prefix)/usr/share/man/man5
50 man3dir         = $(prefix)/usr/share/man/man3
51 syslibdir       = $(prefix)/$(LIB)
52 incdir          = $(prefix)/usr/include
53 libdir          = $(prefix)/$(LIB)/multipath
54 unitdir         = $(prefix)/$(SYSTEMDPATH)/systemd/system
55 mpathpersistdir = $(TOPDIR)/libmpathpersist
56 mpathcmddir     = $(TOPDIR)/libmpathcmd
57 thirdpartydir   = $(TOPDIR)/third-party
58 libdmmpdir      = $(TOPDIR)/libdmmp
59 includedir      = $(prefix)/usr/include
60 pkgconfdir      = $(prefix)/usr/share/pkgconfig
61
62 GZIP            = gzip -9 -c
63 RM              = rm -f
64 LN              = ln -sf
65 INSTALL_PROGRAM = install
66
67 OPTFLAGS        = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \
68                   -Werror=implicit-function-declaration -Werror=format-security \
69                   -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \
70                   -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong \
71                   --param=ssp-buffer-size=4
72
73 CFLAGS          = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
74 SHARED_FLAGS    = -shared
75
76 # Check whether a function with name $1 has been declared in header file $2.
77 check_func =                                                                   \
78     $(shell                                                                    \
79         if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
80            found=1;                                                            \
81            status="yes";                                                       \
82         else                                                                   \
83            found=0;                                                            \
84            status="no";                                                        \
85         fi;                                                                    \
86         echo 1>&2 "Checking for $1 in $2 ... $$status";                        \
87         echo "$$found"                                                         \
88     )
89
90 %.o:    %.c
91         $(CC) $(CFLAGS) -c -o $@ $<