shl: move llog to shl
[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 SHL_LLOG = \
95         src/shl_llog.h
96
97 #
98 # libeloop
99 # This library contains the whole event-loop implementation of kmscon. It is
100 # compiled into a separate object to allow using it in several other programs.
101 #
102
103 lib_LTLIBRARIES += \
104         libeloop.la
105
106 libeloop_la_SOURCES = \
107         $(SHL_DLIST) \
108         $(SHL_LLOG) \
109         src/static_llog.h \
110         src/static_hook.h \
111         src/eloop.h \
112         src/eloop.c
113
114 if EV_HAVE_DBUS
115 libeloop_la_SOURCES += \
116         external/dbus-common.h \
117         external/dbus-loop.h \
118         external/dbus-loop.c
119 endif
120
121 libeloop_la_CPPFLAGS = \
122         $(AM_CPPFLAGS) \
123         $(DBUS_CFLAGS)
124 libeloop_la_LIBADD = \
125         $(DBUS_LIBS)
126 libeloop_la_LDFLAGS = \
127         -version-info 1:0:0
128
129 include_HEADERS += \
130         src/eloop.h
131
132 pkgconfig_DATA += libeloop.pc
133
134 #
135 # libuterm
136 # The uterm library provides helpers to create terminals in user-space. They
137 # are not limited to text-based terminals but rather provide graphics contexts
138 # so arbitrary output can be displayed. Additionally, they provide VT
139 # abstractions and an input layer
140 #
141
142 lib_LTLIBRARIES += \
143         libuterm.la
144
145 libuterm_la_SOURCES = \
146         $(SHL_DLIST) \
147         src/uterm.h \
148         src/uterm_keysyms.h \
149         src/uterm_input.h \
150         src/uterm_video.h \
151         src/uterm_video.c \
152         src/uterm_monitor.c \
153         src/uterm_vt.c \
154         src/uterm_input.c \
155         src/uterm_input_plain.c \
156         external/imKStoUCS.h \
157         external/imKStoUCS.c
158
159 libuterm_la_CPPFLAGS = \
160         $(AM_CPPFLAGS) \
161         $(SYSTEMD_CFLAGS) \
162         $(DRM_CFLAGS) \
163         $(EGL_CFLAGS) \
164         $(GBM_CFLAGS) \
165         $(GLES2_CFLAGS) \
166         $(UDEV_CFLAGS) \
167         $(XKBCOMMON_CFLAGS)
168 libuterm_la_LIBADD = \
169         $(SYSTEMD_LIBS) \
170         $(DRM_LIBS) \
171         $(EGL_LIBS) \
172         $(GBM_LIBS) \
173         $(GLES2_LIBS) \
174         $(UDEV_LIBS) \
175         $(XKBCOMMON_LIBS) \
176         libkmscon-static.la \
177         libeloop.la
178 libuterm_la_LDFLAGS = \
179         -version-info 1:0:0
180
181 if UTERM_HAVE_FBDEV
182 libuterm_la_SOURCES += \
183         src/uterm_video_fbdev.c
184 endif
185
186 if UTERM_HAVE_DRM
187 libuterm_la_SOURCES += \
188         src/uterm_video_drm.c
189 endif
190
191 if UTERM_HAVE_DUMB
192 libuterm_la_SOURCES += \
193         src/uterm_video_dumb.c
194 endif
195
196 if UTERM_HAVE_XKBCOMMON
197 libuterm_la_SOURCES += \
198         src/uterm_input_uxkb.c
199 endif
200
201 include_HEADERS += \
202         src/uterm.h \
203         src/uterm_keysyms.h
204
205 pkgconfig_DATA += libuterm.pc
206
207 #
208 # Shaders
209 # As there is no need to modify shaders at run-time, we statically compile them
210 # into object files. As autotools would ignore them, we need to add them to
211 # EXTRA_DIST.
212 # The program that converts the shaders into C-source files is "genshader". It's
213 # pretty simple and just creates a string with the shader source as content.
214 #
215
216 SHADERS = \
217         $(srcdir)/src/static_fill.vert \
218         $(srcdir)/src/static_fill.frag \
219         $(srcdir)/src/static_blend.vert \
220         $(srcdir)/src/static_blend.frag \
221         $(srcdir)/src/static_blit.vert \
222         $(srcdir)/src/static_blit.frag \
223         $(srcdir)/src/static_gltex.vert \
224         $(srcdir)/src/static_gltex.frag
225
226 EXTRA_DIST += \
227         $(SHADERS)
228 CLEANFILES += \
229         src/static_shaders.c
230
231 genshader_SOURCES = \
232         src/genshader.c
233
234 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
235         ./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
236
237 #
238 # Unifont Generator
239 # This generates the unifont sources from raw hex-encoded font data.
240 #
241
242 UNIFONT = \
243         src/text_font_unifont_data.hex
244
245 EXTRA_DIST += \
246         $(UNIFONT)
247 CLEANFILES += \
248         src/text_font_unifont_data.c
249
250 genunifont_SOURCES = \
251         src/genunifont.c
252
253 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
254         ./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
255
256 #
257 # libkmscon-core
258 # This static library contains all the source files used in kmscon. We build
259 # them as separate library to allow linking them to the test programs.
260 # Only "main.c" is not included here as it contains the main() function.
261 #
262
263 libkmscon_core_la_SOURCES = \
264         $(SHL_DLIST) \
265         $(SHL_ARRAY) \
266         $(SHL_HASHTABLE) \
267         $(SHL_RING) \
268         $(SHL_TIMER) \
269         src/main.h \
270         src/conf.c src/conf.h \
271         src/ui.c src/ui.h \
272         src/console.c src/console.h \
273         src/unicode.c src/unicode.h \
274         src/log.c src/log.h \
275         src/vte.c src/vte.h \
276         src/vte_charsets.c \
277         src/terminal.c src/terminal.h \
278         src/pty.c src/pty.h \
279         src/text.h \
280         src/text.c \
281         src/text_font.c
282 nodist_libkmscon_core_la_SOURCES =
283
284 if KMSCON_HAVE_UNIFONT
285 libkmscon_core_la_SOURCES += \
286         src/text_font_unifont.c
287 nodist_libkmscon_core_la_SOURCES += \
288         src/text_font_unifont_data.c
289 endif
290
291 if KMSCON_HAVE_8X16
292 libkmscon_core_la_SOURCES += \
293         src/text_font_8x16.c
294 endif
295
296 if KMSCON_HAVE_FREETYPE2
297 libkmscon_core_la_SOURCES += \
298         src/text_font_freetype2.c
299 endif
300
301 if KMSCON_HAVE_PANGO
302 libkmscon_core_la_SOURCES += \
303         src/text_font_pango.c
304 endif
305
306 if KMSCON_HAVE_BBLIT
307 libkmscon_core_la_SOURCES += \
308         src/text_bblit.c
309 endif
310
311 if KMSCON_HAVE_BBULK
312 libkmscon_core_la_SOURCES += \
313         src/text_bbulk.c
314 endif
315
316 if KMSCON_HAVE_GLES2
317 libkmscon_core_la_SOURCES += \
318         src/text_gltex.c
319 endif
320
321 libkmscon_core_la_CPPFLAGS = \
322         $(AM_CPPFLAGS) \
323         $(GLES2_CFLAGS) \
324         $(PANGO_CFLAGS) \
325         $(FREETYPE2_CFLAGS)
326 libkmscon_core_la_LIBADD = \
327         $(GLES2_LIBS) \
328         $(PANGO_LIBS) \
329         $(FREETYPE2_LIBS) \
330         -lpthread \
331         libeloop.la \
332         libuterm.la
333
334 #
335 # libkmscon-static
336 # This static library contains all small helpers that are used in several other
337 # libraries and programs that are part of kmscon. To avoid putting these small
338 # pieces into a library and thus having to keep backwards compatibility, we
339 # simply link them statically into all other libraries/programs.
340 #
341
342 libkmscon_static_la_SOURCES = \
343         src/static_llog.h \
344         src/static_hook.h
345 nodist_libkmscon_static_la_SOURCES =
346
347 libkmscon_static_la_CPPFLAGS = \
348         $(AM_CPPFLAGS) \
349         $(GLES2_CFLAGS)
350
351 libkmscon_static_la_LIBADD = \
352         $(GLES2_LIBS)
353
354 if KMSCON_HAVE_GLES2
355 libkmscon_static_la_SOURCES += \
356         src/static_gl.h \
357         src/static_gl_math.c \
358         src/static_gl_shader.c
359 nodist_libkmscon_static_la_SOURCES += \
360         src/static_shaders.c
361 endif
362
363 #
364 # Binaries
365 # These are the sources for the main binaries and test programs. They mostly
366 # consists of a single source file only and include all the libraries that are
367 # built as part of kmscon.
368 #
369
370 kmscon_SOURCES = \
371         $(SHL_DLIST) \
372         src/main.c
373 kmscon_LDADD = \
374         libuterm.la \
375         libeloop.la \
376         libkmscon-core.la \
377         libkmscon-static.la
378
379 test_output_SOURCES = tests/test_output.c tests/test_include.h
380 test_output_LDADD = libkmscon-core.la
381
382 test_vt_SOURCES = tests/test_vt.c
383 test_vt_LDADD = libkmscon-core.la
384
385 test_input_SOURCES = tests/test_input.c
386 test_input_LDADD = libkmscon-core.la