shl: move timer to shl_timer_*
[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 # libkmscon-static: Static library for all subsystems
27 # genshader: Program used to convert shaders into C-source files
28 #
29
30 bin_PROGRAMS = \
31         kmscon
32 check_PROGRAMS = \
33         test_output \
34         test_vt \
35         test_input
36 noinst_PROGRAMS = \
37         genshader \
38         genunifont
39 noinst_LTLIBRARIES = \
40         libkmscon-core.la \
41         libkmscon-static.la
42 lib_LTLIBRARIES =
43
44 #
45 # Default CFlags
46 # Make all files include "config.h" by default. This shouldn't cause any
47 # problems and we cannot forget to include it anymore.
48 #
49 # Also make the linker discard all unused symbols as we are not building a
50 # shared library.
51 #
52 # When compiling in debug mode, we enable debug symbols so debugging with gdb
53 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
54 # Otherwise, we use standard optimizations -O2.
55 #
56
57 AM_CFLAGS = \
58         -Wall
59 AM_CPPFLAGS = \
60         -include $(top_builddir)/config.h \
61         -I $(srcdir)/src \
62         -I $(srcdir)/external
63 AM_LDFLAGS = \
64         -Wl,--as-needed
65
66 if DEBUG
67 AM_CFLAGS += -g
68 endif
69
70 if OPTIMIZATIONS
71 AM_CFLAGS += -O2
72 else
73 AM_CFLAGS += -O0
74 endif
75
76 #
77 # SHL - Static Helper Library
78 # The SHL subsystem contains several small code pieces used all over kmscon and
79 # other applications.
80 #
81
82 SHL_DLIST = \
83         src/shl_dlist.h
84 SHL_ARRAY = \
85         src/shl_array.h
86 SHL_HASHTABLE = \
87         src/shl_hashtable.h \
88         external/htable.h \
89         external/htable.c
90 SHL_RING = \
91         src/shl_ring.h
92 SHL_TIMER = \
93         src/shl_timer.h
94
95 #
96 # libeloop
97 # This library contains the whole event-loop implementation of kmscon. It is
98 # compiled into a separate object to allow using it in several other programs.
99 #
100
101 lib_LTLIBRARIES += \
102         libeloop.la
103
104 libeloop_la_SOURCES = \
105         $(SHL_DLIST) \
106         src/static_llog.h \
107         src/static_hook.h \
108         src/eloop.h \
109         src/eloop.c
110
111 if EV_HAVE_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 include_HEADERS += \
127         src/eloop.h
128
129 pkgconfig_DATA += libeloop.pc
130
131 #
132 # libuterm
133 # The uterm library provides helpers to create terminals in user-space. They
134 # are not limited to text-based terminals but rather provide graphics contexts
135 # so arbitrary output can be displayed. Additionally, they provide VT
136 # abstractions and an input layer
137 #
138
139 lib_LTLIBRARIES += \
140         libuterm.la
141
142 libuterm_la_SOURCES = \
143         $(SHL_DLIST) \
144         src/uterm.h \
145         src/uterm_keysyms.h \
146         src/uterm_input.h \
147         src/uterm_video.h \
148         src/uterm_video.c \
149         src/uterm_monitor.c \
150         src/uterm_vt.c \
151         src/uterm_input.c \
152         src/uterm_input_plain.c \
153         external/imKStoUCS.h \
154         external/imKStoUCS.c
155
156 libuterm_la_CPPFLAGS = \
157         $(AM_CPPFLAGS) \
158         $(SYSTEMD_CFLAGS) \
159         $(DRM_CFLAGS) \
160         $(EGL_CFLAGS) \
161         $(GBM_CFLAGS) \
162         $(GLES2_CFLAGS) \
163         $(UDEV_CFLAGS) \
164         $(XKBCOMMON_CFLAGS)
165 libuterm_la_LIBADD = \
166         $(SYSTEMD_LIBS) \
167         $(DRM_LIBS) \
168         $(EGL_LIBS) \
169         $(GBM_LIBS) \
170         $(GLES2_LIBS) \
171         $(UDEV_LIBS) \
172         $(XKBCOMMON_LIBS) \
173         libkmscon-static.la \
174         libeloop.la
175 libuterm_la_LDFLAGS = \
176         -version-info 1:0:0
177
178 if UTERM_HAVE_FBDEV
179 libuterm_la_SOURCES += \
180         src/uterm_video_fbdev.c
181 endif
182
183 if UTERM_HAVE_DRM
184 libuterm_la_SOURCES += \
185         src/uterm_video_drm.c
186 endif
187
188 if UTERM_HAVE_DUMB
189 libuterm_la_SOURCES += \
190         src/uterm_video_dumb.c
191 endif
192
193 if UTERM_HAVE_XKBCOMMON
194 libuterm_la_SOURCES += \
195         src/uterm_input_uxkb.c
196 endif
197
198 include_HEADERS += \
199         src/uterm.h \
200         src/uterm_keysyms.h
201
202 pkgconfig_DATA += libuterm.pc
203
204 #
205 # Shaders
206 # As there is no need to modify shaders at run-time, we statically compile them
207 # into object files. As autotools would ignore them, we need to add them to
208 # EXTRA_DIST.
209 # The program that converts the shaders into C-source files is "genshader". It's
210 # pretty simple and just creates a string with the shader source as content.
211 #
212
213 SHADERS = \
214         $(srcdir)/src/static_fill.vert \
215         $(srcdir)/src/static_fill.frag \
216         $(srcdir)/src/static_blend.vert \
217         $(srcdir)/src/static_blend.frag \
218         $(srcdir)/src/static_blit.vert \
219         $(srcdir)/src/static_blit.frag \
220         $(srcdir)/src/static_gltex.vert \
221         $(srcdir)/src/static_gltex.frag
222
223 EXTRA_DIST += \
224         $(SHADERS)
225 CLEANFILES += \
226         src/static_shaders.c
227
228 genshader_SOURCES = \
229         src/genshader.c
230
231 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
232         ./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
233
234 #
235 # Unifont Generator
236 # This generates the unifont sources from raw hex-encoded font data.
237 #
238
239 UNIFONT = \
240         src/text_font_unifont_data.hex
241
242 EXTRA_DIST += \
243         $(UNIFONT)
244 CLEANFILES += \
245         src/text_font_unifont_data.c
246
247 genunifont_SOURCES = \
248         src/genunifont.c
249
250 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
251         ./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
252
253 #
254 # libkmscon-core
255 # This static library contains all the source files used in kmscon. We build
256 # them as separate library to allow linking them to the test programs.
257 # Only "main.c" is not included here as it contains the main() function.
258 #
259
260 libkmscon_core_la_SOURCES = \
261         $(SHL_DLIST) \
262         $(SHL_ARRAY) \
263         $(SHL_HASHTABLE) \
264         $(SHL_RING) \
265         $(SHL_TIMER) \
266         src/main.h \
267         src/conf.c src/conf.h \
268         src/ui.c src/ui.h \
269         src/console.c src/console.h \
270         src/unicode.c src/unicode.h \
271         src/log.c src/log.h \
272         src/vte.c src/vte.h \
273         src/vte_charsets.c \
274         src/terminal.c src/terminal.h \
275         src/pty.c src/pty.h \
276         src/text.h \
277         src/text.c \
278         src/text_font.c
279 nodist_libkmscon_core_la_SOURCES =
280
281 if KMSCON_HAVE_UNIFONT
282 libkmscon_core_la_SOURCES += \
283         src/text_font_unifont.c
284 nodist_libkmscon_core_la_SOURCES += \
285         src/text_font_unifont_data.c
286 endif
287
288 if KMSCON_HAVE_8X16
289 libkmscon_core_la_SOURCES += \
290         src/text_font_8x16.c
291 endif
292
293 if KMSCON_HAVE_FREETYPE2
294 libkmscon_core_la_SOURCES += \
295         src/text_font_freetype2.c
296 endif
297
298 if KMSCON_HAVE_PANGO
299 libkmscon_core_la_SOURCES += \
300         src/text_font_pango.c
301 endif
302
303 if KMSCON_HAVE_BBLIT
304 libkmscon_core_la_SOURCES += \
305         src/text_bblit.c
306 endif
307
308 if KMSCON_HAVE_BBULK
309 libkmscon_core_la_SOURCES += \
310         src/text_bbulk.c
311 endif
312
313 if KMSCON_HAVE_GLES2
314 libkmscon_core_la_SOURCES += \
315         src/text_gltex.c
316 endif
317
318 libkmscon_core_la_CPPFLAGS = \
319         $(AM_CPPFLAGS) \
320         $(GLES2_CFLAGS) \
321         $(PANGO_CFLAGS) \
322         $(FREETYPE2_CFLAGS)
323 libkmscon_core_la_LIBADD = \
324         $(GLES2_LIBS) \
325         $(PANGO_LIBS) \
326         $(FREETYPE2_LIBS) \
327         -lpthread \
328         libeloop.la \
329         libuterm.la
330
331 #
332 # libkmscon-static
333 # This static library contains all small helpers that are used in several other
334 # libraries and programs that are part of kmscon. To avoid putting these small
335 # pieces into a library and thus having to keep backwards compatibility, we
336 # simply link them statically into all other libraries/programs.
337 #
338
339 libkmscon_static_la_SOURCES = \
340         src/static_llog.h \
341         src/static_hook.h
342 nodist_libkmscon_static_la_SOURCES =
343
344 libkmscon_static_la_CPPFLAGS = \
345         $(AM_CPPFLAGS) \
346         $(GLES2_CFLAGS)
347
348 libkmscon_static_la_LIBADD = \
349         $(GLES2_LIBS)
350
351 if KMSCON_HAVE_GLES2
352 libkmscon_static_la_SOURCES += \
353         src/static_gl.h \
354         src/static_gl_math.c \
355         src/static_gl_shader.c
356 nodist_libkmscon_static_la_SOURCES += \
357         src/static_shaders.c
358 endif
359
360 #
361 # Binaries
362 # These are the sources for the main binaries and test programs. They mostly
363 # consists of a single source file only and include all the libraries that are
364 # built as part of kmscon.
365 #
366
367 kmscon_SOURCES = \
368         $(SHL_DLIST) \
369         src/main.c
370 kmscon_LDADD = \
371         libuterm.la \
372         libeloop.la \
373         libkmscon-core.la \
374         libkmscon-static.la
375
376 test_output_SOURCES = tests/test_output.c tests/test_include.h
377 test_output_LDADD = libkmscon-core.la
378
379 test_vt_SOURCES = tests/test_vt.c
380 test_vt_LDADD = libkmscon-core.la
381
382 test_input_SOURCES = tests/test_input.c
383 test_input_LDADD = libkmscon-core.la