Add manpage infrastructure and kmscon.1 manpage
[platform/upstream/kmscon.git] / Makefile.am
1 #
2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
4 #
5
6 ACLOCAL_AMFLAGS = -I m4
7 SUBDIRS = \
8         .
9 include_HEADERS =
10 EXTRA_DIST = \
11         README \
12         COPYING \
13         NEWS
14 CLEANFILES =
15 pkgconfigdir = $(libdir)/pkgconfig
16 pkgconfig_DATA =
17 MANPAGES =
18 MANPAGES_ALIASES =
19
20 bin_PROGRAMS =
21 check_PROGRAMS =
22 noinst_PROGRAMS = \
23         genshader \
24         genunifont
25 noinst_LTLIBRARIES =
26 lib_LTLIBRARIES =
27
28 #
29 # Default CFlags
30 # Make all files include "config.h" by default. This shouldn't cause any
31 # problems and we cannot forget to include it anymore.
32 #
33 # Also make the linker discard all unused symbols.
34 #
35 # When compiling in debug mode, we enable debug symbols so debugging with gdb
36 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
37 # Otherwise, we use standard optimizations -O2.
38 #
39
40 AM_CFLAGS = \
41         -Wall
42 AM_CPPFLAGS = \
43         -include $(top_builddir)/config.h \
44         -I $(srcdir)/src
45 AM_LDFLAGS = \
46         -Wl,--as-needed
47
48 if BUILD_ENABLE_DEBUG
49 AM_CFLAGS += -g
50 endif
51
52 if BUILD_ENABLE_OPTIMIZATIONS
53 AM_CFLAGS += -O2
54 else
55 AM_CFLAGS += -O0
56 endif
57
58 #
59 # SHL - Static Helper Library
60 # The SHL subsystem contains several small code pieces used all over kmscon and
61 # other applications.
62 #
63 # Simply include $(SHL_*) in your source-file list. Except for SHL_MISC none of
64 # these have external dependencies. SHL_MISC needs xkbcommon.
65 #
66
67 SHL_DLIST = \
68         src/shl_dlist.h
69 SHL_ARRAY = \
70         src/shl_array.h
71 SHL_HASHTABLE = \
72         src/shl_hashtable.h \
73         external/htable.h \
74         external/htable.c
75 SHL_RING = \
76         src/shl_ring.h
77 SHL_TIMER = \
78         src/shl_timer.h
79 SHL_LLOG = \
80         src/shl_llog.h
81 SHL_HOOK = \
82         src/shl_hook.h \
83         $(SHL_DLIST)
84 SHL_MISC = \
85         src/shl_misc.h
86
87 #
88 # libeloop
89 # This library contains the whole event-loop implementation of kmscon. It is
90 # compiled into a separate object to allow using it in several other programs.
91 #
92
93 if BUILD_ENABLE_ELOOP
94 lib_LTLIBRARIES += libeloop.la
95 include_HEADERS += src/eloop.h
96 pkgconfig_DATA += docs/pc/libeloop.pc
97 endif
98
99 libeloop_la_SOURCES = \
100         $(SHL_DLIST) \
101         $(SHL_LLOG) \
102         $(SHL_HOOK) \
103         src/eloop.h \
104         src/eloop.c
105
106 libeloop_la_CPPFLAGS = \
107         $(AM_CPPFLAGS)
108 libeloop_la_LIBADD =
109 libeloop_la_LDFLAGS = \
110         -version-info 1:0:0
111
112
113 if BUILD_ENABLE_ELOOP_DBUS
114 libeloop_la_SOURCES += \
115         external/dbus-common.h \
116         external/dbus-loop.h \
117         external/dbus-loop.c
118 libeloop_la_CPPFLAGS += \
119         $(DBUS_CFLAGS)
120 libeloop_la_LIBADD += \
121         $(DBUS_LIBS)
122 endif
123
124 #
125 # libtsm
126 # The Terminal-emulator State Machine is a library that implements the whole VTE
127 # layer and everything related to it. It has no external dependencies so it can
128 # be used to implement any kind of terminal emulator or debugger.
129 #
130
131 if BUILD_ENABLE_TSM
132 lib_LTLIBRARIES += \
133         libtsm.la
134 include_HEADERS += \
135         src/tsm_screen.h \
136         src/tsm_unicode.h \
137         src/tsm_vte.h
138 pkgconfig_DATA += \
139         docs/pc/libtsm.pc
140 endif
141
142 libtsm_la_SOURCES = \
143         $(SHL_LLOG) \
144         $(SHL_TIMER) \
145         $(SHL_ARRAY) \
146         $(SHL_HASHTABLE) \
147         src/tsm_screen.h \
148         src/tsm_screen.c \
149         src/tsm_unicode.h \
150         src/tsm_unicode.c \
151         src/tsm_vte.h \
152         src/tsm_vte.c \
153         src/tsm_vte_charsets.c
154
155 libtsm_la_CPPFLAGS = \
156         $(AM_CPPFLAGS) \
157         $(XKBCOMMON_CFLAGS)
158 libtsm_la_LDFLAGS = \
159         $(XKBCOMMON_LIBS) \
160         -version-info 1:0:0
161
162 #
163 # libuterm
164 # The uterm library provides helpers to create terminals in user-space. They
165 # are not limited to text-based terminals but rather provide graphics contexts
166 # so arbitrary output can be displayed. Additionally, they provide VT
167 # abstractions and an input layer
168 #
169
170 if BUILD_ENABLE_UTERM
171 lib_LTLIBRARIES += libuterm.la
172 include_HEADERS += src/uterm.h
173 pkgconfig_DATA += docs/pc/libuterm.pc
174 endif
175
176 libuterm_la_SOURCES = \
177         $(SHL_DLIST) \
178         $(SHL_HOOK) \
179         $(SHL_MISC) \
180         src/uterm.h \
181         src/uterm_input.h \
182         src/uterm_video.h \
183         src/uterm_pci.h \
184         src/uterm_systemd.h \
185         src/uterm_video.c \
186         src/uterm_monitor.c \
187         src/uterm_vt.c \
188         src/uterm_input.c \
189         src/uterm_input_uxkb.c
190
191 nodist_libuterm_la_SOURCES =
192
193 libuterm_la_CPPFLAGS = \
194         $(AM_CPPFLAGS) \
195         $(XKBCOMMON_CFLAGS)
196 libuterm_la_LIBADD =
197         $(XKBCOMMON_LIBS) \
198         libeloop.la
199 libuterm_la_LDFLAGS = \
200         -version-info 1:0:0
201
202 if BUILD_ENABLE_MULTI_SEAT
203 libuterm_la_SOURCES += src/uterm_systemd.c
204 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
205 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
206 endif
207
208 if BUILD_ENABLE_HOTPLUG
209 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
210 libuterm_la_LIBADD += $(UDEV_LIBS)
211 endif
212
213 if BUILD_ENABLE_PCIACCESS
214 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
215 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
216 libuterm_la_SOURCES += src/uterm_pci.c
217 endif
218
219 if BUILD_ENABLE_VIDEO_FBDEV
220 libuterm_la_SOURCES += src/uterm_video_fbdev.c
221 endif
222
223 if BUILD_ENABLE_VIDEO_DUMB
224 libuterm_la_SOURCES += src/uterm_video_dumb.c
225 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
226 libuterm_la_LIBADD += $(DRM_LIBS)
227 endif
228
229 if BUILD_ENABLE_VIDEO_DRM
230 libuterm_la_SOURCES += \
231         src/uterm_video_drm.c \
232         src/static_gl.h \
233         src/static_gl_math.c \
234         src/static_gl_shader.c
235 nodist_libuterm_la_SOURCES += \
236         src/static_shaders.c
237 libuterm_la_CPPFLAGS += \
238         $(DRM_CFLAGS) \
239         $(EGL_CFLAGS) \
240         $(GBM_CFLAGS) \
241         $(GLES2_CFLAGS)
242 libuterm_la_LIBADD += \
243         $(DRM_LIBS) \
244         $(EGL_LIBS) \
245         $(GBM_LIBS) \
246         $(GLES2_LIBS)
247 endif
248
249 #
250 # Shaders
251 # As there is no need to modify shaders at run-time, we statically compile them
252 # into object files. As autotools would ignore them, we need to add them to
253 # EXTRA_DIST.
254 # The program that converts the shaders into C-source files is "genshader". It's
255 # pretty simple and just creates a string with the shader source as content.
256 #
257
258 SHADERS = \
259         $(srcdir)/src/static_fill.vert \
260         $(srcdir)/src/static_fill.frag \
261         $(srcdir)/src/static_blend.vert \
262         $(srcdir)/src/static_blend.frag \
263         $(srcdir)/src/static_blit.vert \
264         $(srcdir)/src/static_blit.frag \
265         $(srcdir)/src/static_gltex.vert \
266         $(srcdir)/src/static_gltex.frag
267
268 EXTRA_DIST += $(SHADERS)
269 CLEANFILES += src/static_shaders.c
270 genshader_SOURCES = src/genshader.c
271
272 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
273         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
274
275 #
276 # Unifont Generator
277 # This generates the unifont sources from raw hex-encoded font data.
278 #
279
280 UNIFONT = src/text_font_unifont_data.hex
281
282 EXTRA_DIST += $(UNIFONT)
283 CLEANFILES += src/text_font_unifont_data.c
284 genunifont_SOURCES = src/genunifont.c
285
286 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
287         $(AM_V_GEN)./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
288
289 #
290 # Text-font library
291 # The text-font library is used by kmscon _and_ wlterm but is currently linked
292 # statically as it hasn't been cleaned up entirely.
293 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
294 #
295
296 if BUILD_ENABLE_KMSCON
297 noinst_LTLIBRARIES += libtext-font.la
298 else
299 if BUILD_ENABLE_WLTERM
300 noinst_LTLIBRARIES += libtext-font.la
301 endif
302 endif
303
304 libtext_font_la_SOURCES = \
305         $(SHL_DLIST) \
306         $(SHL_HASHTABLE) \
307         $(SHL_HOOK) \
308         src/text.h \
309         src/text_font.c
310 nodist_libtext_font_la_SOURCES =
311
312 libtext_font_la_CPPFLAGS = \
313         $(AM_CPPFLAGS)
314 libtext_font_la_LIBADD = \
315         -lpthread \
316         libtsm.la
317
318 if BUILD_ENABLE_FONT_8X16
319 libtext_font_la_SOURCES += src/text_font_8x16.c
320 endif
321
322 if BUILD_ENABLE_FONT_UNIFONT
323 libtext_font_la_SOURCES += src/text_font_unifont.c
324 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
325 endif
326
327 if BUILD_ENABLE_FONT_FREETYPE2
328 libtext_font_la_SOURCES += src/text_font_freetype2.c
329 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
330 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
331 endif
332
333 if BUILD_ENABLE_FONT_PANGO
334 libtext_font_la_SOURCES += src/text_font_pango.c
335 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
336 libtext_font_la_LIBADD += $(PANGO_LIBS)
337 endif
338
339 #
340 # Binaries
341 # These are the sources for the main binaries and test programs. They mostly
342 # consists of a single source file only and include all the libraries that are
343 # built as part of kmscon.
344 #
345
346 if BUILD_ENABLE_KMSCON
347 bin_PROGRAMS += kmscon
348 check_PROGRAMS += \
349         test_output \
350         test_vt \
351         test_input \
352         test_key
353 endif
354
355 kmscon_SOURCES = \
356         $(SHL_DLIST) \
357         $(SHL_MISC) \
358         $(SHL_ARRAY) \
359         $(SHL_HASHTABLE) \
360         $(SHL_RING) \
361         $(SHL_TIMER) \
362         $(SHL_HOOK) \
363         src/conf.h \
364         src/conf.c \
365         src/log.h \
366         src/log.c \
367         src/pty.h \
368         src/pty.c \
369         src/text.h \
370         src/text.c \
371         src/kmscon_terminal.h \
372         src/kmscon_dummy.h \
373         src/kmscon_compositor.h \
374         src/kmscon_seat.h \
375         src/kmscon_seat.c \
376         src/kmscon_conf.h \
377         src/kmscon_conf.c \
378         src/kmscon_main.c
379 nodist_kmscon_SOURCES =
380
381 kmscon_CPPFLAGS = \
382         $(AM_CPPFLAGS) \
383         $(XKBCOMMON_CFLAGS)
384 kmscon_LDADD = \
385         $(XKBCOMMON_LIBS) \
386         libeloop.la \
387         libuterm.la \
388         libtext-font.la \
389         -lpthread
390
391 if BUILD_ENABLE_SESSION_DUMMY
392 kmscon_SOURCES += src/kmscon_dummy.c
393 endif
394
395 if BUILD_ENABLE_SESSION_TERMINAL
396 kmscon_SOURCES += src/kmscon_terminal.c
397 kmscon_LDADD += libtsm.la
398 endif
399
400 if BUILD_ENABLE_SESSION_CDEV
401 kmscon_SOURCES += src/kmscon_cdev.c
402 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
403 kmscon_LDADD += $(FUSE_LIBS)
404 endif
405
406 if BUILD_ENABLE_SESSION_COMPOSITOR
407 kmscon_SOURCES += src/kmscon_compositor.c
408 kmscon_CPPFLAGS += $(WAYLAND_CFLAGS)
409 kmscon_LDADD += $(WAYLAND_LIBS)
410 endif
411
412 if BUILD_ENABLE_RENDERER_BBLIT
413 kmscon_SOURCES += src/text_bblit.c
414 endif
415
416 if BUILD_ENABLE_RENDERER_BBULK
417 kmscon_SOURCES += src/text_bbulk.c
418 endif
419
420 if BUILD_ENABLE_RENDERER_GLTEX
421 kmscon_SOURCES += \
422         src/text_gltex.c \
423         src/static_gl.h \
424         src/static_gl_math.c \
425         src/static_gl_shader.c
426 nodist_kmscon_SOURCES += src/static_shaders.c
427 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
428 kmscon_LDADD += $(GLES2_LIBS)
429 MANPAGES += docs/man/kmscon.1
430 endif
431
432 #
433 # Wayland Terminal
434 #
435
436 if BUILD_ENABLE_WLTERM
437 bin_PROGRAMS += wlterm
438 endif
439
440 wlterm_SOURCES = \
441         $(SHL_MISC) \
442         $(SHL_ARRAY) \
443         $(SHL_DLIST) \
444         $(SHL_HOOK) \
445         src/wlt_main.h \
446         src/wlt_main.c \
447         src/wlt_toolkit.h \
448         src/wlt_toolkit.c \
449         src/wlt_theme.h \
450         src/wlt_theme.c \
451         src/wlt_terminal.h \
452         src/wlt_terminal.c \
453         src/log.h \
454         src/log.c \
455         src/conf.h \
456         src/conf.c \
457         src/pty.h \
458         src/pty.c
459 wlterm_CPPFLAGS = \
460         $(AM_CPPFLAGS) \
461         $(WAYLAND_CFLAGS) \
462         $(XKBCOMMON_CFLAGS)
463 wlterm_LDADD = \
464         $(WAYLAND_LIBS) \
465         $(XKBCOMMON_LIBS) \
466         libeloop.la \
467         libtsm.la \
468         libtext-font.la \
469         -lpthread
470
471 #
472 # Tests
473 #
474
475 test_sources = \
476         src/log.h \
477         src/log.c \
478         src/conf.h \
479         src/conf.c \
480         tests/test_include.h
481 test_cflags = \
482         $(XKBCOMMON_CFLAGS)
483 test_libs = \
484         $(XKBCOMMON_LIBS) \
485         libeloop.la
486
487 test_output_SOURCES = \
488         $(test_sources) \
489         tests/test_output.c
490 test_output_CPPFLAGS = \
491         $(AM_CPPFLAGS) \
492         $(test_cflags)
493 test_output_LDADD = \
494         $(test_libs) \
495         libuterm.la
496
497 test_vt_SOURCES = \
498         $(test_sources) \
499         tests/test_vt.c
500 test_vt_CPPFLAGS = \
501         $(AM_CPPFLAGS) \
502         $(test_cflags)
503 test_vt_LDADD = \
504         $(test_libs) \
505         libuterm.la
506
507 test_input_SOURCES = \
508         $(test_sources) \
509         tests/test_input.c
510 test_input_CPPFLAGS = \
511         $(AM_CPPFLAGS) \
512         $(test_cflags)
513 test_input_LDADD = \
514         $(test_libs) \
515         libuterm.la
516
517 test_key_SOURCES = \
518         $(test_sources) \
519         tests/test_key.c
520 test_key_CPPFLAGS = \
521         $(AM_CPPFLAGS) \
522         $(test_cflags)
523 test_key_LDADD = \
524         $(test_libs)
525
526 #
527 # Manpages
528 #
529
530 MAN_XML_FILES = ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
531 man_MANS =
532
533 if BUILD_HAVE_XSLTPROC
534 if BUILD_HAVE_MANPAGES_STYLESHEET
535
536 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
537 EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES) $(XML_FILES)
538 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES) man_fixup_aliases
539
540 XSLTPROC_FLAGS = \
541         --stringparam man.authors.section.enabled 0 \
542         --stringparam man.copyright.section.enabled 0 \
543         --stringparam funcsynopsis.style ansi \
544         --stringparam man.output.quietly 1 \
545         --nonet
546
547 XSLTPROC_PROCESS_MAN = \
548         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
549         $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) $<
550
551 man_fixup_aliases: $(MANPAGES) $(MANPAGES_ALIASES)
552         $(AM_V_GEN)if test -n "$(MANPAGES_ALIASES)" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' $(MANPAGES_ALIASES) ; fi
553
554 docs/man/%.1: docs/man/%.xml
555         $(XSLTPROC_PROCESS_MAN)
556
557 docs/man/%.3: docs/man/%.xml
558         $(XSLTPROC_PROCESS_MAN)
559
560 docs/man/%.5: docs/man/%.xml
561         $(XSLTPROC_PROCESS_MAN)
562
563 docs/man/%.7: docs/man/%.xml
564         $(XSLTPROC_PROCESS_MAN)
565
566 endif # BUILD_HAVE_MANPAGES_STYLESHEET
567 endif # BUILD_HAVE_XSLTPROC