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