# Makefile.inc
#
-# Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@free.fr>
+# Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#
# Allow to force some libraries to be used statically. (Uncomment one of the
TOPDIR = ..
endif
-ifeq ($(strip $(BUILD)),klibc)
- CC = klcc
- klibcdir = /usr/lib/klibc
- libdm = $(klibcdir)/lib/libdevmapper.a
+ifndef LIB
+ ifeq ($(shell test -d /lib64 && echo 1),1)
+ LIB=lib64
+ else
+ LIB=lib
+ endif
+endif
+
+ifndef RUN
+ ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
+ RUN=run
+ else
+ RUN=var/run
+ endif
+endif
+
+ifndef SYSTEMD
+ ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1)
+ SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p')
+ endif
+endif
+
+ifndef SYSTEMDPATH
+ SYSTEMDPATH=usr/lib
endif
prefix =
exec_prefix = $(prefix)
bindir = $(exec_prefix)/sbin
-libudevdir = ${prefix}/lib/udev
-checkersdir = $(TOPDIR)/libcheckers
+libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
+udevrulesdir = $(libudevdir)/rules.d
multipathdir = $(TOPDIR)/libmultipath
mandir = $(prefix)/usr/share/man/man8
man5dir = $(prefix)/usr/share/man/man5
+man3dir = $(prefix)/usr/share/man/man3
rcdir = $(prefix)/etc/init.d
+syslibdir = $(prefix)/$(LIB)
+incdir = $(prefix)/usr/include
+libdir = $(prefix)/$(LIB)/multipath
+unitdir = $(prefix)/$(SYSTEMDPATH)/systemd/system
+mpathpersistdir = $(TOPDIR)/libmpathpersist
+mpathcmddir = $(TOPDIR)/libmpathcmd
-GZIP = /bin/gzip -9 -c
+GZIP = gzip -9 -c
+INSTALL_PROGRAM = install
-CHECKERSLIB = $(checkersdir)/libcheckers
-MULTIPATHLIB = $(multipathdir)/libmultipath
-
-INSTALL_PROGRAM = install -s
+ifndef RPM_OPT_FLAGS
+ RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
+endif
-OPTFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
-CFLAGS = $(OPTFLAGS)
+OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes
+CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\"
+SHARED_FLAGS = -shared
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<