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