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