Move .pc files to ./docs/pc/
[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 += docs/pc/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         docs/pc/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 += docs/pc/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_systemd.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
189 nodist_libuterm_la_SOURCES =
190
191 libuterm_la_CPPFLAGS = \
192         $(AM_CPPFLAGS) \
193         $(XKBCOMMON_CFLAGS)
194 libuterm_la_LIBADD =
195         $(XKBCOMMON_LIBS) \
196         libeloop.la
197 libuterm_la_LDFLAGS = \
198         -version-info 1:0:0
199
200 if BUILD_ENABLE_MULTI_SEAT
201 libuterm_la_SOURCES += src/uterm_systemd.c
202 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
203 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
204 endif
205
206 if BUILD_ENABLE_HOTPLUG
207 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
208 libuterm_la_LIBADD += $(UDEV_LIBS)
209 endif
210
211 if BUILD_ENABLE_PCIACCESS
212 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
213 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
214 libuterm_la_SOURCES += src/uterm_pci.c
215 endif
216
217 if BUILD_ENABLE_VIDEO_FBDEV
218 libuterm_la_SOURCES += src/uterm_video_fbdev.c
219 endif
220
221 if BUILD_ENABLE_VIDEO_DUMB
222 libuterm_la_SOURCES += src/uterm_video_dumb.c
223 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
224 libuterm_la_LIBADD += $(DRM_LIBS)
225 endif
226
227 if BUILD_ENABLE_VIDEO_DRM
228 libuterm_la_SOURCES += \
229         src/uterm_video_drm.c \
230         src/static_gl.h \
231         src/static_gl_math.c \
232         src/static_gl_shader.c
233 nodist_libuterm_la_SOURCES += \
234         src/static_shaders.c
235 libuterm_la_CPPFLAGS += \
236         $(DRM_CFLAGS) \
237         $(EGL_CFLAGS) \
238         $(GBM_CFLAGS) \
239         $(GLES2_CFLAGS)
240 libuterm_la_LIBADD += \
241         $(DRM_LIBS) \
242         $(EGL_LIBS) \
243         $(GBM_LIBS) \
244         $(GLES2_LIBS)
245 endif
246
247 #
248 # Shaders
249 # As there is no need to modify shaders at run-time, we statically compile them
250 # into object files. As autotools would ignore them, we need to add them to
251 # EXTRA_DIST.
252 # The program that converts the shaders into C-source files is "genshader". It's
253 # pretty simple and just creates a string with the shader source as content.
254 #
255
256 SHADERS = \
257         $(srcdir)/src/static_fill.vert \
258         $(srcdir)/src/static_fill.frag \
259         $(srcdir)/src/static_blend.vert \
260         $(srcdir)/src/static_blend.frag \
261         $(srcdir)/src/static_blit.vert \
262         $(srcdir)/src/static_blit.frag \
263         $(srcdir)/src/static_gltex.vert \
264         $(srcdir)/src/static_gltex.frag
265
266 EXTRA_DIST += $(SHADERS)
267 CLEANFILES += src/static_shaders.c
268 genshader_SOURCES = src/genshader.c
269
270 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
271         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
272
273 #
274 # Unifont Generator
275 # This generates the unifont sources from raw hex-encoded font data.
276 #
277
278 UNIFONT = src/text_font_unifont_data.hex
279
280 EXTRA_DIST += $(UNIFONT)
281 CLEANFILES += src/text_font_unifont_data.c
282 genunifont_SOURCES = src/genunifont.c
283
284 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
285         $(AM_V_GEN)./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 libtext_font_la_CPPFLAGS = \
311         $(AM_CPPFLAGS)
312 libtext_font_la_LIBADD = \
313         -lpthread \
314         libtsm.la
315
316 if BUILD_ENABLE_FONT_8X16
317 libtext_font_la_SOURCES += src/text_font_8x16.c
318 endif
319
320 if BUILD_ENABLE_FONT_UNIFONT
321 libtext_font_la_SOURCES += src/text_font_unifont.c
322 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
323 endif
324
325 if BUILD_ENABLE_FONT_FREETYPE2
326 libtext_font_la_SOURCES += src/text_font_freetype2.c
327 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
328 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
329 endif
330
331 if BUILD_ENABLE_FONT_PANGO
332 libtext_font_la_SOURCES += src/text_font_pango.c
333 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
334 libtext_font_la_LIBADD += $(PANGO_LIBS)
335 endif
336
337 #
338 # Binaries
339 # These are the sources for the main binaries and test programs. They mostly
340 # consists of a single source file only and include all the libraries that are
341 # built as part of kmscon.
342 #
343
344 if BUILD_ENABLE_KMSCON
345 bin_PROGRAMS += kmscon
346 check_PROGRAMS += \
347         test_output \
348         test_vt \
349         test_input \
350         test_key
351 endif
352
353 kmscon_SOURCES = \
354         $(SHL_DLIST) \
355         $(SHL_MISC) \
356         $(SHL_ARRAY) \
357         $(SHL_HASHTABLE) \
358         $(SHL_RING) \
359         $(SHL_TIMER) \
360         $(SHL_HOOK) \
361         src/conf.h \
362         src/conf.c \
363         src/log.h \
364         src/log.c \
365         src/pty.h \
366         src/pty.c \
367         src/text.h \
368         src/text.c \
369         src/kmscon_terminal.h \
370         src/kmscon_dummy.h \
371         src/kmscon_compositor.h \
372         src/kmscon_seat.h \
373         src/kmscon_seat.c \
374         src/kmscon_conf.h \
375         src/kmscon_conf.c \
376         src/kmscon_main.c
377 nodist_kmscon_SOURCES =
378
379 kmscon_CPPFLAGS = \
380         $(AM_CPPFLAGS) \
381         $(XKBCOMMON_CFLAGS)
382 kmscon_LDADD = \
383         $(XKBCOMMON_LIBS) \
384         libeloop.la \
385         libuterm.la \
386         libtext-font.la \
387         -lpthread
388
389 if BUILD_ENABLE_SESSION_DUMMY
390 kmscon_SOURCES += src/kmscon_dummy.c
391 endif
392
393 if BUILD_ENABLE_SESSION_TERMINAL
394 kmscon_SOURCES += src/kmscon_terminal.c
395 kmscon_LDADD += libtsm.la
396 endif
397
398 if BUILD_ENABLE_SESSION_CDEV
399 kmscon_SOURCES += src/kmscon_cdev.c
400 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
401 kmscon_LDADD += $(FUSE_LIBS)
402 endif
403
404 if BUILD_ENABLE_SESSION_COMPOSITOR
405 kmscon_SOURCES += src/kmscon_compositor.c
406 kmscon_CPPFLAGS += $(WAYLAND_CFLAGS)
407 kmscon_LDADD += $(WAYLAND_LIBS)
408 endif
409
410 if BUILD_ENABLE_RENDERER_BBLIT
411 kmscon_SOURCES += src/text_bblit.c
412 endif
413
414 if BUILD_ENABLE_RENDERER_BBULK
415 kmscon_SOURCES += src/text_bbulk.c
416 endif
417
418 if BUILD_ENABLE_RENDERER_GLTEX
419 kmscon_SOURCES += \
420         src/text_gltex.c \
421         src/static_gl.h \
422         src/static_gl_math.c \
423         src/static_gl_shader.c
424 nodist_kmscon_SOURCES += src/static_shaders.c
425 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
426 kmscon_LDADD += $(GLES2_LIBS)
427 endif
428
429 #
430 # Wayland Terminal
431 #
432
433 if BUILD_ENABLE_WLTERM
434 bin_PROGRAMS += wlterm
435 endif
436
437 wlterm_SOURCES = \
438         $(SHL_MISC) \
439         $(SHL_ARRAY) \
440         $(SHL_DLIST) \
441         $(SHL_HOOK) \
442         src/wlt_main.h \
443         src/wlt_main.c \
444         src/wlt_toolkit.h \
445         src/wlt_toolkit.c \
446         src/wlt_theme.h \
447         src/wlt_theme.c \
448         src/wlt_terminal.h \
449         src/wlt_terminal.c \
450         src/log.h \
451         src/log.c \
452         src/conf.h \
453         src/conf.c \
454         src/pty.h \
455         src/pty.c
456 wlterm_CPPFLAGS = \
457         $(AM_CPPFLAGS) \
458         $(WAYLAND_CFLAGS) \
459         $(XKBCOMMON_CFLAGS)
460 wlterm_LDADD = \
461         $(WAYLAND_LIBS) \
462         $(XKBCOMMON_LIBS) \
463         libeloop.la \
464         libtsm.la \
465         libtext-font.la \
466         -lpthread
467
468 #
469 # Tests
470 #
471
472 test_sources = \
473         src/log.h \
474         src/log.c \
475         src/conf.h \
476         src/conf.c \
477         tests/test_include.h
478 test_cflags = \
479         $(XKBCOMMON_CFLAGS)
480 test_libs = \
481         $(XKBCOMMON_LIBS) \
482         libeloop.la
483
484 test_output_SOURCES = \
485         $(test_sources) \
486         tests/test_output.c
487 test_output_CPPFLAGS = \
488         $(AM_CPPFLAGS) \
489         $(test_cflags)
490 test_output_LDADD = \
491         $(test_libs) \
492         libuterm.la
493
494 test_vt_SOURCES = \
495         $(test_sources) \
496         tests/test_vt.c
497 test_vt_CPPFLAGS = \
498         $(AM_CPPFLAGS) \
499         $(test_cflags)
500 test_vt_LDADD = \
501         $(test_libs) \
502         libuterm.la
503
504 test_input_SOURCES = \
505         $(test_sources) \
506         tests/test_input.c
507 test_input_CPPFLAGS = \
508         $(AM_CPPFLAGS) \
509         $(test_cflags)
510 test_input_LDADD = \
511         $(test_libs) \
512         libuterm.la
513
514 test_key_SOURCES = \
515         $(test_sources) \
516         tests/test_key.c
517 test_key_CPPFLAGS = \
518         $(AM_CPPFLAGS) \
519         $(test_cflags)
520 test_key_LDADD = \
521         $(test_libs)