kmscon: allow paths with --vt=<xy>
[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_plain.c \
187         external/imKStoUCS.h \
188         external/imKStoUCS.c
189 nodist_libuterm_la_SOURCES =
190
191 libuterm_la_CPPFLAGS = \
192         $(AM_CPPFLAGS) \
193         $(SYSTEMD_CFLAGS) \
194         $(DRM_CFLAGS) \
195         $(EGL_CFLAGS) \
196         $(GBM_CFLAGS) \
197         $(GLES2_CFLAGS) \
198         $(UDEV_CFLAGS) \
199         $(XKBCOMMON_CFLAGS)
200 libuterm_la_LIBADD = \
201         $(SYSTEMD_LIBS) \
202         $(DRM_LIBS) \
203         $(EGL_LIBS) \
204         $(GBM_LIBS) \
205         $(GLES2_LIBS) \
206         $(UDEV_LIBS) \
207         $(XKBCOMMON_LIBS) \
208         libeloop.la
209 libuterm_la_LDFLAGS = \
210         -version-info 1:0:0
211
212 if BUILD_ENABLE_FBDEV
213 libuterm_la_SOURCES += \
214         src/uterm_video_fbdev.c
215 endif
216
217 if BUILD_ENABLE_DRM
218 libuterm_la_SOURCES += \
219         src/uterm_video_drm.c
220 libuterm_la_SOURCES += \
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 endif
227
228 if BUILD_ENABLE_DUMB
229 libuterm_la_SOURCES += \
230         src/uterm_video_dumb.c
231 endif
232
233 if BUILD_ENABLE_XKBCOMMON
234 libuterm_la_SOURCES += \
235         src/uterm_input_uxkb.c
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 += \
258         $(SHADERS)
259 CLEANFILES += \
260         src/static_shaders.c
261
262 genshader_SOURCES = \
263         src/genshader.c
264
265 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
266         ./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
267
268 #
269 # Unifont Generator
270 # This generates the unifont sources from raw hex-encoded font data.
271 #
272
273 UNIFONT = \
274         src/text_font_unifont_data.hex
275
276 EXTRA_DIST += \
277         $(UNIFONT)
278 CLEANFILES += \
279         src/text_font_unifont_data.c
280
281 genunifont_SOURCES = \
282         src/genunifont.c
283
284 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
285         ./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
286
287 #
288 # Text-font library
289 # The text-font library is used by kmscon _and_ wlterm but is currently linked
290 # statically as it hasn't been cleaned up entirely.
291 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
292 #
293
294 if BUILD_ENABLE_KMSCON
295 noinst_LTLIBRARIES += libtext-font.la
296 else
297 if BUILD_ENABLE_WLTERM
298 noinst_LTLIBRARIES += libtext-font.la
299 endif
300 endif
301
302 libtext_font_la_SOURCES = \
303         $(SHL_DLIST) \
304         $(SHL_HASHTABLE) \
305         $(SHL_HOOK) \
306         src/text.h \
307         src/text_font.c
308 nodist_libtext_font_la_SOURCES =
309
310 if BUILD_ENABLE_UNIFONT
311 libtext_font_la_SOURCES += \
312         src/text_font_unifont.c
313 nodist_libtext_font_la_SOURCES += \
314         src/text_font_unifont_data.c
315 endif
316
317 if BUILD_ENABLE_8X16
318 libtext_font_la_SOURCES += \
319         src/text_font_8x16.c
320 endif
321
322 if BUILD_ENABLE_FREETYPE2
323 libtext_font_la_SOURCES += \
324         src/text_font_freetype2.c
325 endif
326
327 if BUILD_ENABLE_PANGO
328 libtext_font_la_SOURCES += \
329         src/text_font_pango.c
330 endif
331
332 libtext_font_la_CPPFLAGS = \
333         $(AM_CPPFLAGS) \
334         $(PANGO_CFLAGS) \
335         $(FREETYPE2_CFLAGS)
336 libtext_font_la_LIBADD = \
337         $(PANGO_LIBS) \
338         $(FREETYPE2_LIBS) \
339         -lpthread \
340         libtsm.la
341
342 #
343 # libkmscon-core
344 # This static library contains all the source files used in kmscon. We build
345 # them as separate library to allow linking them to the test programs.
346 # Only "main.c" is not included here as it contains the main() function.
347 #
348
349 if BUILD_ENABLE_KMSCON
350 noinst_LTLIBRARIES += libkmscon-core.la
351 endif
352
353 libkmscon_core_la_SOURCES = \
354         $(SHL_DLIST) \
355         $(SHL_ARRAY) \
356         $(SHL_HASHTABLE) \
357         $(SHL_RING) \
358         $(SHL_TIMER) \
359         $(SHL_HOOK) \
360         src/main.h \
361         src/conf.c src/conf.h \
362         src/ui.c src/ui.h \
363         src/log.c src/log.h \
364         src/terminal.c src/terminal.h \
365         src/pty.c src/pty.h \
366         src/text.h \
367         src/text.c
368 nodist_libkmscon_core_la_SOURCES =
369
370 if BUILD_ENABLE_BBLIT
371 libkmscon_core_la_SOURCES += \
372         src/text_bblit.c
373 endif
374
375 if BUILD_ENABLE_BBULK
376 libkmscon_core_la_SOURCES += \
377         src/text_bbulk.c
378 endif
379
380 if BUILD_ENABLE_GLES2
381 libkmscon_core_la_SOURCES += \
382         src/text_gltex.c \
383         src/static_gl.h \
384         src/static_gl_math.c \
385         src/static_gl_shader.c
386 nodist_libkmscon_core_la_SOURCES += \
387         src/static_shaders.c
388 endif
389
390 libkmscon_core_la_CPPFLAGS = \
391         $(AM_CPPFLAGS) \
392         $(GLES2_CFLAGS)
393 libkmscon_core_la_LIBADD = \
394         $(GLES2_LIBS) \
395         -lpthread \
396         libeloop.la \
397         libtsm.la \
398         libuterm.la
399
400 #
401 # Binaries
402 # These are the sources for the main binaries and test programs. They mostly
403 # consists of a single source file only and include all the libraries that are
404 # built as part of kmscon.
405 #
406
407 if BUILD_ENABLE_KMSCON
408 bin_PROGRAMS += kmscon
409 check_PROGRAMS += \
410         test_output \
411         test_vt \
412         test_input \
413         test_key
414 endif
415
416 kmscon_SOURCES = \
417         $(SHL_DLIST) \
418         $(SHL_MISC) \
419         src/main.c
420 kmscon_LDADD = \
421         libuterm.la \
422         libeloop.la \
423         libtext-font.la \
424         libkmscon-core.la
425
426 test_output_SOURCES = tests/test_output.c tests/test_include.h
427 test_output_LDADD = libkmscon-core.la
428
429 test_vt_SOURCES = tests/test_vt.c
430 test_vt_LDADD = libkmscon-core.la
431
432 test_input_SOURCES = tests/test_input.c
433 test_input_LDADD = libkmscon-core.la
434
435 test_key_SOURCES = tests/test_key.c
436
437 #
438 # Wayland Terminal
439 #
440
441 if BUILD_ENABLE_WLTERM
442 bin_PROGRAMS += wlterm
443 endif
444
445 wlterm_SOURCES = \
446         src/wlt_main.h \
447         src/wlt_main.c \
448         src/wlt_toolkit.h \
449         src/wlt_toolkit.c \
450         src/wlt_theme.h \
451         src/wlt_theme.c \
452         src/wlt_terminal.h \
453         src/wlt_terminal.c \
454         src/log.h \
455         src/log.c \
456         src/conf.h \
457         src/conf.c \
458         src/pty.h \
459         src/pty.c
460 wlterm_CPPFLAGS = \
461         $(AM_CPPFLAGS) \
462         $(WAYLAND_CFLAGS) \
463         $(XKBCOMMON_CFLAGS)
464 wlterm_LDADD = \
465         libeloop.la \
466         libtsm.la \
467         libtext-font.la \
468         -lpthread \
469         $(WAYLAND_LIBS) \
470         $(XKBCOMMON_LIBS)