uterm: add PCI primary GPU detection
[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 bin_PROGRAMS =
19 check_PROGRAMS =
20 noinst_PROGRAMS = \
21         genshader \
22         genunifont
23 noinst_LTLIBRARIES =
24 lib_LTLIBRARIES =
25
26 #
27 # Default CFlags
28 # Make all files include "config.h" by default. This shouldn't cause any
29 # problems and we cannot forget to include it anymore.
30 #
31 # Also make the linker discard all unused symbols.
32 #
33 # When compiling in debug mode, we enable debug symbols so debugging with gdb
34 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
35 # Otherwise, we use standard optimizations -O2.
36 #
37
38 AM_CFLAGS = \
39         -Wall
40 AM_CPPFLAGS = \
41         -include $(top_builddir)/config.h \
42         -I $(srcdir)/src
43 AM_LDFLAGS = \
44         -Wl,--as-needed
45
46 if BUILD_ENABLE_DEBUG
47 AM_CFLAGS += -g
48 endif
49
50 if BUILD_ENABLE_OPTIMIZATIONS
51 AM_CFLAGS += -O2
52 else
53 AM_CFLAGS += -O0
54 endif
55
56 #
57 # SHL - Static Helper Library
58 # The SHL subsystem contains several small code pieces used all over kmscon and
59 # other applications.
60 #
61 # Simply include $(SHL_*) in your source-file list. Except for SHL_MISC none of
62 # these have external dependencies. SHL_MISC needs xkbcommon.
63 #
64
65 SHL_DLIST = \
66         src/shl_dlist.h
67 SHL_ARRAY = \
68         src/shl_array.h
69 SHL_HASHTABLE = \
70         src/shl_hashtable.h \
71         external/htable.h \
72         external/htable.c
73 SHL_RING = \
74         src/shl_ring.h
75 SHL_TIMER = \
76         src/shl_timer.h
77 SHL_LLOG = \
78         src/shl_llog.h
79 SHL_HOOK = \
80         src/shl_hook.h \
81         $(SHL_DLIST)
82 SHL_MISC = \
83         src/shl_misc.h
84
85 #
86 # libeloop
87 # This library contains the whole event-loop implementation of kmscon. It is
88 # compiled into a separate object to allow using it in several other programs.
89 #
90
91 if BUILD_ENABLE_ELOOP
92 lib_LTLIBRARIES += libeloop.la
93 include_HEADERS += src/eloop.h
94 pkgconfig_DATA += src/libeloop.pc
95 endif
96
97 libeloop_la_SOURCES = \
98         $(SHL_DLIST) \
99         $(SHL_LLOG) \
100         $(SHL_HOOK) \
101         src/eloop.h \
102         src/eloop.c
103
104 libeloop_la_CPPFLAGS = \
105         $(AM_CPPFLAGS)
106 libeloop_la_LIBADD =
107 libeloop_la_LDFLAGS = \
108         -version-info 1:0:0
109
110
111 if BUILD_ENABLE_ELOOP_DBUS
112 libeloop_la_SOURCES += \
113         external/dbus-common.h \
114         external/dbus-loop.h \
115         external/dbus-loop.c
116 libeloop_la_CPPFLAGS += \
117         $(DBUS_CFLAGS)
118 libeloop_la_LIBADD += \
119         $(DBUS_LIBS)
120 endif
121
122 #
123 # libtsm
124 # The Terminal-emulator State Machine is a library that implements the whole VTE
125 # layer and everything related to it. It has no external dependencies so it can
126 # be used to implement any kind of terminal emulator or debugger.
127 #
128
129 if BUILD_ENABLE_TSM
130 lib_LTLIBRARIES += \
131         libtsm.la
132 include_HEADERS += \
133         src/tsm_screen.h \
134         src/tsm_unicode.h \
135         src/tsm_vte.h
136 pkgconfig_DATA += \
137         src/libtsm.pc
138 endif
139
140 libtsm_la_SOURCES = \
141         $(SHL_LLOG) \
142         $(SHL_TIMER) \
143         $(SHL_ARRAY) \
144         $(SHL_HASHTABLE) \
145         src/tsm_screen.h \
146         src/tsm_screen.c \
147         src/tsm_unicode.h \
148         src/tsm_unicode.c \
149         src/tsm_vte.h \
150         src/tsm_vte.c \
151         src/tsm_vte_charsets.c
152
153 libtsm_la_CPPFLAGS = \
154         $(AM_CPPFLAGS) \
155         $(XKBCOMMON_CFLAGS)
156 libtsm_la_LDFLAGS = \
157         $(XKBCOMMON_LIBS) \
158         -version-info 1:0:0
159
160 #
161 # libuterm
162 # The uterm library provides helpers to create terminals in user-space. They
163 # are not limited to text-based terminals but rather provide graphics contexts
164 # so arbitrary output can be displayed. Additionally, they provide VT
165 # abstractions and an input layer
166 #
167
168 if BUILD_ENABLE_UTERM
169 lib_LTLIBRARIES += libuterm.la
170 include_HEADERS += src/uterm.h
171 pkgconfig_DATA += src/libuterm.pc
172 endif
173
174 libuterm_la_SOURCES = \
175         $(SHL_DLIST) \
176         $(SHL_HOOK) \
177         $(SHL_MISC) \
178         src/uterm.h \
179         src/uterm_input.h \
180         src/uterm_video.h \
181         src/uterm_pci.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
188 nodist_libuterm_la_SOURCES =
189
190 libuterm_la_CPPFLAGS = \
191         $(AM_CPPFLAGS) \
192         $(XKBCOMMON_CFLAGS)
193 libuterm_la_LIBADD =
194         $(XKBCOMMON_LIBS) \
195         libeloop.la
196 libuterm_la_LDFLAGS = \
197         -version-info 1:0:0
198
199 if BUILD_ENABLE_MULTI_SEAT
200 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
201 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
202 endif
203
204 if BUILD_ENABLE_HOTPLUG
205 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
206 libuterm_la_LIBADD += $(UDEV_LIBS)
207 endif
208
209 if BUILD_ENABLE_PCIACCESS
210 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
211 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
212 libuterm_la_SOURCES += src/uterm_pci.c
213 endif
214
215 if BUILD_ENABLE_VIDEO_FBDEV
216 libuterm_la_SOURCES += src/uterm_video_fbdev.c
217 endif
218
219 if BUILD_ENABLE_VIDEO_DUMB
220 libuterm_la_SOURCES += src/uterm_video_dumb.c
221 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
222 libuterm_la_LIBADD += $(DRM_LIBS)
223 endif
224
225 if BUILD_ENABLE_VIDEO_DRM
226 libuterm_la_SOURCES += \
227         src/uterm_video_drm.c \
228         src/static_gl.h \
229         src/static_gl_math.c \
230         src/static_gl_shader.c
231 nodist_libuterm_la_SOURCES += \
232         src/static_shaders.c
233 libuterm_la_CPPFLAGS += \
234         $(DRM_CFLAGS) \
235         $(EGL_CFLAGS) \
236         $(GBM_CFLAGS) \
237         $(GLES2_CFLAGS)
238 libuterm_la_LIBADD += \
239         $(DRM_LIBS) \
240         $(EGL_LIBS) \
241         $(GBM_LIBS) \
242         $(GLES2_LIBS)
243 endif
244
245 #
246 # Shaders
247 # As there is no need to modify shaders at run-time, we statically compile them
248 # into object files. As autotools would ignore them, we need to add them to
249 # EXTRA_DIST.
250 # The program that converts the shaders into C-source files is "genshader". It's
251 # pretty simple and just creates a string with the shader source as content.
252 #
253
254 SHADERS = \
255         $(srcdir)/src/static_fill.vert \
256         $(srcdir)/src/static_fill.frag \
257         $(srcdir)/src/static_blend.vert \
258         $(srcdir)/src/static_blend.frag \
259         $(srcdir)/src/static_blit.vert \
260         $(srcdir)/src/static_blit.frag \
261         $(srcdir)/src/static_gltex.vert \
262         $(srcdir)/src/static_gltex.frag
263
264 EXTRA_DIST += $(SHADERS)
265 CLEANFILES += src/static_shaders.c
266 genshader_SOURCES = src/genshader.c
267
268 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
269         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
270
271 #
272 # Unifont Generator
273 # This generates the unifont sources from raw hex-encoded font data.
274 #
275
276 UNIFONT = src/text_font_unifont_data.hex
277
278 EXTRA_DIST += $(UNIFONT)
279 CLEANFILES += src/text_font_unifont_data.c
280 genunifont_SOURCES = src/genunifont.c
281
282 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
283         $(AM_V_GEN)./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
284
285 #
286 # Text-font library
287 # The text-font library is used by kmscon _and_ wlterm but is currently linked
288 # statically as it hasn't been cleaned up entirely.
289 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
290 #
291
292 if BUILD_ENABLE_KMSCON
293 noinst_LTLIBRARIES += libtext-font.la
294 else
295 if BUILD_ENABLE_WLTERM
296 noinst_LTLIBRARIES += libtext-font.la
297 endif
298 endif
299
300 libtext_font_la_SOURCES = \
301         $(SHL_DLIST) \
302         $(SHL_HASHTABLE) \
303         $(SHL_HOOK) \
304         src/text.h \
305         src/text_font.c
306 nodist_libtext_font_la_SOURCES =
307
308 libtext_font_la_CPPFLAGS = \
309         $(AM_CPPFLAGS)
310 libtext_font_la_LIBADD = \
311         -lpthread \
312         libtsm.la
313
314 if BUILD_ENABLE_FONT_8X16
315 libtext_font_la_SOURCES += src/text_font_8x16.c
316 endif
317
318 if BUILD_ENABLE_FONT_UNIFONT
319 libtext_font_la_SOURCES += src/text_font_unifont.c
320 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
321 endif
322
323 if BUILD_ENABLE_FONT_FREETYPE2
324 libtext_font_la_SOURCES += src/text_font_freetype2.c
325 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
326 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
327 endif
328
329 if BUILD_ENABLE_FONT_PANGO
330 libtext_font_la_SOURCES += src/text_font_pango.c
331 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
332 libtext_font_la_LIBADD += $(PANGO_LIBS)
333 endif
334
335 #
336 # Binaries
337 # These are the sources for the main binaries and test programs. They mostly
338 # consists of a single source file only and include all the libraries that are
339 # built as part of kmscon.
340 #
341
342 if BUILD_ENABLE_KMSCON
343 bin_PROGRAMS += kmscon
344 check_PROGRAMS += \
345         test_output \
346         test_vt \
347         test_input \
348         test_key
349 endif
350
351 kmscon_SOURCES = \
352         $(SHL_DLIST) \
353         $(SHL_MISC) \
354         $(SHL_ARRAY) \
355         $(SHL_HASHTABLE) \
356         $(SHL_RING) \
357         $(SHL_TIMER) \
358         $(SHL_HOOK) \
359         src/conf.h \
360         src/conf.c \
361         src/log.h \
362         src/log.c \
363         src/pty.h \
364         src/pty.c \
365         src/text.h \
366         src/text.c \
367         src/kmscon_terminal.h \
368         src/kmscon_dummy.h \
369         src/kmscon_compositor.h \
370         src/kmscon_seat.h \
371         src/kmscon_seat.c \
372         src/kmscon_conf.h \
373         src/kmscon_conf.c \
374         src/kmscon_main.c
375 nodist_kmscon_SOURCES =
376
377 kmscon_CPPFLAGS = \
378         $(AM_CPPFLAGS) \
379         $(XKBCOMMON_CFLAGS)
380 kmscon_LDADD = \
381         $(XKBCOMMON_LIBS) \
382         libeloop.la \
383         libuterm.la \
384         libtext-font.la \
385         -lpthread
386
387 if BUILD_ENABLE_SESSION_DUMMY
388 kmscon_SOURCES += src/kmscon_dummy.c
389 endif
390
391 if BUILD_ENABLE_SESSION_TERMINAL
392 kmscon_SOURCES += src/kmscon_terminal.c
393 kmscon_LDADD += libtsm.la
394 endif
395
396 if BUILD_ENABLE_SESSION_CDEV
397 kmscon_SOURCES += src/kmscon_cdev.c
398 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
399 kmscon_LDADD += $(FUSE_LIBS)
400 endif
401
402 if BUILD_ENABLE_SESSION_COMPOSITOR
403 kmscon_SOURCES += src/kmscon_compositor.c
404 kmscon_CPPFLAGS += $(WAYLAND_CFLAGS)
405 kmscon_LDADD += $(WAYLAND_LIBS)
406 endif
407
408 if BUILD_ENABLE_RENDERER_BBLIT
409 kmscon_SOURCES += src/text_bblit.c
410 endif
411
412 if BUILD_ENABLE_RENDERER_BBULK
413 kmscon_SOURCES += src/text_bbulk.c
414 endif
415
416 if BUILD_ENABLE_RENDERER_GLTEX
417 kmscon_SOURCES += \
418         src/text_gltex.c \
419         src/static_gl.h \
420         src/static_gl_math.c \
421         src/static_gl_shader.c
422 nodist_kmscon_SOURCES += src/static_shaders.c
423 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
424 kmscon_LDADD += $(GLES2_LIBS)
425 endif
426
427 #
428 # Wayland Terminal
429 #
430
431 if BUILD_ENABLE_WLTERM
432 bin_PROGRAMS += wlterm
433 endif
434
435 wlterm_SOURCES = \
436         $(SHL_MISC) \
437         $(SHL_ARRAY) \
438         $(SHL_DLIST) \
439         $(SHL_HOOK) \
440         src/wlt_main.h \
441         src/wlt_main.c \
442         src/wlt_toolkit.h \
443         src/wlt_toolkit.c \
444         src/wlt_theme.h \
445         src/wlt_theme.c \
446         src/wlt_terminal.h \
447         src/wlt_terminal.c \
448         src/log.h \
449         src/log.c \
450         src/conf.h \
451         src/conf.c \
452         src/pty.h \
453         src/pty.c
454 wlterm_CPPFLAGS = \
455         $(AM_CPPFLAGS) \
456         $(WAYLAND_CFLAGS) \
457         $(XKBCOMMON_CFLAGS)
458 wlterm_LDADD = \
459         $(WAYLAND_LIBS) \
460         $(XKBCOMMON_LIBS) \
461         libeloop.la \
462         libtsm.la \
463         libtext-font.la \
464         -lpthread
465
466 #
467 # Tests
468 #
469
470 test_output_SOURCES = \
471         tests/test_include.h \
472         tests/test_output.c
473 test_output_LDADD = \
474         libuterm.la
475
476 test_vt_SOURCES = tests/test_vt.c
477 test_vt_LDADD =
478
479 test_input_SOURCES = tests/test_input.c
480 test_input_LDADD =
481
482 test_key_SOURCES = tests/test_key.c