1############################################################
2#	The library
3#-----------------------------------------------------------
4
5ACLOCAL_AMFLAGS = -I m4
6
7if BUILD_LIBRARY
8lib_LTLIBRARIES = libinotify.la
9
10nobase_include_HEADERS = sys/inotify.h
11
12libinotify_la_SOURCES = \
13    compat.h \
14    utils.c \
15    utils.h \
16    dep-list.c \
17    dep-list.h \
18    event-queue.c \
19    event-queue.h \
20    inotify-watch.c \
21    inotify-watch.h \
22    watch-set.c \
23    watch-set.h \
24    watch.c \
25    watch.h \
26    worker-thread.c \
27    worker-thread.h \
28    worker.c \
29    worker.h \
30    controller.c
31
32if !HAVE_ATFUNCS
33libinotify_la_SOURCES += compat/atfuncs.c
34endif
35
36if !HAVE_OPENAT
37libinotify_la_SOURCES += compat/openat.c
38endif
39
40if !HAVE_FDOPENDIR
41libinotify_la_SOURCES += compat/fdopendir.c
42endif
43
44if !HAVE_FSTATAT
45libinotify_la_SOURCES += compat/fstatat.c
46endif
47
48if NO_STDATOMIC
49if HAVE_COMPAT_STDATOMIC_H
50libinotify_la_SOURCES += compat/stdatomic.h
51else
52libinotify_la_SOURCES += compat/ik_atomic.c compat/ik_atomic.h
53endif
54endif
55
56if !HAVE_SYS_TREE_H
57libinotify_la_SOURCES += compat/tree.h
58endif
59
60libinotify_la_CFLAGS = -I. -DNDEBUG @PTHREAD_CFLAGS@ -Wall -Werror
61libinotify_la_LDFLAGS = @PTHREAD_LIBS@ -export-symbols libinotify.sym
62endif
63
64inotify_test_SOURCES = inotify-test.c
65inotify_test_LDADD = libinotify.la
66noinst_PROGRAMS = inotify-test
67
68pkgconfigdir = $(libdir)/pkgconfig
69nodist_pkgconfig_DATA = libinotify.pc
70
71EXTRA_DIST = \
72    libinotify.sym \
73    patches/freebsd11-O_SYMLINK.patch
74
75dist_man_MANS = libinotify.3
76MAN_LINKS = \
77	inotify_init.3 \
78	inotify_init1.3 \
79	inotify_add_watch.3 \
80	inotify_rm_watch.3 \
81	inotify_set_param.3 \
82	inotify_event.3
83
84install-data-hook: $(MAN_LINKS)
85
86$(MAN_LINKS):
87	(cd $(DESTDIR)$(man3dir) && rm -f $@ && $(LN_S) libinotify.3 $@)
88
89
90############################################################
91#	Test suite
92#-----------------------------------------------------------
93
94EXTRA_PROGRAMS = check_libinotify
95
96test: check_libinotify
97	@echo Running test suite...
98	@./check_libinotify
99
100.PHONY: test
101
102check_libinotify_SOURCES = \
103    tests/core/core.hh \
104    tests/core/platform.hh \
105    tests/core/log.cc \
106    tests/core/log.hh \
107    tests/core/event.cc \
108    tests/core/event.hh \
109    tests/core/action.cc \
110    tests/core/action.hh \
111    tests/core/request.cc \
112    tests/core/request.hh \
113    tests/core/response.cc \
114    tests/core/response.hh \
115    tests/core/inotify_client.cc \
116    tests/core/inotify_client.hh \
117    tests/core/consumer.cc \
118    tests/core/consumer.hh \
119    tests/core/journal.cc \
120    tests/core/journal.hh \
121    tests/core/test.cc \
122    tests/core/test.hh \
123    tests/start_stop_test.cc \
124    tests/start_stop_test.hh \
125    tests/start_stop_dir_test.cc \
126    tests/start_stop_dir_test.hh \
127    tests/fail_test.cc \
128    tests/fail_test.hh \
129    tests/notifications_test.cc \
130    tests/notifications_test.hh \
131    tests/notifications_dir_test.cc \
132    tests/notifications_dir_test.hh \
133    tests/update_flags_test.cc \
134    tests/update_flags_test.hh \
135    tests/update_flags_dir_test.cc \
136    tests/update_flags_dir_test.hh \
137    tests/open_close_test.cc \
138    tests/open_close_test.hh \
139    tests/symlink_test.cc \
140    tests/symlink_test.hh \
141    tests/bugs_test.cc \
142    tests/bugs_test.hh \
143    tests/event_queue_test.cc \
144    tests/event_queue_test.hh \
145    tests/tests.cc
146
147check_libinotify_CXXFLAGS = @PTHREAD_CFLAGS@
148check_libinotify_LDFLAGS = @PTHREAD_LIBS@
149
150if LINUX
151check_libinotify_CXXFLAGS += -std=c++0x
152endif
153
154if !HAVE_PTHREAD_BARRIER
155check_libinotify_SOURCES += compat/pthread_barrier.c
156endif
157
158if BUILD_LIBRARY
159check_libinotify_LDADD = libinotify.la
160endif
161
162noinst_programs = check_libinotify
163