2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
7 # Library Version Numbers
27 # Global Configurations and Initializations
30 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
31 AM_MAKEFLAGS = --no-print-directory
32 AUTOMAKE_OPTIONS = color-tests
33 AM_DISTCHECK_CONFIGURE_FLAGS = --enable-wlterm
45 docs/kmsconvt@.service \
46 docs/pc/libeloop.pc.in \
47 docs/pc/libtsm.pc.in \
48 docs/pc/libuvt.pc.in \
49 docs/pc/libuterm.pc.in \
50 docs/sym/libeloop.sym \
55 pkgconfigdir = $(libdir)/pkgconfig
67 moduledir = $(libdir)/kmscon
72 # Make all files include "config.h" by default. This shouldn't cause any
73 # problems and we cannot forget to include it anymore.
75 # Also make the linker discard all unused symbols.
77 # When compiling in debug mode, we enable debug symbols so debugging with gdb
78 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
79 # Otherwise, we use standard optimizations -O2.
87 -fdiagnostics-show-option \
88 -fno-strict-aliasing \
94 -DBUILD_MODULE_DIR='"$(moduledir)"' \
95 -include $(top_builddir)/config.h \
103 if BUILD_ENABLE_DEBUG
107 if BUILD_ENABLE_OPTIMIZATIONS
115 # The file ./src/shl_githead.c contains a constant "shl_git_head" which is
116 # defined to the string returned by "git describe". We need to adjust this
117 # string for every build and correctly rebuild any sources that depend on it.
118 # Therefore, you should use this file rarely as it causes rebuilds on every
121 # We have a helper-script ./src/genversion.sh that takes as argument the source
122 # file and creates it if necessary. It updates it only if the new git-describe
123 # string is different to the old one. So the file is only modified on changes.
124 # Hence, we can use it as normal dependency in this Makefile.
125 # However, we need to run this script on _every_ "make" invocation before any
126 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
127 # "simply expanded" variable (:=) so the shell command is executed on
128 # variable-declaration and not during expansion.
130 # Note that we must not clean ./src/shl_githead.c ever! If we would, a
131 # distribution tarball might delete that file and have no way to recreate it.
132 # We could delete it on something like "make maintainerclean", but then again,
133 # it seems unnecessary so lets simply not clean it at all.
135 # If the helper-script is executed in a directory that is not a git-repository
136 # (like a distribution tarball) and shl_githead.c exists, then it does nothing
137 # as it expects shl_githead.c to be correctly written by "make dist".
138 # However, if shl_githead.c does not exist, it will print a warning and write
139 # an unknown random git-revision.
140 # This guarantees, that shl_githead.c is always present and has the most correct
141 # value that we can get under any conditions.
143 # The $(emptyvariable) expansion below is used for broken $(shell ...)
144 # syntax-highlighting algorithms in many existing editors.
147 EXTRA_DIST += src/genversion.sh
148 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/shl_githead.c")
151 # SHL - Static Helper Library
152 # The SHL subsystem contains several small code pieces used all over kmscon and
153 # other applications.
156 noinst_LTLIBRARIES += libshl.la
158 libshl_la_SOURCES = \
163 src/shl_hashtable.h \
174 libshl_la_CPPFLAGS = \
176 $(XKBCOMMON_CFLAGS) \
178 libshl_la_LDFLAGS = \
187 # This library contains the whole event-loop implementation of kmscon. It is
188 # compiled into a separate object to allow using it in several other programs.
191 if BUILD_ENABLE_ELOOP
192 lib_LTLIBRARIES += libeloop.la
193 include_HEADERS += src/eloop.h
194 pkgconfig_DATA += docs/pc/libeloop.pc
197 libeloop_la_SOURCES = \
201 libeloop_la_LIBADD = libshl.la
202 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
203 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
204 libeloop_la_LDFLAGS = \
206 -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
207 -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
210 if BUILD_ENABLE_ELOOP_DBUS
211 libeloop_la_SOURCES += \
212 external/dbus-common.h \
213 external/dbus-loop.h \
215 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
216 libeloop_la_LIBADD += $(DBUS_LIBS)
221 # The Terminal-emulator State Machine is a library that implements the whole VTE
222 # layer and everything related to it. It has no external dependencies so it can
223 # be used to implement any kind of terminal emulator or debugger.
227 lib_LTLIBRARIES += libtsm.la
232 pkgconfig_DATA += docs/pc/libtsm.pc
235 libtsm_la_SOURCES = \
242 src/tsm_vte_charsets.c \
246 libtsm_la_CPPFLAGS = \
252 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
253 libtsm_la_LDFLAGS = \
255 -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
256 -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
260 # Implementation of Virtual Terminals in user-space with the help of CUSE/FUSE
261 # so we can provide character-device drivers in user-space. Aims to be 100%
262 # compatible but also provides many other use-cases.
266 lib_LTLIBRARIES += libuvt.la
267 include_HEADERS += src/uvt.h
268 pkgconfig_DATA += docs/pc/libuvt.pc
271 libuvt_la_SOURCES = \
278 libuvt_la_CPPFLAGS = \
281 -DFUSE_USE_VERSION=29
285 EXTRA_libuvt_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuvt.sym
286 libuvt_la_LDFLAGS = \
288 -version-info $(LIBUVT_CURRENT):$(LIBUVT_REVISION):$(LIBUVT_AGE) \
289 -Wl,--version-script="$(top_srcdir)/docs/sym/libuvt.sym"
293 # The uterm library provides helpers to create terminals in user-space. They
294 # are not limited to text-based terminals but rather provide graphics contexts
295 # so arbitrary output can be displayed. Additionally, they provide VT
296 # abstractions and an input layer
299 if BUILD_ENABLE_UTERM
300 lib_LTLIBRARIES += libuterm.la
303 src/uterm_monitor.h \
306 pkgconfig_DATA += docs/pc/libuterm.pc
309 libuterm_la_SOURCES = \
311 src/uterm_monitor.h \
314 src/uterm_input_internal.h \
315 src/uterm_video_internal.h \
316 src/uterm_systemd_internal.h \
318 src/uterm_monitor.c \
321 src/uterm_input_uxkb.c
323 nodist_libuterm_la_SOURCES =
325 libuterm_la_CPPFLAGS = \
328 libuterm_la_LIBADD = \
332 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
333 libuterm_la_LDFLAGS = \
335 -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
336 -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
338 if BUILD_ENABLE_MULTI_SEAT
339 libuterm_la_SOURCES += src/uterm_systemd.c
340 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
341 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
344 if BUILD_ENABLE_HOTPLUG
345 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
346 libuterm_la_LIBADD += $(UDEV_LIBS)
349 if BUILD_ENABLE_VIDEO_FBDEV
350 libuterm_la_SOURCES += \
351 src/uterm_fbdev_internal.h \
352 src/uterm_fbdev_video.c \
353 src/uterm_fbdev_render.c
356 if BUILD_ENABLE_VIDEO_DRM2D
357 libuterm_la_SOURCES += \
358 src/uterm_drm2d_internal.h \
359 src/uterm_drm2d_video.c \
360 src/uterm_drm2d_render.c
361 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
362 libuterm_la_LIBADD += $(DRM_LIBS)
365 if BUILD_ENABLE_VIDEO_DRM3D
366 noinst_PROGRAMS += genshader
367 libuterm_la_SOURCES += \
368 src/uterm_drm3d_internal.h \
369 src/uterm_drm3d_video.c \
370 src/uterm_drm3d_render.c \
372 src/static_gl_math.c \
373 src/static_gl_shader.c
374 nodist_libuterm_la_SOURCES += src/static_shaders.c
375 libuterm_la_CPPFLAGS += \
380 libuterm_la_LIBADD += \
387 # add shared sources only once
388 UTERM_DRM_SHARED_SRC = \
389 src/uterm_drm_shared_internal.h \
390 src/uterm_drm_shared.c
391 if BUILD_ENABLE_VIDEO_DRM2D
392 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
394 if BUILD_ENABLE_VIDEO_DRM3D
395 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
401 # As there is no need to modify shaders at run-time, we statically compile them
402 # into object files. As autotools would ignore them, we need to add them to
404 # The program that converts the shaders into C-source files is "genshader". It's
405 # pretty simple and just creates a string with the shader source as content.
409 $(srcdir)/src/static_fill.vert \
410 $(srcdir)/src/static_fill.frag \
411 $(srcdir)/src/static_blend.vert \
412 $(srcdir)/src/static_blend.frag \
413 $(srcdir)/src/static_blit.vert \
414 $(srcdir)/src/static_blit.frag \
415 $(srcdir)/src/static_gltex.vert \
416 $(srcdir)/src/static_gltex.frag
418 EXTRA_DIST += $(SHADERS)
419 CLEANFILES += src/static_shaders.c
420 genshader_SOURCES = src/genshader.c
422 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
423 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
427 # This generates the unifont sources from raw hex-encoded font data.
430 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
431 UNIFONT_BIN = src/font_unifont_data.bin
433 EXTRA_DIST += $(UNIFONT)
434 CLEANFILES += $(UNIFONT_BIN)
435 genunifont_SOURCES = src/genunifont.c
437 $(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
438 $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
444 if BUILD_ENABLE_FONT_UNIFONT
445 module_LTLIBRARIES += mod-unifont.la
446 noinst_PROGRAMS += genunifont
449 mod_unifont_la_SOURCES = \
450 src/kmscon_module_interface.h \
452 src/kmscon_mod_unifont.c
453 EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
454 mod_unifont_la_LIBADD = libshl.la
455 mod_unifont_la_LDFLAGS = \
460 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
462 if BUILD_ENABLE_FONT_FREETYPE2
463 module_LTLIBRARIES += mod-freetype2.la
466 mod_freetype2_la_SOURCES = \
467 src/kmscon_module_interface.h \
468 src/font_freetype2.c \
469 src/kmscon_mod_freetype2.c
470 mod_freetype2_la_CPPFLAGS = \
473 mod_freetype2_la_LIBADD = \
478 mod_freetype2_la_LDFLAGS = \
483 if BUILD_ENABLE_FONT_PANGO
484 module_LTLIBRARIES += mod-pango.la
487 mod_pango_la_SOURCES = \
488 src/kmscon_module_interface.h \
490 src/kmscon_mod_pango.c
491 mod_pango_la_CPPFLAGS = \
494 mod_pango_la_LIBADD = \
499 mod_pango_la_LDFLAGS = \
504 if BUILD_ENABLE_RENDERER_BBULK
505 module_LTLIBRARIES += mod-bbulk.la
508 mod_bbulk_la_SOURCES = \
509 src/kmscon_module_interface.h \
511 src/kmscon_mod_bbulk.c
512 mod_bbulk_la_LIBADD = libshl.la
513 mod_bbulk_la_LDFLAGS = \
518 if BUILD_ENABLE_RENDERER_GLTEX
519 module_LTLIBRARIES += mod-gltex.la
520 noinst_PROGRAMS += genshader
523 mod_gltex_la_SOURCES = \
524 src/kmscon_module_interface.h \
527 src/static_gl_math.c \
528 src/static_gl_shader.c \
529 src/kmscon_mod_gltex.c
530 nodist_mod_gltex_la_SOURCES = \
532 mod_gltex_la_CPPFLAGS = \
535 mod_gltex_la_LIBADD = \
538 mod_gltex_la_LDFLAGS = \
543 if BUILD_ENABLE_RENDERER_CAIRO
544 module_LTLIBRARIES += mod-cairo.la
547 mod_cairo_la_SOURCES = \
548 src/kmscon_module_interface.h \
550 src/kmscon_mod_cairo.c
551 mod_cairo_la_CPPFLAGS = \
554 mod_cairo_la_LIBADD = \
557 mod_cairo_la_LDFLAGS = \
562 if BUILD_ENABLE_RENDERER_PIXMAN
563 module_LTLIBRARIES += mod-pixman.la
566 mod_pixman_la_SOURCES = \
567 src/kmscon_module_interface.h \
569 src/kmscon_mod_pixman.c
570 mod_pixman_la_CPPFLAGS = \
573 mod_pixman_la_LIBADD = \
576 mod_pixman_la_LDFLAGS = \
583 # These are the sources for the main binaries and test programs. They mostly
584 # consists of a single source file only and include all the libraries that are
585 # built as part of kmscon.
588 if BUILD_ENABLE_KMSCON
589 bin_PROGRAMS += kmscon
595 MANPAGES += docs/man/kmscon.1
609 src/kmscon_module_interface.h \
610 src/kmscon_module.h \
611 src/kmscon_module.c \
612 src/kmscon_terminal.h \
620 nodist_kmscon_SOURCES =
636 if BUILD_ENABLE_SESSION_DUMMY
637 kmscon_SOURCES += src/kmscon_dummy.c
640 if BUILD_ENABLE_SESSION_TERMINAL
641 kmscon_SOURCES += src/kmscon_terminal.c
642 kmscon_LDADD += libtsm.la
645 if BUILD_ENABLE_SESSION_CDEV
646 kmscon_SOURCES += src/kmscon_cdev.c
647 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
648 kmscon_LDADD += $(FUSE_LIBS)
655 if BUILD_ENABLE_WLTERM
656 bin_PROGRAMS += wlterm
705 test_output_SOURCES = \
708 test_output_CPPFLAGS = $(test_cflags)
709 test_output_LDADD = \
716 test_vt_CPPFLAGS = $(test_cflags)
721 test_input_SOURCES = \
724 test_input_CPPFLAGS = $(test_cflags)
732 test_key_CPPFLAGS = $(test_cflags)
733 test_key_LDADD = $(test_libs)
740 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
741 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
743 if BUILD_HAVE_XSLTPROC
744 if BUILD_HAVE_MANPAGES_STYLESHEET
746 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
749 --stringparam man.authors.section.enabled 0 \
750 --stringparam man.copyright.section.enabled 0 \
751 --stringparam funcsynopsis.style ansi \
752 --stringparam man.output.quietly 1 \
755 XSLTPROC_PROCESS_MAN = \
756 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
757 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
760 # Force .man_fixup if $(MANPAGES) are not built
761 .man_fixup: | $(MANPAGES)
764 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
765 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
767 docs/man/%.1: docs/man/%.xml
768 $(XSLTPROC_PROCESS_MAN)
770 docs/man/%.3: docs/man/%.xml
771 $(XSLTPROC_PROCESS_MAN)
773 docs/man/%.5: docs/man/%.xml
774 $(XSLTPROC_PROCESS_MAN)
776 docs/man/%.7: docs/man/%.xml
777 $(XSLTPROC_PROCESS_MAN)
779 endif # BUILD_HAVE_MANPAGES_STYLESHEET
780 endif # BUILD_HAVE_XSLTPROC