mpathpersist: Add new utility for managing persistent reservation on dm multipath...
[platform/upstream/multipath-tools.git] / Makefile
1 # Makefile
2 #
3 # Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
4 #
5
6 #
7 # Try to supply the linux kernel headers.
8 #
9 ifeq    ($(KRNLSRC),)
10 KRNLLIB = /lib/modules/$(shell uname -r)
11 ifeq    ($(shell test -r $(KRNLLIB)/source && echo 1),1)
12 KRNLSRC = $(KRNLLIB)/source
13 KRNLOBJ = $(KRNLLIB)/build
14 else
15 KRNLSRC = $(KRNLLIB)/build
16 KRNLOBJ = $(KRNLLIB)/build
17 endif
18 endif
19 export KRNLSRC
20 export KRNLOBJ
21
22 BUILDDIRS = \
23         libmultipath \
24         libmultipath/prioritizers \
25         libmultipath/checkers \
26         libmpathpersist \
27         multipath \
28         multipathd \
29         mpathpersist \
30         kpartx
31
32 ifeq   ($(MULTIPATH_VERSION),)
33 VERSION = $(shell basename ${PWD} | cut -d'-' -f3)
34 else
35 VERSION = $(MULTIPATH_VERSION)
36 endif
37
38 all: recurse
39
40 recurse:
41         @for dir in $(BUILDDIRS); do \
42         $(MAKE) -C $$dir BUILD=$(BUILD) VERSION=$(VERSION) \
43                 KRNLSRC=$(KRNLSRC) KRNLOBJ=$(KRNLOBJ) || exit $?; \
44         done
45
46 recurse_clean:
47         @for dir in $(BUILDDIRS); do \
48         $(MAKE) -C $$dir clean || exit $?; \
49         done
50
51 recurse_install:
52         @for dir in $(BUILDDIRS); do \
53         $(MAKE) -C $$dir install || exit $?; \
54         done
55
56 recurse_uninstall:
57         @for dir in $(BUILDDIRS); do \
58         $(MAKE) -C $$dir uninstall || exit $?; \
59         done
60
61 clean:  recurse_clean
62         rm -f multipath-tools.spec
63         rm -rf rpms
64
65 install:        recurse_install
66
67 uninstall:      recurse_uninstall
68
69 release:
70         sed -e "s/__VERSION__/${VERSION}/" \
71         multipath-tools.spec.in > multipath-tools.spec
72
73 rpm: release
74         rpmbuild -bb multipath-tools.spec