Import lvm2 from NetBSD
[dragonfly.git] / contrib / lvm2 / dist / libdm / Makefile
1 #
2 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 # Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
4 #
5 # This file is part of the device-mapper userspace tools.
6 #
7 # This copyrighted material is made available to anyone wishing to use,
8 # modify, copy, or redistribute it subject to the terms and conditions
9 # of the GNU Lesser General Public License v.2.1.
10 #
11 # You should have received a copy of the GNU Lesser General Public License
12 # along with this program; if not, write to the Free Software Foundation,
13 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
15 srcdir = .
16 top_srcdir = ..
17 top_builddir = ..
18
19
20 SOURCES =\
21         datastruct/bitset.c \
22         datastruct/hash.c \
23         datastruct/list.c \
24         libdm-common.c \
25         libdm-file.c \
26         libdm-deptree.c \
27         libdm-string.c \
28         libdm-report.c \
29         mm/dbg_malloc.c \
30         mm/pool.c \
31         regex/matcher.c \
32         regex/parse_rx.c \
33         regex/ttree.c \
34         $(interface)/libdm-iface.c
35
36 INCLUDES = -I$(srcdir)/$(interface) -I$(srcdir)
37
38 ifeq ("no", "yes")
39 LIB_STATIC = $(interface)/libdevmapper.a
40 endif
41
42 ifeq ("","dylib")
43   LIB_SHARED = $(interface)/libdevmapper.dylib
44 else
45   LIB_SHARED = $(interface)/libdevmapper.so
46 endif
47 VERSIONED_SHLIB = libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
48 LIB_VERSION = $(LIB_VERSION_DM)
49
50 DEFS += -DDM_DEVICE_UID=0 -DDM_DEVICE_GID=0 \
51         -DDM_DEVICE_MODE=0600
52
53 include ../make.tmpl
54
55 device-mapper: all
56
57 .PHONY: install_dynamic install_static install_include \
58         install_ioctl install_ioctl_static \
59         install_pkgconfig
60
61 INSTALL_TYPE = install_dynamic
62
63 ifeq ("no", "yes")
64   INSTALL_TYPE += install_static
65 endif
66
67 ifeq ("no", "yes")
68   INSTALL_TYPE += install_pkgconfig
69 endif
70
71 install: $(INSTALL_TYPE) install_include
72
73 install_device-mapper: install
74
75 install_include:
76         $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(srcdir)/libdevmapper.h \
77                 $(includedir)/libdevmapper.h
78
79 install_dynamic: install_ioctl
80         $(LN_S) -f libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM) \
81                 $(libdir)/libdevmapper.$(LIB_SUFFIX)
82
83 install_static: install_ioctl_static
84         $(LN_S) -f libdevmapper.a.$(LIB_VERSION_DM) $(libdir)/libdevmapper.a
85
86 install_ioctl: ioctl/libdevmapper.$(LIB_SUFFIX)
87         $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
88                 $(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
89
90 install_pkgconfig:
91         $(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.pc \
92                 $(usrlibdir)/pkgconfig/devmapper.pc
93
94 install_ioctl_static: ioctl/libdevmapper.a
95         $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
96                 $(libdir)/libdevmapper.a.$(LIB_VERSION_DM)
97
98 $(VERSIONED_SHLIB): %.$(LIB_SUFFIX).$(LIB_VERSION_DM): $(interface)/%.$(LIB_SUFFIX)
99         rm -f $@
100         $(LN_S) $< $@
101         rm -f libdevmapper.$(LIB_SUFFIX)
102         $(LN_S) $< libdevmapper.$(LIB_SUFFIX)
103
104 CLEAN_TARGETS += libdevmapper.$(LIB_SUFFIX)
105
106 .PHONY: distclean_lib distclean
107
108 distclean_lib:
109         $(RM) libdevmapper.pc
110
111 distclean: distclean_lib