xref: /dragonfly/contrib/lvm2/dist/libdm/Makefile (revision 0ca59c34)
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
15srcdir = .
16top_srcdir = ..
17top_builddir = ..
18
19
20SOURCES =\
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
36INCLUDES = -I$(srcdir)/$(interface) -I$(srcdir)
37
38ifeq ("no", "yes")
39LIB_STATIC = $(interface)/libdevmapper.a
40endif
41
42ifeq ("","dylib")
43  LIB_SHARED = $(interface)/libdevmapper.dylib
44else
45  LIB_SHARED = $(interface)/libdevmapper.so
46endif
47VERSIONED_SHLIB = libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
48LIB_VERSION = $(LIB_VERSION_DM)
49
50DEFS += -DDM_DEVICE_UID=0 -DDM_DEVICE_GID=0 \
51	-DDM_DEVICE_MODE=0600
52
53include ../make.tmpl
54
55device-mapper: all
56
57.PHONY: install_dynamic install_static install_include \
58	install_ioctl install_ioctl_static \
59	install_pkgconfig
60
61INSTALL_TYPE = install_dynamic
62
63ifeq ("no", "yes")
64  INSTALL_TYPE += install_static
65endif
66
67ifeq ("no", "yes")
68  INSTALL_TYPE += install_pkgconfig
69endif
70
71install: $(INSTALL_TYPE) install_include
72
73install_device-mapper: install
74
75install_include:
76	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(srcdir)/libdevmapper.h \
77		$(includedir)/libdevmapper.h
78
79install_dynamic: install_ioctl
80	$(LN_S) -f libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM) \
81		$(libdir)/libdevmapper.$(LIB_SUFFIX)
82
83install_static: install_ioctl_static
84	$(LN_S) -f libdevmapper.a.$(LIB_VERSION_DM) $(libdir)/libdevmapper.a
85
86install_ioctl: ioctl/libdevmapper.$(LIB_SUFFIX)
87	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
88		$(libdir)/libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION_DM)
89
90install_pkgconfig:
91	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.pc \
92		$(usrlibdir)/pkgconfig/devmapper.pc
93
94install_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
104CLEAN_TARGETS += libdevmapper.$(LIB_SUFFIX)
105
106.PHONY: distclean_lib distclean
107
108distclean_lib:
109	$(RM) libdevmapper.pc
110
111distclean: distclean_lib
112