summaryrefslogtreecommitdiff
path: root/shlibs/mount/src/Makefile.am
blob: daf43c5056ced4852bcbaf1dc209b1a5b5b3d30a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
include $(top_srcdir)/config/include-Makefile.am

AM_CPPFLAGS += -I$(ul_libmount_incdir) \
	       -I$(ul_libmount_srcdir) \
	       -I$(ul_libblkid_incdir)

# includes
mountincdir = $(includedir)/libmount
nodist_mountinc_HEADERS = libmount.h

usrlib_exec_LTLIBRARIES = libmount.la
libmount_la_SOURCES =	mountP.h version.c utils.c test.c init.c cache.c \
			optstr.c optmap.c iter.c lock.c \
			fs.c tab.c tab_parse.c tab_update.c \
			context.c context_mount.c context_umount.c \
			$(mountinc_HEADERS) \
			$(top_srcdir)/lib/at.c \
			$(top_srcdir)/include/list.h \
			$(top_srcdir)/lib/mangle.c \
			$(top_srcdir)/lib/canonicalize.c \
			$(top_srcdir)/lib/strutils.c \
			$(top_srcdir)/lib/env.c

nodist_libmount_la_SOURCES = mountP.h

libmount_la_LIBADD = $(ul_libblkid_la) $(SELINUX_LIBS)

libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) libmount.sym libmount.h.in

libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/libmount.sym \
                      -version-info $(LIBMOUNT_VERSION_INFO)

TESTS_LIBS = $(UUID_LIBS)

if HAVE_SELINUX
TESTS_LIBS += $(SELINUX_LIBS)
endif

EXTRA_DIST = libmount.sym libmount.h.in
CLEANFILES = $(tests)

# move lib from $(usrlib_execdir) to $(libdir) if needed
install-exec-hook:
	if test "$(usrlib_execdir)" != "$(libdir)"; then \
		mkdir -p $(DESTDIR)$(libdir); \
		mv $(DESTDIR)$(usrlib_execdir)/libmount.so.* $(DESTDIR)$(libdir); \
		so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libmount.so); \
		so_img_rel_target=$$(echo $(usrlib_execdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \
		(cd $(DESTDIR)$(usrlib_execdir) && \
			rm -f libmount.so && \
			$(LN_S) $$so_img_rel_target$(libdir)/$$so_img_name libmount.so); \
	fi

uninstall-hook:
	rm -f $(DESTDIR)$(libdir)/libmount.so*


tests = test_version test_cache test_optstr test_lock \
		  test_tab test_utils test_tab_update test_context

tests: all $(tests)
test_%: %.c all
	$(COMPILE) -DTEST_PROGRAM $< .libs/libmount.a \
		$(ul_libblkid_builddir)/.libs/libblkid.a -o $@ \
		$(TESTS_LIBS)