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