Imported Upstream version 0.6.4
[platform/upstream/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
59 GZIP            = gzip -9 -c
60 RM              = rm -f
61 LN              = ln -sf
62 INSTALL_PROGRAM = install
63
64 OPTFLAGS        = -O2 -g -pipe -Wall -Wextra -Wformat=2 \
65                   -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered \
66                   -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector \
67                   --param=ssp-buffer-size=4
68
69 CFLAGS          = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
70 SHARED_FLAGS    = -shared
71
72 %.o:    %.c
73         $(CC) $(CFLAGS) -c -o $@ $<