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