build: major cleanup
[platform/upstream/kmscon.git] / Makefile.am
1 #
2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
4 #
5
6 #
7 # Library Version Numbers
8 #
9
10 LIBELOOP_CURRENT = 1
11 LIBELOOP_REVISION = 0
12 LIBELOOP_AGE = 0
13
14 LIBTSM_CURRENT = 1
15 LIBTSM_REVISION = 0
16 LIBTSM_AGE = 0
17
18 LIBUTERM_CURRENT = 1
19 LIBUTERM_REVISION = 0
20 LIBUTERM_AGE = 0
21
22 #
23 # Global Configurations and Initializations
24 #
25
26 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
27 AM_MAKEFLAGS = --no-print-directory
28 AUTOMAKE_OPTIONS = color-tests
29
30 SUBDIRS = .
31
32 .DELETE_ON_ERROR:
33
34 include_HEADERS =
35 EXTRA_DIST = \
36         README \
37         COPYING \
38         NEWS \
39         docs/kmscon.service \
40         docs/kmsconvt@.service \
41         docs/pc/libeloop.pc.in \
42         docs/pc/libtsm.pc.in \
43         docs/pc/libuterm.pc.in \
44         docs/sym/libeloop.sym \
45         docs/sym/libtsm.sym \
46         docs/sym/libuterm.sym
47 CLEANFILES =
48 pkgconfigdir = $(libdir)/pkgconfig
49 pkgconfig_DATA =
50 MANPAGES =
51 MANPAGES_ALIASES =
52 TPHONY =
53
54 bin_PROGRAMS =
55 check_PROGRAMS =
56 noinst_PROGRAMS =
57 lib_LTLIBRARIES =
58 noinst_LTLIBRARIES =
59
60 moduledir = $(libdir)/kmscon
61 module_LTLIBRARIES =
62
63 #
64 # Default CFlags
65 # Make all files include "config.h" by default. This shouldn't cause any
66 # problems and we cannot forget to include it anymore.
67 #
68 # Also make the linker discard all unused symbols.
69 #
70 # When compiling in debug mode, we enable debug symbols so debugging with gdb
71 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
72 # Otherwise, we use standard optimizations -O2.
73 #
74
75 AM_CFLAGS = \
76         -Wall \
77         -pipe \
78         -fno-common \
79         -ffast-math \
80         -fdiagnostics-show-option \
81         -fno-strict-aliasing \
82         -fvisibility=hidden \
83         -ffunction-sections \
84         -fdata-sections \
85         -fstack-protector
86 AM_CPPFLAGS = \
87         -DBUILD_MODULE_DIR='"$(moduledir)"' \
88         -include $(top_builddir)/config.h \
89         -I $(srcdir)/src
90 AM_LDFLAGS = \
91         -Wl,--as-needed \
92         -Wl,--gc-sections \
93         -Wl,-z,relro \
94         -Wl,-z,now
95
96 if BUILD_ENABLE_DEBUG
97 AM_CFLAGS += -g
98 endif
99
100 if BUILD_ENABLE_OPTIMIZATIONS
101 AM_CFLAGS += -O2
102 else
103 AM_CFLAGS += -O0
104 endif
105
106 #
107 # GIT-HEAD helper
108 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
109 # to the string returned by "git describe". We need to adjust this string for
110 # every build and correctly rebuild any sources that depend on it. Therefore,
111 # you should use this file rarely as it causes rebuilds on every git-commit.
112 #
113 # We have a helper-script ./src/genversion.sh that takes as argument the header
114 # file and creates it if necessary. It updates it only if the new git-describe
115 # string is different to the old one. So the file is only modified on changes.
116 # Hence, we can use it as normal dependency in this Makefile.
117 # However, we need to run this script on _every_ "make" invocation before any
118 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
119 # "simply expanded" variable (:=) so the shell command is executed on
120 # variable-declaration and not during expansion.
121 #
122 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
123 # tarball might delete that file and have no way to recreate it.
124 # We could delete it on something like "make maintainerclean", but then again,
125 # it seems unnecessary so lets simply not clean it at all.
126 #
127 # If the helper-script is executed in a directory that is not a git-repository
128 # (like a distribution tarball) and githead.h exists, then it does nothing as it
129 # expects githead.h to be correctly written by "make dist".
130 # However, if githead.h does not exist, it will print a warning and write
131 # "<unknown>" as git-revision.
132 # This guarantees, that githead.h is always present and has the most correct
133 # value that we can get under any conditions.
134 #
135 # The $(emptyvariable) expansion below is used for broken $(shell ...)
136 # syntax-highlighting algorithms in many existing editors.
137 #
138
139 EXTRA_DIST += src/genversion.sh
140 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
141
142 #
143 # SHL - Static Helper Library
144 # The SHL subsystem contains several small code pieces used all over kmscon and
145 # other applications.
146 #
147
148 noinst_LTLIBRARIES += libshl.la
149
150 libshl_la_SOURCES = \
151         src/shl_dlist.h \
152         src/shl_array.h \
153         src/shl_hashtable.h \
154         external/htable.h \
155         external/htable.c \
156         src/shl_ring.h \
157         src/shl_timer.h \
158         src/shl_llog.h \
159         src/shl_hook.h \
160         src/shl_misc.h \
161         src/shl_register.h
162 libshl_la_CPPFLAGS = \
163         $(AM_CPPFLAGS) \
164         $(XKBCOMMON_CFLAGS) \
165         -pthread
166 libshl_la_LDFLAGS = \
167         $(AM_LDFLAGS) \
168         -pthread
169 libshl_la_LIBADD = \
170         $(AM_LIBADD) \
171         $(XKBCOMMON_LIBS)
172
173 #
174 # libeloop
175 # This library contains the whole event-loop implementation of kmscon. It is
176 # compiled into a separate object to allow using it in several other programs.
177 #
178
179 if BUILD_ENABLE_ELOOP
180 lib_LTLIBRARIES += libeloop.la
181 include_HEADERS += src/eloop.h
182 pkgconfig_DATA += docs/pc/libeloop.pc
183 endif
184
185 libeloop_la_SOURCES = \
186         src/eloop.h \
187         src/eloop.c
188
189 libeloop_la_LIBADD = libshl.la
190 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
191 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
192 libeloop_la_LDFLAGS = \
193         $(AM_LDFLAGS) \
194         -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
195         -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
196
197
198 if BUILD_ENABLE_ELOOP_DBUS
199 libeloop_la_SOURCES += \
200         external/dbus-common.h \
201         external/dbus-loop.h \
202         external/dbus-loop.c
203 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
204 libeloop_la_LIBADD += $(DBUS_LIBS)
205 endif
206
207 #
208 # libtsm
209 # The Terminal-emulator State Machine is a library that implements the whole VTE
210 # layer and everything related to it. It has no external dependencies so it can
211 # be used to implement any kind of terminal emulator or debugger.
212 #
213
214 if BUILD_ENABLE_TSM
215 lib_LTLIBRARIES += libtsm.la
216 include_HEADERS += \
217         src/tsm_screen.h \
218         src/tsm_unicode.h \
219         src/tsm_vte.h
220 pkgconfig_DATA += docs/pc/libtsm.pc
221 endif
222
223 libtsm_la_SOURCES = \
224         src/tsm_screen.h \
225         src/tsm_screen.c \
226         src/tsm_unicode.h \
227         src/tsm_unicode.c \
228         src/tsm_vte.h \
229         src/tsm_vte.c \
230         src/tsm_vte_charsets.c \
231         external/wcwidth.h \
232         external/wcwidth.c
233
234 libtsm_la_CPPFLAGS = \
235         $(AM_CPPFLAGS) \
236         $(XKBCOMMON_CFLAGS)
237 libtsm_la_LIBADD = \
238         $(XKBCOMMON_LIBS) \
239         libshl.la
240 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
241 libtsm_la_LDFLAGS = \
242         $(AM_LDFLAGS) \
243         -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
244         -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
245
246 #
247 # libuterm
248 # The uterm library provides helpers to create terminals in user-space. They
249 # are not limited to text-based terminals but rather provide graphics contexts
250 # so arbitrary output can be displayed. Additionally, they provide VT
251 # abstractions and an input layer
252 #
253
254 if BUILD_ENABLE_UTERM
255 lib_LTLIBRARIES += libuterm.la
256 include_HEADERS += \
257         src/uterm_input.h \
258         src/uterm_monitor.h \
259         src/uterm_video.h \
260         src/uterm_vt.h
261 pkgconfig_DATA += docs/pc/libuterm.pc
262 endif
263
264 libuterm_la_SOURCES = \
265         src/uterm_input.h \
266         src/uterm_monitor.h \
267         src/uterm_video.h \
268         src/uterm_vt.h \
269         src/uterm_input_internal.h \
270         src/uterm_video_internal.h \
271         src/uterm_systemd_internal.h \
272         src/uterm_video.c \
273         src/uterm_monitor.c \
274         src/uterm_vt.c \
275         src/uterm_input.c \
276         src/uterm_input_uxkb.c
277
278 nodist_libuterm_la_SOURCES =
279
280 libuterm_la_CPPFLAGS = \
281         $(AM_CPPFLAGS) \
282         $(XKBCOMMON_CFLAGS)
283 libuterm_la_LIBADD = \
284         $(XKBCOMMON_LIBS) \
285         libeloop.la \
286         libshl.la
287 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
288 libuterm_la_LDFLAGS = \
289         $(AM_LDFLAGS) \
290         -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
291         -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
292
293 if BUILD_ENABLE_MULTI_SEAT
294 libuterm_la_SOURCES += src/uterm_systemd.c
295 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
296 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
297 endif
298
299 if BUILD_ENABLE_HOTPLUG
300 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
301 libuterm_la_LIBADD += $(UDEV_LIBS)
302 endif
303
304 if BUILD_ENABLE_VIDEO_FBDEV
305 libuterm_la_SOURCES += \
306         src/uterm_fbdev_internal.h \
307         src/uterm_fbdev_video.c \
308         src/uterm_fbdev_render.c
309 endif
310
311 if BUILD_ENABLE_VIDEO_DRM2D
312 libuterm_la_SOURCES += \
313         src/uterm_drm2d_internal.h \
314         src/uterm_drm2d_video.c \
315         src/uterm_drm2d_render.c
316 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
317 libuterm_la_LIBADD += $(DRM_LIBS)
318 endif
319
320 if BUILD_ENABLE_VIDEO_DRM3D
321 noinst_PROGRAMS += genshader
322 libuterm_la_SOURCES += \
323         src/uterm_drm3d_internal.h \
324         src/uterm_drm3d_video.c \
325         src/uterm_drm3d_render.c \
326         src/static_gl.h \
327         src/static_gl_math.c \
328         src/static_gl_shader.c
329 nodist_libuterm_la_SOURCES += src/static_shaders.c
330 libuterm_la_CPPFLAGS += \
331         $(DRM_CFLAGS) \
332         $(EGL_CFLAGS) \
333         $(GBM_CFLAGS) \
334         $(GLES2_CFLAGS)
335 libuterm_la_LIBADD += \
336         $(DRM_LIBS) \
337         $(EGL_LIBS) \
338         $(GBM_LIBS) \
339         $(GLES2_LIBS)
340 endif
341
342 # add shared sources only once
343 UTERM_DRM_SHARED_SRC = \
344         src/uterm_drm_shared_internal.h \
345         src/uterm_drm_shared.c
346 if BUILD_ENABLE_VIDEO_DRM2D
347 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
348 else
349 if BUILD_ENABLE_VIDEO_DRM3D
350 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
351 endif
352 endif
353
354 #
355 # Shaders
356 # As there is no need to modify shaders at run-time, we statically compile them
357 # into object files. As autotools would ignore them, we need to add them to
358 # EXTRA_DIST.
359 # The program that converts the shaders into C-source files is "genshader". It's
360 # pretty simple and just creates a string with the shader source as content.
361 #
362
363 SHADERS = \
364         $(srcdir)/src/static_fill.vert \
365         $(srcdir)/src/static_fill.frag \
366         $(srcdir)/src/static_blend.vert \
367         $(srcdir)/src/static_blend.frag \
368         $(srcdir)/src/static_blit.vert \
369         $(srcdir)/src/static_blit.frag \
370         $(srcdir)/src/static_gltex.vert \
371         $(srcdir)/src/static_gltex.frag
372
373 EXTRA_DIST += $(SHADERS)
374 CLEANFILES += src/static_shaders.c
375 genshader_SOURCES = src/genshader.c
376
377 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
378         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
379
380 #
381 # Unifont Generator
382 # This generates the unifont sources from raw hex-encoded font data.
383 #
384
385 UNIFONT = src/font_unifont_data.hex
386
387 EXTRA_DIST += $(UNIFONT)
388 CLEANFILES += src/font_unifont_data.c
389 genunifont_SOURCES = src/genunifont.c
390
391 src/font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
392         $(AM_V_GEN)./genunifont$(EXEEXT) src/font_unifont_data.c $(UNIFONT)
393
394 #
395 # Kmscon Modules
396 #
397
398 if BUILD_ENABLE_FONT_UNIFONT
399 module_LTLIBRARIES += mod-unifont.la
400 noinst_PROGRAMS += genunifont
401 endif
402
403 mod_unifont_la_SOURCES = \
404         src/kmscon_module_interface.h \
405         src/githead.h \
406         src/font_unifont.c \
407         src/kmscon_mod_unifont.c
408 nodist_mod_unifont_la_SOURCES = \
409         src/font_unifont_data.c
410 mod_unifont_la_LIBADD = libshl.la
411 mod_unifont_la_LDFLAGS = \
412         $(AM_LDFLAGS) \
413         -module \
414         -avoid-version
415
416 if BUILD_ENABLE_FONT_FREETYPE2
417 module_LTLIBRARIES += mod-freetype2.la
418 endif
419
420 mod_freetype2_la_SOURCES = \
421         src/kmscon_module_interface.h \
422         src/githead.h \
423         src/font_freetype2.c \
424         src/kmscon_mod_freetype2.c
425 mod_freetype2_la_CPPFLAGS = \
426         $(AM_CPPFLAGS) \
427         $(FREETYPE2_CFLAGS)
428 mod_freetype2_la_LIBADD = \
429         $(FREETYPE2_LIBS) \
430         -lpthread \
431         libtsm.la \
432         libshl.la
433 mod_freetype2_la_LDFLAGS = \
434         $(AM_LDFLAGS) \
435         -module \
436         -avoid-version
437
438 if BUILD_ENABLE_FONT_PANGO
439 module_LTLIBRARIES += mod-pango.la
440 endif
441
442 mod_pango_la_SOURCES = \
443         src/kmscon_module_interface.h \
444         src/githead.h \
445         src/font_pango.c \
446         src/kmscon_mod_pango.c
447 mod_pango_la_CPPFLAGS = \
448         $(AM_CPPFLAGS) \
449         $(PANGO_CFLAGS)
450 mod_pango_la_LIBADD = \
451         $(PANGO_LIBS) \
452         -lpthread \
453         libtsm.la \
454         libshl.la
455 mod_pango_la_LDFLAGS = \
456         $(AM_LDFLAGS) \
457         -module \
458         -avoid-version
459
460 if BUILD_ENABLE_RENDERER_BBULK
461 module_LTLIBRARIES += mod-bbulk.la
462 endif
463
464 mod_bbulk_la_SOURCES = \
465         src/kmscon_module_interface.h \
466         src/githead.h \
467         src/text_bbulk.c \
468         src/kmscon_mod_bbulk.c
469 mod_bbulk_la_LIBADD = libshl.la
470 mod_bbulk_la_LDFLAGS = \
471         $(AM_LDFLAGS) \
472         -module \
473         -avoid-version
474
475 if BUILD_ENABLE_RENDERER_GLTEX
476 module_LTLIBRARIES += mod-gltex.la
477 noinst_PROGRAMS += genshader
478 endif
479
480 mod_gltex_la_SOURCES = \
481         src/kmscon_module_interface.h \
482         src/githead.h \
483         src/text_gltex.c \
484         src/static_gl.h \
485         src/static_gl_math.c \
486         src/static_gl_shader.c \
487         src/kmscon_mod_gltex.c
488 nodist_mod_gltex_la_SOURCES = \
489         src/static_shaders.c
490 mod_gltex_la_CPPFLAGS = \
491         $(AM_CPPFLAGS) \
492         $(GLES2_CFLAGS)
493 mod_gltex_la_LIBADD = \
494         $(GLES2_LIBS) \
495         libshl.la
496 mod_gltex_la_LDFLAGS = \
497         $(AM_LDFLAGS) \
498         -module \
499         -avoid-version
500
501 if BUILD_ENABLE_RENDERER_CAIRO
502 module_LTLIBRARIES += mod-cairo.la
503 endif
504
505 mod_cairo_la_SOURCES = \
506         src/kmscon_module_interface.h \
507         src/githead.h \
508         src/text_cairo.c \
509         src/kmscon_mod_cairo.c
510 mod_cairo_la_CPPFLAGS = \
511         $(AM_CPPFLAGS) \
512         $(CAIRO_CFLAGS)
513 mod_cairo_la_LIBADD = \
514         $(CAIRO_LIBS) \
515         libshl.la
516 mod_cairo_la_LDFLAGS = \
517         $(AM_LDFLAGS) \
518         -module \
519         -avoid-version
520
521 if BUILD_ENABLE_RENDERER_PIXMAN
522 module_LTLIBRARIES += mod-pixman.la
523 endif
524
525 mod_pixman_la_SOURCES = \
526         src/kmscon_module_interface.h \
527         src/githead.h \
528         src/text_pixman.c \
529         src/kmscon_mod_pixman.c
530 mod_pixman_la_CPPFLAGS = \
531         $(AM_CPPFLAGS) \
532         $(PIXMAN_CFLAGS)
533 mod_pixman_la_LIBADD = \
534         $(PIXMAN_LIBS) \
535         libshl.la
536 mod_pixman_la_LDFLAGS = \
537         $(AM_LDFLAGS) \
538         -module \
539         -avoid-version
540
541 #
542 # Binaries
543 # These are the sources for the main binaries and test programs. They mostly
544 # consists of a single source file only and include all the libraries that are
545 # built as part of kmscon.
546 #
547
548 if BUILD_ENABLE_KMSCON
549 bin_PROGRAMS += kmscon
550 check_PROGRAMS += \
551         test_output \
552         test_vt \
553         test_input \
554         test_key
555 MANPAGES += docs/man/kmscon.1
556 endif
557
558 kmscon_SOURCES = \
559         src/githead.h \
560         src/conf.h \
561         src/conf.c \
562         src/log.h \
563         src/log.c \
564         src/pty.h \
565         src/pty.c \
566         src/font.h \
567         src/font.c \
568         src/font_8x16.c \
569         src/text.h \
570         src/text.c \
571         src/text_bblit.c \
572         src/kmscon_module_interface.h \
573         src/kmscon_module.h \
574         src/kmscon_module.c \
575         src/kmscon_terminal.h \
576         src/kmscon_dummy.h \
577         src/kmscon_cdev.h \
578         src/kmscon_seat.h \
579         src/kmscon_seat.c \
580         src/kmscon_conf.h \
581         src/kmscon_conf.c \
582         src/kmscon_main.c
583 nodist_kmscon_SOURCES =
584
585 kmscon_CPPFLAGS = \
586         $(AM_CPPFLAGS) \
587         $(XKBCOMMON_CFLAGS)
588 kmscon_LDADD = \
589         $(XKBCOMMON_LIBS) \
590         libeloop.la \
591         libuterm.la \
592         libshl.la \
593         -lpthread \
594         -ldl
595 kmscon_LDFLAGS = \
596         $(AM_LDFLAGS) \
597         -rdynamic
598
599 if BUILD_ENABLE_SESSION_DUMMY
600 kmscon_SOURCES += src/kmscon_dummy.c
601 endif
602
603 if BUILD_ENABLE_SESSION_TERMINAL
604 kmscon_SOURCES += src/kmscon_terminal.c
605 kmscon_LDADD += libtsm.la
606 endif
607
608 if BUILD_ENABLE_SESSION_CDEV
609 kmscon_SOURCES += src/kmscon_cdev.c
610 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
611 kmscon_LDADD += $(FUSE_LIBS)
612 endif
613
614 #
615 # Wayland Terminal
616 #
617
618 if BUILD_ENABLE_WLTERM
619 bin_PROGRAMS += wlterm
620 endif
621
622 wlterm_SOURCES = \
623         src/wlt_main.h \
624         src/wlt_main.c \
625         src/wlt_toolkit.h \
626         src/wlt_toolkit.c \
627         src/wlt_theme.h \
628         src/wlt_theme.c \
629         src/wlt_terminal.h \
630         src/wlt_terminal.c \
631         src/log.h \
632         src/log.c \
633         src/conf.h \
634         src/conf.c \
635         src/pty.h \
636         src/pty.c \
637         src/font.h \
638         src/font.c \
639         src/font_8x16.c \
640         src/font_pango.c
641 wlterm_CPPFLAGS = \
642         $(AM_CPPFLAGS) \
643         $(WAYLAND_CFLAGS) \
644         $(PANGO_CFLAGS) \
645         $(XKBCOMMON_CFLAGS)
646 wlterm_LDADD = \
647         $(WAYLAND_LIBS) \
648         $(PANGO_LIBS) \
649         $(XKBCOMMON_LIBS) \
650         libeloop.la \
651         libtsm.la \
652         libshl.la \
653         -lpthread
654
655 #
656 # Tests
657 #
658
659 test_sources = \
660         src/log.h \
661         src/log.c \
662         src/conf.h \
663         src/conf.c \
664         tests/test_include.h
665 test_cflags = \
666         $(AM_CPPFLAGS) \
667         $(XKBCOMMON_CFLAGS)
668 test_libs = \
669         $(XKBCOMMON_LIBS) \
670         libeloop.la
671
672 test_output_SOURCES = \
673         $(test_sources) \
674         tests/test_output.c
675 test_output_CPPFLAGS = $(test_cflags)
676 test_output_LDADD = \
677         $(test_libs) \
678         libuterm.la
679
680 test_vt_SOURCES = \
681         $(test_sources) \
682         tests/test_vt.c
683 test_vt_CPPFLAGS = $(test_cflags)
684 test_vt_LDADD = \
685         $(test_libs) \
686         libuterm.la
687
688 test_input_SOURCES = \
689         $(test_sources) \
690         tests/test_input.c
691 test_input_CPPFLAGS = $(test_cflags)
692 test_input_LDADD = \
693         $(test_libs) \
694         libuterm.la
695
696 test_key_SOURCES = \
697         $(test_sources) \
698         tests/test_key.c
699 test_key_CPPFLAGS = $(test_cflags)
700 test_key_LDADD = $(test_libs)
701
702 #
703 # Manpages
704 #
705
706 man_MANS =
707 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
708 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
709
710 if BUILD_HAVE_XSLTPROC
711 if BUILD_HAVE_MANPAGES_STYLESHEET
712
713 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
714
715 XSLTPROC_FLAGS = \
716         --stringparam man.authors.section.enabled 0 \
717         --stringparam man.copyright.section.enabled 0 \
718         --stringparam funcsynopsis.style ansi \
719         --stringparam man.output.quietly 1 \
720         --nonet
721
722 XSLTPROC_PROCESS_MAN = \
723         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
724         $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
725         touch .man_fixup
726
727 # Force .man_fixup if $(MANPAGES) are not built
728 .man_fixup: | $(MANPAGES)
729         @touch .man_fixup
730
731 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
732         $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
733
734 docs/man/%.1: docs/man/%.xml
735         $(XSLTPROC_PROCESS_MAN)
736
737 docs/man/%.3: docs/man/%.xml
738         $(XSLTPROC_PROCESS_MAN)
739
740 docs/man/%.5: docs/man/%.xml
741         $(XSLTPROC_PROCESS_MAN)
742
743 docs/man/%.7: docs/man/%.xml
744         $(XSLTPROC_PROCESS_MAN)
745
746 endif # BUILD_HAVE_MANPAGES_STYLESHEET
747 endif # BUILD_HAVE_XSLTPROC
748
749 #
750 # Phony targets
751 #
752
753 .PHONY: $(TPHONY)