xref: /dragonfly/contrib/lvm2/dist/liblvm/Makefile (revision 25a2db75)
1#
2# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3# Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
4#
5# This file is part of LVM2.
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 General Public License v.2.
10#
11# You should have received a copy of the GNU 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	lvm_base.c \
22	lvm_lv.c \
23	lvm_pv.c \
24	lvm_vg.c
25
26LIB_NAME = liblvm2app
27LIB_VERSION = $(LIB_VERSION_APP)
28VERSIONED_SHLIB = $(LIB_NAME).$(LIB_SUFFIX).$(LIB_VERSION_APP)
29
30ifeq ("no", "yes")
31  LIB_STATIC = $(LIB_NAME).a
32endif
33
34ifeq ("","dylib")
35  LIB_SHARED = $(LIB_NAME).dylib
36else
37  LIB_SHARED = $(LIB_NAME).so
38endif
39
40CLEAN_TARGETS += liblvm.cflow
41
42include ../make.tmpl
43
44LIBS += -ldevmapper -llvm-internal
45
46ifeq ("", "yes")
47  LIBS += -ldevmapper-event
48endif
49
50$(VERSIONED_SHLIB): %.$(LIB_SUFFIX).$(LIB_VERSION_APP): %.$(LIB_SUFFIX)
51	rm -f $@
52	$(LN_S) $< $@
53
54.PHONY: install_dynamic install_static install_include install_pkgconfig \
55	distclean_lib distclean
56
57INSTALL_TYPE = install_dynamic
58
59ifeq ("no", "yes")
60  INSTALL_TYPE += install_static
61endif
62
63ifeq ("no", "yes")
64  INSTALL_TYPE += install_pkgconfig
65endif
66
67install: $(INSTALL_TYPE) install_include
68
69install_include:
70	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(srcdir)/lvm2app.h $(includedir)/lvm2app.h
71
72install_dynamic: $(LIB_SHARED)
73	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
74		$(libdir)/$(LIB_SHARED).$(LIB_VERSION_APP)
75	$(LN_S) -f $(LIB_SHARED).$(LIB_VERSION_APP) \
76		$(libdir)/$(LIB_SHARED)
77
78install_static: $(LIB_STATIC)
79	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
80		$(libdir)/$(LIB_STATIC).$(LIB_VERSION_APP)
81	$(LN_S) -f $(LIB_STATIC).$(LIB_VERSION_APP) $(libdir)/$(LIB_STATIC)
82
83install_pkgconfig:
84	$(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(LIB_NAME).pc \
85		$(usrlibdir)/pkgconfig/lvm2app.pc
86
87liblvm.cflow: $(SOURCES)
88	set -e; (echo -n "SOURCES += "; \
89		 echo $(SOURCES) | \
90		 sed "s/^/ /;s/ / $(top_srcdir)\/liblvm\//g;s/$$//"; \
91		 ) > $@
92
93cflow: liblvm.cflow
94
95CLEAN_TARGETS += $(LIB_NAME).$(LIB_SUFFIX)
96
97distclean_lib:
98	$(RM) $(LIB_NAME).pc
99
100distclean: distclean_lib
101