Imported Upstream version 0.6.0
[platform/upstream/multipath-tools.git] / Makefile.inc
1 # Makefile.inc
2 #
3 # Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
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 mandir      = $(prefix)/usr/share/man/man8
49 man5dir     = $(prefix)/usr/share/man/man5
50 man3dir      = $(prefix)/usr/share/man/man3
51 rcdir       = $(prefix)/etc/init.d
52 syslibdir   = $(prefix)/$(LIB)
53 incdir      = $(prefix)/usr/include
54 libdir      = $(prefix)/$(LIB)/multipath
55 unitdir     = $(prefix)/$(SYSTEMDPATH)/systemd/system
56 mpathpersistdir = $(TOPDIR)/libmpathpersist
57 mpathcmddir = $(TOPDIR)/libmpathcmd
58
59 GZIP        = gzip -9 -c
60 INSTALL_PROGRAM = install
61
62 ifndef RPM_OPT_FLAGS
63         RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
64 endif
65
66 OPTFLAGS     = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes
67 CFLAGS       = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
68 SHARED_FLAGS = -shared
69
70 %.o:    %.c
71         $(CC) $(CFLAGS) -c -o $@ $<
72