build: add shl_misc to all its users
[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         $(SHL_MISC) \
180         src/uterm.h \
181         src/uterm_input.h \
182         src/uterm_video.h \
183         src/uterm_video.c \
184         src/uterm_monitor.c \
185         src/uterm_vt.c \
186         src/uterm_input.c \
187         src/uterm_input_uxkb.c \
188         src/uterm_input_plain.c \
189         external/imKStoUCS.h \
190         external/imKStoUCS.c
191 nodist_libuterm_la_SOURCES =
192
193 libuterm_la_CPPFLAGS = \
194         $(AM_CPPFLAGS) \
195         $(SYSTEMD_CFLAGS) \
196         $(DRM_CFLAGS) \
197         $(EGL_CFLAGS) \
198         $(GBM_CFLAGS) \
199         $(GLES2_CFLAGS) \
200         $(UDEV_CFLAGS) \
201         $(XKBCOMMON_CFLAGS)
202 libuterm_la_LIBADD = \
203         $(SYSTEMD_LIBS) \
204         $(DRM_LIBS) \
205         $(EGL_LIBS) \
206         $(GBM_LIBS) \
207         $(GLES2_LIBS) \
208         $(UDEV_LIBS) \
209         $(XKBCOMMON_LIBS) \
210         libeloop.la
211 libuterm_la_LDFLAGS = \
212         -version-info 1:0:0
213
214 if BUILD_ENABLE_FBDEV
215 libuterm_la_SOURCES += \
216         src/uterm_video_fbdev.c
217 endif
218
219 if BUILD_ENABLE_DRM
220 libuterm_la_SOURCES += \
221         src/uterm_video_drm.c
222 libuterm_la_SOURCES += \
223         src/static_gl.h \
224         src/static_gl_math.c \
225         src/static_gl_shader.c
226 nodist_libuterm_la_SOURCES += \
227         src/static_shaders.c
228 endif
229
230 if BUILD_ENABLE_DUMB
231 libuterm_la_SOURCES += \
232         src/uterm_video_dumb.c
233 endif
234
235 #
236 # Shaders
237 # As there is no need to modify shaders at run-time, we statically compile them
238 # into object files. As autotools would ignore them, we need to add them to
239 # EXTRA_DIST.
240 # The program that converts the shaders into C-source files is "genshader". It's
241 # pretty simple and just creates a string with the shader source as content.
242 #
243
244 SHADERS = \
245         $(srcdir)/src/static_fill.vert \
246         $(srcdir)/src/static_fill.frag \
247         $(srcdir)/src/static_blend.vert \
248         $(srcdir)/src/static_blend.frag \
249         $(srcdir)/src/static_blit.vert \
250         $(srcdir)/src/static_blit.frag \
251         $(srcdir)/src/static_gltex.vert \
252         $(srcdir)/src/static_gltex.frag
253
254 EXTRA_DIST += \
255         $(SHADERS)
256 CLEANFILES += \
257         src/static_shaders.c
258
259 genshader_SOURCES = \
260         src/genshader.c
261
262 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
263         ./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
264
265 #
266 # Unifont Generator
267 # This generates the unifont sources from raw hex-encoded font data.
268 #
269
270 UNIFONT = \
271         src/text_font_unifont_data.hex
272
273 EXTRA_DIST += \
274         $(UNIFONT)
275 CLEANFILES += \
276         src/text_font_unifont_data.c
277
278 genunifont_SOURCES = \
279         src/genunifont.c
280
281 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
282         ./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
283
284 #
285 # Text-font library
286 # The text-font library is used by kmscon _and_ wlterm but is currently linked
287 # statically as it hasn't been cleaned up entirely.
288 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
289 #
290
291 if BUILD_ENABLE_KMSCON
292 noinst_LTLIBRARIES += libtext-font.la
293 else
294 if BUILD_ENABLE_WLTERM
295 noinst_LTLIBRARIES += libtext-font.la
296 endif
297 endif
298
299 libtext_font_la_SOURCES = \
300         $(SHL_DLIST) \
301         $(SHL_HASHTABLE) \
302         $(SHL_HOOK) \
303         src/text.h \
304         src/text_font.c
305 nodist_libtext_font_la_SOURCES =
306
307 if BUILD_ENABLE_UNIFONT
308 libtext_font_la_SOURCES += \
309         src/text_font_unifont.c
310 nodist_libtext_font_la_SOURCES += \
311         src/text_font_unifont_data.c
312 endif
313
314 if BUILD_ENABLE_8X16
315 libtext_font_la_SOURCES += \
316         src/text_font_8x16.c
317 endif
318
319 if BUILD_ENABLE_FREETYPE2
320 libtext_font_la_SOURCES += \
321         src/text_font_freetype2.c
322 endif
323
324 if BUILD_ENABLE_PANGO
325 libtext_font_la_SOURCES += \
326         src/text_font_pango.c
327 endif
328
329 libtext_font_la_CPPFLAGS = \
330         $(AM_CPPFLAGS) \
331         $(PANGO_CFLAGS) \
332         $(FREETYPE2_CFLAGS)
333 libtext_font_la_LIBADD = \
334         $(PANGO_LIBS) \
335         $(FREETYPE2_LIBS) \
336         -lpthread \
337         libtsm.la
338
339 #
340 # libkmscon-core
341 # This static library contains all the source files used in kmscon. We build
342 # them as separate library to allow linking them to the test programs.
343 # Only "main.c" is not included here as it contains the main() function.
344 #
345
346 if BUILD_ENABLE_KMSCON
347 noinst_LTLIBRARIES += libkmscon-core.la
348 endif
349
350 libkmscon_core_la_SOURCES = \
351         $(SHL_DLIST) \
352         $(SHL_ARRAY) \
353         $(SHL_HASHTABLE) \
354         $(SHL_RING) \
355         $(SHL_TIMER) \
356         $(SHL_HOOK) \
357         $(SHL_MISC) \
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         $(SHL_MISC) \
417         src/main.c
418 kmscon_LDADD = \
419         libuterm.la \
420         libeloop.la \
421         libtext-font.la \
422         libkmscon-core.la
423
424 test_output_SOURCES = tests/test_output.c tests/test_include.h
425 test_output_LDADD = libkmscon-core.la
426
427 test_vt_SOURCES = tests/test_vt.c
428 test_vt_LDADD = libkmscon-core.la
429
430 test_input_SOURCES = tests/test_input.c
431 test_input_LDADD = libkmscon-core.la
432
433 test_key_SOURCES = tests/test_key.c
434
435 #
436 # Wayland Terminal
437 #
438
439 if BUILD_ENABLE_WLTERM
440 bin_PROGRAMS += wlterm
441 endif
442
443 wlterm_SOURCES = \
444         $(SHL_MISC) \
445         src/wlt_main.h \
446         src/wlt_main.c \
447         src/wlt_toolkit.h \
448         src/wlt_toolkit.c \
449         src/wlt_theme.h \
450         src/wlt_theme.c \
451         src/wlt_terminal.h \
452         src/wlt_terminal.c \
453         src/log.h \
454         src/log.c \
455         src/conf.h \
456         src/conf.c \
457         src/pty.h \
458         src/pty.c
459 wlterm_CPPFLAGS = \
460         $(AM_CPPFLAGS) \
461         $(WAYLAND_CFLAGS) \
462         $(XKBCOMMON_CFLAGS)
463 wlterm_LDADD = \
464         libeloop.la \
465         libtsm.la \
466         libtext-font.la \
467         -lpthread \
468         $(WAYLAND_LIBS) \
469         $(XKBCOMMON_LIBS)