Make xkbcommon mandatory
[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 SHL_MISC = \
92         src/shl_misc.h
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 += 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 if BUILD_ENABLE_DBUS
114 libeloop_la_SOURCES += \
115         external/dbus-common.h \
116         external/dbus-loop.h \
117         external/dbus-loop.c
118 endif
119
120 libeloop_la_CPPFLAGS = \
121         $(AM_CPPFLAGS) \
122         $(DBUS_CFLAGS)
123 libeloop_la_LIBADD = \
124         $(DBUS_LIBS)
125 libeloop_la_LDFLAGS = \
126         -version-info 1:0:0
127
128 #
129 # libtsm
130 # The Terminal-emulator State Machine is a library that implements the whole VTE
131 # layer and everything related to it. It has no external dependencies so it can
132 # be used to implement any kind of terminal emulator or debugger.
133 #
134
135 if BUILD_ENABLE_TSM
136 lib_LTLIBRARIES += libtsm.la
137 include_HEADERS += \
138         src/tsm_screen.h \
139         src/tsm_unicode.h \
140         src/tsm_vte.h
141 pkgconfig_DATA += libtsm.pc
142 endif
143
144 libtsm_la_SOURCES = \
145         $(SHL_LLOG) \
146         $(SHL_TIMER) \
147         $(SHL_ARRAY) \
148         $(SHL_HASHTABLE) \
149         src/tsm_screen.h \
150         src/tsm_screen.c \
151         src/tsm_unicode.h \
152         src/tsm_unicode.c \
153         src/tsm_vte.h \
154         src/tsm_vte.c \
155         src/tsm_vte_charsets.c
156
157 libtsm_la_CPPFLAGS = \
158         $(AM_CPPFLAGS)
159 libtsm_la_LDFLAGS = \
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 += libuterm.pc
174 endif
175
176 libuterm_la_SOURCES = \
177         $(SHL_DLIST) \
178         $(SHL_HOOK) \
179         src/uterm.h \
180         src/uterm_input.h \
181         src/uterm_video.h \
182         src/uterm_video.c \
183         src/uterm_monitor.c \
184         src/uterm_vt.c \
185         src/uterm_input.c \
186         src/uterm_input_uxkb.c \
187         src/uterm_input_plain.c \
188         external/imKStoUCS.h \
189         external/imKStoUCS.c
190 nodist_libuterm_la_SOURCES =
191
192 libuterm_la_CPPFLAGS = \
193         $(AM_CPPFLAGS) \
194         $(SYSTEMD_CFLAGS) \
195         $(DRM_CFLAGS) \
196         $(EGL_CFLAGS) \
197         $(GBM_CFLAGS) \
198         $(GLES2_CFLAGS) \
199         $(UDEV_CFLAGS) \
200         $(XKBCOMMON_CFLAGS)
201 libuterm_la_LIBADD = \
202         $(SYSTEMD_LIBS) \
203         $(DRM_LIBS) \
204         $(EGL_LIBS) \
205         $(GBM_LIBS) \
206         $(GLES2_LIBS) \
207         $(UDEV_LIBS) \
208         $(XKBCOMMON_LIBS) \
209         libeloop.la
210 libuterm_la_LDFLAGS = \
211         -version-info 1:0:0
212
213 if BUILD_ENABLE_FBDEV
214 libuterm_la_SOURCES += \
215         src/uterm_video_fbdev.c
216 endif
217
218 if BUILD_ENABLE_DRM
219 libuterm_la_SOURCES += \
220         src/uterm_video_drm.c
221 libuterm_la_SOURCES += \
222         src/static_gl.h \
223         src/static_gl_math.c \
224         src/static_gl_shader.c
225 nodist_libuterm_la_SOURCES += \
226         src/static_shaders.c
227 endif
228
229 if BUILD_ENABLE_DUMB
230 libuterm_la_SOURCES += \
231         src/uterm_video_dumb.c
232 endif
233
234 #
235 # Shaders
236 # As there is no need to modify shaders at run-time, we statically compile them
237 # into object files. As autotools would ignore them, we need to add them to
238 # EXTRA_DIST.
239 # The program that converts the shaders into C-source files is "genshader". It's
240 # pretty simple and just creates a string with the shader source as content.
241 #
242
243 SHADERS = \
244         $(srcdir)/src/static_fill.vert \
245         $(srcdir)/src/static_fill.frag \
246         $(srcdir)/src/static_blend.vert \
247         $(srcdir)/src/static_blend.frag \
248         $(srcdir)/src/static_blit.vert \
249         $(srcdir)/src/static_blit.frag \
250         $(srcdir)/src/static_gltex.vert \
251         $(srcdir)/src/static_gltex.frag
252
253 EXTRA_DIST += \
254         $(SHADERS)
255 CLEANFILES += \
256         src/static_shaders.c
257
258 genshader_SOURCES = \
259         src/genshader.c
260
261 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
262         ./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 = \
270         src/text_font_unifont_data.hex
271
272 EXTRA_DIST += \
273         $(UNIFONT)
274 CLEANFILES += \
275         src/text_font_unifont_data.c
276
277 genunifont_SOURCES = \
278         src/genunifont.c
279
280 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
281         ./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
282
283 #
284 # Text-font library
285 # The text-font library is used by kmscon _and_ wlterm but is currently linked
286 # statically as it hasn't been cleaned up entirely.
287 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
288 #
289
290 if BUILD_ENABLE_KMSCON
291 noinst_LTLIBRARIES += libtext-font.la
292 else
293 if BUILD_ENABLE_WLTERM
294 noinst_LTLIBRARIES += libtext-font.la
295 endif
296 endif
297
298 libtext_font_la_SOURCES = \
299         $(SHL_DLIST) \
300         $(SHL_HASHTABLE) \
301         $(SHL_HOOK) \
302         src/text.h \
303         src/text_font.c
304 nodist_libtext_font_la_SOURCES =
305
306 if BUILD_ENABLE_UNIFONT
307 libtext_font_la_SOURCES += \
308         src/text_font_unifont.c
309 nodist_libtext_font_la_SOURCES += \
310         src/text_font_unifont_data.c
311 endif
312
313 if BUILD_ENABLE_8X16
314 libtext_font_la_SOURCES += \
315         src/text_font_8x16.c
316 endif
317
318 if BUILD_ENABLE_FREETYPE2
319 libtext_font_la_SOURCES += \
320         src/text_font_freetype2.c
321 endif
322
323 if BUILD_ENABLE_PANGO
324 libtext_font_la_SOURCES += \
325         src/text_font_pango.c
326 endif
327
328 libtext_font_la_CPPFLAGS = \
329         $(AM_CPPFLAGS) \
330         $(PANGO_CFLAGS) \
331         $(FREETYPE2_CFLAGS)
332 libtext_font_la_LIBADD = \
333         $(PANGO_LIBS) \
334         $(FREETYPE2_LIBS) \
335         -lpthread \
336         libtsm.la
337
338 #
339 # libkmscon-core
340 # This static library contains all the source files used in kmscon. We build
341 # them as separate library to allow linking them to the test programs.
342 # Only "main.c" is not included here as it contains the main() function.
343 #
344
345 if BUILD_ENABLE_KMSCON
346 noinst_LTLIBRARIES += libkmscon-core.la
347 endif
348
349 libkmscon_core_la_SOURCES = \
350         $(SHL_DLIST) \
351         $(SHL_ARRAY) \
352         $(SHL_HASHTABLE) \
353         $(SHL_RING) \
354         $(SHL_TIMER) \
355         $(SHL_HOOK) \
356         src/main.h \
357         src/conf.c src/conf.h \
358         src/ui.c src/ui.h \
359         src/log.c src/log.h \
360         src/terminal.c src/terminal.h \
361         src/pty.c src/pty.h \
362         src/text.h \
363         src/text.c
364 nodist_libkmscon_core_la_SOURCES =
365
366 if BUILD_ENABLE_BBLIT
367 libkmscon_core_la_SOURCES += \
368         src/text_bblit.c
369 endif
370
371 if BUILD_ENABLE_BBULK
372 libkmscon_core_la_SOURCES += \
373         src/text_bbulk.c
374 endif
375
376 if BUILD_ENABLE_GLES2
377 libkmscon_core_la_SOURCES += \
378         src/text_gltex.c \
379         src/static_gl.h \
380         src/static_gl_math.c \
381         src/static_gl_shader.c
382 nodist_libkmscon_core_la_SOURCES += \
383         src/static_shaders.c
384 endif
385
386 libkmscon_core_la_CPPFLAGS = \
387         $(AM_CPPFLAGS) \
388         $(GLES2_CFLAGS)
389 libkmscon_core_la_LIBADD = \
390         $(GLES2_LIBS) \
391         -lpthread \
392         libeloop.la \
393         libtsm.la \
394         libuterm.la
395
396 #
397 # Binaries
398 # These are the sources for the main binaries and test programs. They mostly
399 # consists of a single source file only and include all the libraries that are
400 # built as part of kmscon.
401 #
402
403 if BUILD_ENABLE_KMSCON
404 bin_PROGRAMS += kmscon
405 check_PROGRAMS += \
406         test_output \
407         test_vt \
408         test_input \
409         test_key
410 endif
411
412 kmscon_SOURCES = \
413         $(SHL_DLIST) \
414         $(SHL_MISC) \
415         src/main.c
416 kmscon_LDADD = \
417         libuterm.la \
418         libeloop.la \
419         libtext-font.la \
420         libkmscon-core.la
421
422 test_output_SOURCES = tests/test_output.c tests/test_include.h
423 test_output_LDADD = libkmscon-core.la
424
425 test_vt_SOURCES = tests/test_vt.c
426 test_vt_LDADD = libkmscon-core.la
427
428 test_input_SOURCES = tests/test_input.c
429 test_input_LDADD = libkmscon-core.la
430
431 test_key_SOURCES = tests/test_key.c
432
433 #
434 # Wayland Terminal
435 #
436
437 if BUILD_ENABLE_WLTERM
438 bin_PROGRAMS += wlterm
439 endif
440
441 wlterm_SOURCES = \
442         src/wlt_main.h \
443         src/wlt_main.c \
444         src/wlt_toolkit.h \
445         src/wlt_toolkit.c \
446         src/wlt_theme.h \
447         src/wlt_theme.c \
448         src/wlt_terminal.h \
449         src/wlt_terminal.c \
450         src/log.h \
451         src/log.c \
452         src/conf.h \
453         src/conf.c \
454         src/pty.h \
455         src/pty.c
456 wlterm_CPPFLAGS = \
457         $(AM_CPPFLAGS) \
458         $(WAYLAND_CFLAGS) \
459         $(XKBCOMMON_CFLAGS)
460 wlterm_LDADD = \
461         libeloop.la \
462         libtsm.la \
463         libtext-font.la \
464         -lpthread \
465         $(WAYLAND_LIBS) \
466         $(XKBCOMMON_LIBS)