add missing files by .gitignore
[external/buxton.git] / Makefile.am
1 # declare vars
2 AM_CFLAGS = -std=gnu99 -fstack-protector -Wall -pedantic \
3         -Wstrict-prototypes -Wundef -fno-common \
4         -Werror-implicit-function-declaration \
5         -Wformat -Wformat-security -Werror=format-security \
6         -Wconversion -Wunreachable-code
7 if DEBUG
8 AM_CFLAGS += -ggdb3 -O0
9 endif
10 if COVERAGE
11 AM_CFLAGS += --coverage
12 endif
13
14 AM_CPPFLAGS = \
15         -I $(top_srcdir)/src/include \
16         -I $(top_srcdir)/src/core \
17         -I $(top_srcdir)/src/security \
18         -I $(top_srcdir)/src/shared \
19         -D_MODULE_DIRECTORY=\"$(MODULEDIR)\" \
20         -D_DEFAULT_CONFIGURATION_FILE=\"$(CONFPATH)\" \
21         -D_DB_PATH=\"$(DB_PATH)\" \
22         -D_BUXTON_SOCKET=\"$(BUXTON_SOCKET)\" \
23         -D_SMACK_LOAD_FILE=\"$(SMACK_LOAD_FILE)\"
24
25 AM_LDFLAGS = \
26         -rdynamic
27
28 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
29 AUTOMAKE_OPTIONS = color-tests parallel-tests
30 SUBDIRS = .
31 noinst_LTLIBRARIES =
32 include_HEADERS =
33 lib_LTLIBRARIES =
34 pkglib_LTLIBRARIES =
35 DISTCHECK_CONFIGURE_FLAGS =  \
36         --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) --enable-debug
37
38 systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
39 systemdsystemunit_DATA = data/buxton.service data/buxton.socket
40
41 systemdsystemunit-install-hook:
42         mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants
43         ln -sf ../buxton.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/buxton.socket
44
45 install-data-local:
46         $(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/buxton
47
48 install-data-hook: systemdsystemunit-install-hook
49
50 systemdsystemunit-uninstall-hook:
51         rm -f $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/buxton.socket
52
53 uninstall-hook: systemdsystemunit-uninstall-hook
54
55 distclean-local:
56         rm -f log-check-stderr-file
57         rm -f test/databases/*.db
58
59 # set library version info
60 LIBBUXTON_CURRENT=1
61 LIBBUXTON_REVISION=0
62 LIBBUXTON_AGE=0
63
64 pkgconfiglibdir=$(libdir)/pkgconfig
65 pkgconfiglib_DATA = \
66         data/libbuxton.pc
67
68 if MANPAGE
69 dist_man_MANS = \
70         docs/buxton.7 \
71         docs/buxtonctl.1 \
72         docs/buxton-api.7 \
73         docs/buxton.conf.5 \
74         docs/buxtond.8 \
75         docs/buxton-protocol.7 \
76         docs/buxton-security.7 \
77         docs/buxton_client_handle_response.3 \
78         docs/buxton_close.3 \
79         docs/buxton_create_group.3 \
80         docs/buxton_get_value.3 \
81         docs/buxton_key_create.3 \
82         docs/buxton_key_free.3 \
83         docs/buxton_key_get_group.3 \
84         docs/buxton_key_get_layer.3 \
85         docs/buxton_key_get_name.3 \
86         docs/buxton_key_get_type.3 \
87         docs/buxton_open.3 \
88         docs/buxton_register_notification.3 \
89         docs/buxton_remove_group.3 \
90         docs/buxton_response_key.3 \
91         docs/buxton_response_status.3 \
92         docs/buxton_response_type.3 \
93         docs/buxton_response_value.3 \
94         docs/buxton_set_conf_file.3 \
95         docs/buxton_set_label.3 \
96         docs/buxton_set_value.3 \
97         docs/buxton_unregister_notification.3 \
98         docs/buxton_unset_value.3
99 endif
100
101 TESTS = \
102         check_db_clean \
103         check_buxton \
104         check_shared_lib \
105         check_daemon \
106         check_smack \
107         check_configurator
108
109 if COVERAGE
110 coverage:
111         mkdir -p coverage
112         lcov --compat-libtool --directory . --capture --output-file coverage/report
113         genhtml -o coverage/ coverage/report
114 endif
115
116 # set flags
117
118 EXTRA_DIST = \
119         Doxyfile \
120         LICENSE.LGPL2.1 \
121         check_db_clean \
122         data/libbuxton.pc.in \
123         docs/LICENSE.MIT \
124         src/libbuxton/lbuxton.sym \
125         test/test.load2 \
126         test/test.conf \
127         test/test-configurator.conf
128
129 dist_sysconf_DATA = \
130         data/buxton.conf
131
132 sbin_PROGRAMS = \
133         buxtond
134
135 bin_PROGRAMS = \
136         buxtonctl
137
138 buxtond_SOURCES = \
139         src/core/daemon.c \
140         src/core/daemon.h \
141         src/core/main.c
142
143 buxtond_LDADD = \
144         $(SYSTEMD_LIBS) \
145         libbuxton-shared.la
146
147 buxtond_CFLAGS = \
148         $(AM_CFLAGS)
149
150 buxtonctl_SOURCES = \
151         src/cli/main.c \
152         src/cli/client.c \
153         src/cli/client.h
154
155 buxtonctl_CFLAGS = \
156         $(AM_CFLAGS)
157
158 buxtonctl_LDADD = \
159         libbuxton.la \
160         libbuxton-shared.la
161
162 noinst_LTLIBRARIES += \
163         libbuxton-shared.la
164
165 libbuxton_shared_la_SOURCES = \
166         src/security/smack.c \
167         src/security/smack.h \
168         src/shared/backend.c \
169         src/shared/backend.h \
170         src/shared/buxtonarray.c \
171         src/shared/buxtonarray.h \
172         src/shared/buxtonclient.h \
173         src/shared/buxtondata.h \
174         src/shared/buxtonkey.h \
175         src/shared/buxtonlist.c \
176         src/shared/buxtonlist.h \
177         src/shared/buxtonresponse.h \
178         src/shared/buxtonstring.h \
179         src/shared/configurator.c \
180         src/shared/configurator.h \
181         src/shared/direct.c \
182         src/shared/direct.h \
183         src/shared/hashmap.c \
184         src/shared/hashmap.h \
185         src/shared/list.h \
186         src/shared/log.c \
187         src/shared/log.h \
188         src/shared/macro.h \
189         src/shared/protocol.c \
190         src/shared/protocol.h \
191         src/shared/serialize.c \
192         src/shared/serialize.h \
193         src/shared/util.c \
194         src/shared/util.h \
195         ${NULL}
196
197 if USE_LOCAL_INIPARSER
198 libbuxton_shared_la_SOURCES += \
199         src/shared/dictionary.c \
200         src/shared/dictionary.h \
201         src/shared/iniparser.c \
202         src/shared/iniparser.h
203 endif
204
205 libbuxton_shared_la_LDFLAGS = \
206         $(AM_LDFLAGS) \
207         -static
208
209 include_HEADERS += \
210         src/include/buxton.h
211
212 lib_LTLIBRARIES += \
213         libbuxton.la
214
215 libbuxton_la_SOURCES = \
216         src/libbuxton/lbuxton.c
217
218 libbuxton_la_CFLAGS = \
219         $(AM_CFLAGS) \
220         @INIPARSER_CFLAGS@ \
221         -fvisibility=hidden
222
223 libbuxton_la_LDFLAGS = \
224         $(AM_LDFLAGS) \
225         @INIPARSER_LIBS@ \
226         -version-info $(LIBBUXTON_CURRENT):$(LIBBUXTON_REVISION):$(LIBBUXTON_AGE) \
227         -Wl,--version-script=$(top_srcdir)/src/libbuxton/lbuxton.sym
228
229 libbuxton_la_LIBADD = \
230         libbuxton-shared.la \
231         -ldl
232
233 pkglib_LTLIBRARIES += \
234         gdbm.la \
235         memory.la
236
237 gdbm_la_SOURCES =  \
238         src/db/gdbm.c
239
240 gdbm_la_LDFLAGS = \
241         $(AM_LDFLAGS) \
242         -fvisibility=hidden \
243         -module \
244         -avoid-version
245
246 gdbm_la_LIBADD = \
247         -lgdbm
248
249 memory_la_SOURCES = \
250         src/db/memory.c
251
252 memory_la_LDFLAGS = \
253         $(AM_LDFLAGS) \
254         -fvisibility=hidden \
255         -module \
256         -avoid-version
257
258 check_PROGRAMS = \
259         check_buxton \
260         check_shared_lib \
261         check_buxtond \
262         check_daemon \
263         check_smack \
264         check_configurator
265
266 check_buxton_SOURCES = \
267         test/check_utils.c \
268         test/check_utils.h \
269         test/check_buxton.c
270 check_buxton_CFLAGS = \
271         $(AM_CFLAGS) \
272         @CHECK_CFLAGS@ \
273         -DMAKE_CHECK \
274         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
275         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
276 check_buxton_LDADD = \
277         @CHECK_LIBS@ \
278         libbuxton.la \
279         libbuxton-shared.la
280
281 check_shared_lib_SOURCES = \
282         test/check_utils.c \
283         test/check_utils.h \
284         test/check_shared_lib.c
285 check_shared_lib_CFLAGS = \
286         $(AM_CFLAGS) \
287         @CHECK_CFLAGS@ \
288         @INIPARSER_CFLAGS@ \
289         -DMAKE_CHECK \
290         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
291         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
292 check_shared_lib_LDADD = \
293         @CHECK_LIBS@ \
294         @INIPARSER_LIBS@ \
295         libbuxton.la \
296         libbuxton-shared.la
297
298 check_buxtond_SOURCES = \
299         test/check_utils.c \
300         test/check_utils.h \
301         src/core/daemon.c \
302         src/core/daemon.h \
303         src/core/main.c
304 check_buxtond_CFLAGS = \
305         @CHECK_CFLAGS@ \
306         $(AM_CFLAGS) \
307         @INIPARSER_CFLAGS@ \
308         -DMAKE_CHECK \
309         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
310         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
311 check_buxtond_LDADD = \
312         @CHECK_LIBS@ \
313         $(SYSTEMD_LIBS) \
314         libbuxton.la \
315         libbuxton-shared.la
316
317 check_daemon_SOURCES = \
318         test/check_utils.c \
319         test/check_utils.h \
320         src/core/daemon.c \
321         src/core/daemon.h \
322         test/check_daemon.c
323 check_daemon_CFLAGS = \
324         $(AM_CFLAGS) \
325         @CHECK_CFLAGS@ \
326         @INIPARSER_CFLAGS@ \
327         -DMAKE_CHECK \
328         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
329         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
330 check_daemon_LDADD = \
331         @CHECK_LIBS@ \
332         @INIPARSER_LIBS@ \
333         libbuxton.la \
334         libbuxton-shared.la
335
336 check_smack_SOURCES = \
337         test/check_utils.c \
338         test/check_utils.h \
339         test/check_smack.c
340 check_smack_CFLAGS = \
341         $(AM_CFLAGS) \
342         @CHECK_CFLAGS@ \
343         @INIPARSER_CFLAGS@ \
344         -DMAKE_CHECK \
345         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
346         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
347 check_smack_LDADD = \
348         @CHECK_LIBS@ \
349         @INIPARSER_LIBS@ \
350         libbuxton.la \
351         libbuxton-shared.la
352
353 check_configurator_SOURCES = \
354         src/shared/configurator.c \
355         src/shared/configurator.h \
356         test/check_configurator.c
357 check_configurator_CFLAGS = \
358         $(AM_CFLAGS) \
359         @CHECK_CFLAGS@ \
360         @INIPARSER_CFLAGS@ \
361         -DMAKE_CHECK \
362         -DABS_TOP_SRCDIR=\"$(abs_top_srcdir)\" \
363         -DABS_TOP_BUILDDIR=\"$(abs_top_builddir)\"
364 check_configurator_LDADD = \
365         @CHECK_LIBS@ \
366         @INIPARSER_LIBS@ \
367         libbuxton-shared.la
368
369 check_DATA = \
370         test/test-pass.ini \
371         test/test-fail.ini \
372         test/test.conf \
373         test/test.load2 \
374         ${NULL}
375
376 if BUILD_DEMOS
377 bin_PROGRAMS += \
378         bxt_timing \
379         bxt_hello_get \
380         bxt_hello_set \
381         bxt_hello_set_label \
382         bxt_hello_create_group \
383         bxt_hello_remove_group \
384         bxt_hello_unset \
385         bxt_hello_notify \
386         bxt_hello_notify_multi
387
388 # Timing test
389 bxt_timing_SOURCES = \
390         demo/timing.c
391 bxt_timing_LDADD = \
392         libbuxton.la \
393         libbuxton-shared.la \
394         -lrt -lm
395
396 bxt_hello_get_SOURCES = \
397         demo/helloget.c
398 bxt_hello_get_CFLAGS = \
399         $(AM_CFLAGS)
400 bxt_hello_get_LDADD = \
401         libbuxton.la
402
403 bxt_hello_set_SOURCES = \
404         demo/helloset.c
405 bxt_hello_set_CFLAGS = \
406         $(AM_CFLAGS)
407 bxt_hello_set_LDADD = \
408         libbuxton.la
409
410 bxt_hello_set_label_SOURCES = \
411         demo/hellosetlabel.c
412 bxt_hello_set_label_CFLAGS = \
413         $(AM_CFLAGS)
414 bxt_hello_set_label_LDADD = \
415         libbuxton.la
416
417 bxt_hello_create_group_SOURCES = \
418         demo/hellocreategroup.c
419 bxt_hello_create_group_CFLAGS = \
420         $(AM_CFLAGS)
421 bxt_hello_create_group_LDADD = \
422         libbuxton.la
423
424 bxt_hello_remove_group_SOURCES = \
425         demo/helloremovegroup.c
426 bxt_hello_remove_group_CFLAGS = \
427         $(AM_CFLAGS)
428 bxt_hello_remove_group_LDADD = \
429         libbuxton.la
430
431 bxt_hello_unset_SOURCES = \
432         demo/hellounset.c
433 bxt_hello_unset_CFLAGS = \
434         $(AM_CFLAGS)
435 bxt_hello_unset_LDADD = \
436         libbuxton.la
437
438 bxt_hello_notify_SOURCES = \
439         demo/hellonotify.c
440 bxt_hello_notify_CFLAGS = \
441         $(AM_CFLAGS)
442 bxt_hello_notify_LDADD = \
443         libbuxton.la
444
445 bxt_hello_notify_multi_SOURCES = \
446         demo/notifytest.c
447 bxt_hello_notify_multi_CFLAGS = \
448         $(AM_CFLAGS)
449 bxt_hello_notify_multi_LDADD = \
450         libbuxton.la
451
452 if BUILD_GTK_DEMO
453 bin_PROGRAMS += \
454         bxt_gtk_client
455 # GTK3 client demo
456 bxt_gtk_client_SOURCES = \
457         demo/gtk_client.c \
458         demo/gtk_client.h
459 bxt_gtk_client_LDADD = \
460         $(GTK3_LIBS) \
461         libbuxton.la \
462         libbuxton-shared.la
463 bxt_gtk_client_CFLAGS = \
464         $(GTK3_CFLAGS) \
465         $(AM_CFLAGS)
466 endif
467
468 endif