summaryrefslogtreecommitdiffstats
path: root/liblastlog2/src/Makemodule.am
blob: 04b8e97458b052db6723eae2762945796b3e375b (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# includes
lastlog2incdir = $(includedir)/liblastlog2
lastlog2inc_HEADERS = liblastlog2/src/lastlog2.h

usrlib_exec_LTLIBRARIES += liblastlog2.la

liblastlog2_la_SOURCES = \
	liblastlog2/src/lastlog2.c \
	liblastlog2/src/lastlog2P.h

EXTRA_liblastlog2_la_DEPENDENCIES = \
	liblastlog2/src/liblastlog2.sym

liblastlog2_la_LIBADD = $(SQLITE3_LIBS)

liblastlog2_la_CFLAGS = \
	$(AM_CFLAGS) \
	 $(SOLIB_CFLAGS) \
	 -I$(ul_liblastlog2_incdir) \
	 -I$(top_srcdir)/liblastlog2/src

liblastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS)
if HAVE_VSCRIPT
liblastlog2_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(top_srcdir)/liblastlog2/src/liblastlog2.sym
endif
liblastlog2_la_LDFLAGS += -version-info $(LIBLASTLOG2_VERSION_INFO)

EXTRA_DIST += liblastlog2/src/liblastlog2.sym


if BUILD_LIBLASTLOG2_TESTS
check_PROGRAMS += \
	test_lastlog2_dlopen \
	test_lastlog2_pam_lastlog2_output \
	test_lastlog2_remove_entry \
	test_lastlog2_rename_user \
	test_lastlog2_write_read_user \
	test_lastlog2_y2038_ll2_read_all \
	test_lastlog2_y2038_sqlite3_time

lastlog2_tests_cflags  = -DTEST_PROGRAM $(liblastlog2_la_CFLAGS)
lastlog2_tests_ldflags = -static
lastlog2_tests_ldadd   = $(LDADD) liblastlog2.la $(SOLIB_LDFLAGS) $(SQLITE3_LIBS)

test_lastlog2_dlopen_SOURCES = liblastlog2/src/tests/tst_dlopen.c
test_lastlog2_dlopen_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_dlopen_LDFLAGS = $(lastlog2_tests_ldflags) -ldl
test_lastlog2_dlopen_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_pam_lastlog2_output_SOURCES = liblastlog2/src/tests/tst_pam_lastlog2_output.c
test_lastlog2_pam_lastlog2_output_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_pam_lastlog2_output_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_pam_lastlog2_output_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_remove_entry_SOURCES = liblastlog2/src/tests/tst_remove_entry.c
test_lastlog2_remove_entry_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_remove_entry_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_remove_entry_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_rename_user_SOURCES = liblastlog2/src/tests/tst_rename_user.c
test_lastlog2_rename_user_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_rename_user_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_rename_user_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_write_read_user_SOURCES = liblastlog2/src/tests/tst_write_read_user.c
test_lastlog2_write_read_user_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_write_read_user_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_write_read_user_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_y2038_ll2_read_all_SOURCES = liblastlog2/src/tests/tst_y2038_ll2_read_all.c
test_lastlog2_y2038_ll2_read_all_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_y2038_ll2_read_all_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_y2038_ll2_read_all_LDADD = $(lastlog2_tests_ldadd)

test_lastlog2_y2038_sqlite3_time_SOURCES = liblastlog2/src/tests/tst_y2038_sqlite3_time.c
test_lastlog2_y2038_sqlite3_time_CFLAGS = $(lastlog2_tests_cflags)
test_lastlog2_y2038_sqlite3_time_LDFLAGS = $(lastlog2_tests_ldflags)
test_lastlog2_y2038_sqlite3_time_LDADD = $(lastlog2_tests_ldadd)

endif #BUILD_LIBLIBLASTLOG2_TESTS


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

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

INSTALL_EXEC_HOOKS += install-exec-hook-liblastlog2
UNINSTALL_HOOKS += uninstall-hook-liblastlog2