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/githead.h contains a constant BUILD_GIT_HEAD which is defined
116 # to the string returned by "git describe". We need to adjust this string for
117 # every build and correctly rebuild any sources that depend on it. Therefore,
118 # you should use this file rarely as it causes rebuilds on every git-commit.
120 # We have a helper-script ./src/genversion.sh that takes as argument the header
121 # file and creates it if necessary. It updates it only if the new git-describe
122 # string is different to the old one. So the file is only modified on changes.
123 # Hence, we can use it as normal dependency in this Makefile.
124 # However, we need to run this script on _every_ "make" invocation before any
125 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
126 # "simply expanded" variable (:=) so the shell command is executed on
127 # variable-declaration and not during expansion.
129 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
130 # tarball might delete that file and have no way to recreate it.
131 # We could delete it on something like "make maintainerclean", but then again,
132 # it seems unnecessary so lets simply not clean it at all.
134 # If the helper-script is executed in a directory that is not a git-repository
135 # (like a distribution tarball) and githead.h exists, then it does nothing as it
136 # expects githead.h to be correctly written by "make dist".
137 # However, if githead.h does not exist, it will print a warning and write
138 # "<unknown>" as git-revision.
139 # This guarantees, that githead.h is always present and has the most correct
140 # value that we can get under any conditions.
142 # The $(emptyvariable) expansion below is used for broken $(shell ...)
143 # syntax-highlighting algorithms in many existing editors.
146 EXTRA_DIST += src/genversion.sh
147 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
150 # SHL - Static Helper Library
151 # The SHL subsystem contains several small code pieces used all over kmscon and
152 # other applications.
155 noinst_LTLIBRARIES += libshl.la
157 libshl_la_SOURCES = \
160 src/shl_hashtable.h \
169 libshl_la_CPPFLAGS = \
171 $(XKBCOMMON_CFLAGS) \
173 libshl_la_LDFLAGS = \
182 # This library contains the whole event-loop implementation of kmscon. It is
183 # compiled into a separate object to allow using it in several other programs.
186 if BUILD_ENABLE_ELOOP
187 lib_LTLIBRARIES += libeloop.la
188 include_HEADERS += src/eloop.h
189 pkgconfig_DATA += docs/pc/libeloop.pc
192 libeloop_la_SOURCES = \
196 libeloop_la_LIBADD = libshl.la
197 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
198 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
199 libeloop_la_LDFLAGS = \
201 -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
202 -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
205 if BUILD_ENABLE_ELOOP_DBUS
206 libeloop_la_SOURCES += \
207 external/dbus-common.h \
208 external/dbus-loop.h \
210 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
211 libeloop_la_LIBADD += $(DBUS_LIBS)
216 # The Terminal-emulator State Machine is a library that implements the whole VTE
217 # layer and everything related to it. It has no external dependencies so it can
218 # be used to implement any kind of terminal emulator or debugger.
222 lib_LTLIBRARIES += libtsm.la
227 pkgconfig_DATA += docs/pc/libtsm.pc
230 libtsm_la_SOURCES = \
237 src/tsm_vte_charsets.c \
241 libtsm_la_CPPFLAGS = \
247 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
248 libtsm_la_LDFLAGS = \
250 -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
251 -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
255 # Implementation of Virtual Terminals in user-space with the help of CUSE/FUSE
256 # so we can provide character-device drivers in user-space. Aims to be 100%
257 # compatible but also provides many other use-cases.
261 lib_LTLIBRARIES += libuvt.la
262 include_HEADERS += src/uvt.h
263 pkgconfig_DATA += docs/pc/libuvt.pc
266 libuvt_la_SOURCES = \
273 libuvt_la_CPPFLAGS = \
276 -DFUSE_USE_VERSION=29
280 EXTRA_libuvt_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuvt.sym
281 libuvt_la_LDFLAGS = \
283 -version-info $(LIBUVT_CURRENT):$(LIBUVT_REVISION):$(LIBUVT_AGE) \
284 -Wl,--version-script="$(top_srcdir)/docs/sym/libuvt.sym"
288 # The uterm library provides helpers to create terminals in user-space. They
289 # are not limited to text-based terminals but rather provide graphics contexts
290 # so arbitrary output can be displayed. Additionally, they provide VT
291 # abstractions and an input layer
294 if BUILD_ENABLE_UTERM
295 lib_LTLIBRARIES += libuterm.la
298 src/uterm_monitor.h \
301 pkgconfig_DATA += docs/pc/libuterm.pc
304 libuterm_la_SOURCES = \
306 src/uterm_monitor.h \
309 src/uterm_input_internal.h \
310 src/uterm_video_internal.h \
311 src/uterm_systemd_internal.h \
313 src/uterm_monitor.c \
316 src/uterm_input_uxkb.c
318 nodist_libuterm_la_SOURCES =
320 libuterm_la_CPPFLAGS = \
323 libuterm_la_LIBADD = \
327 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
328 libuterm_la_LDFLAGS = \
330 -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
331 -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
333 if BUILD_ENABLE_MULTI_SEAT
334 libuterm_la_SOURCES += src/uterm_systemd.c
335 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
336 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
339 if BUILD_ENABLE_HOTPLUG
340 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
341 libuterm_la_LIBADD += $(UDEV_LIBS)
344 if BUILD_ENABLE_VIDEO_FBDEV
345 libuterm_la_SOURCES += \
346 src/uterm_fbdev_internal.h \
347 src/uterm_fbdev_video.c \
348 src/uterm_fbdev_render.c
351 if BUILD_ENABLE_VIDEO_DRM2D
352 libuterm_la_SOURCES += \
353 src/uterm_drm2d_internal.h \
354 src/uterm_drm2d_video.c \
355 src/uterm_drm2d_render.c
356 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
357 libuterm_la_LIBADD += $(DRM_LIBS)
360 if BUILD_ENABLE_VIDEO_DRM3D
361 noinst_PROGRAMS += genshader
362 libuterm_la_SOURCES += \
363 src/uterm_drm3d_internal.h \
364 src/uterm_drm3d_video.c \
365 src/uterm_drm3d_render.c \
367 src/static_gl_math.c \
368 src/static_gl_shader.c
369 nodist_libuterm_la_SOURCES += src/static_shaders.c
370 libuterm_la_CPPFLAGS += \
375 libuterm_la_LIBADD += \
382 # add shared sources only once
383 UTERM_DRM_SHARED_SRC = \
384 src/uterm_drm_shared_internal.h \
385 src/uterm_drm_shared.c
386 if BUILD_ENABLE_VIDEO_DRM2D
387 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
389 if BUILD_ENABLE_VIDEO_DRM3D
390 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
396 # As there is no need to modify shaders at run-time, we statically compile them
397 # into object files. As autotools would ignore them, we need to add them to
399 # The program that converts the shaders into C-source files is "genshader". It's
400 # pretty simple and just creates a string with the shader source as content.
404 $(srcdir)/src/static_fill.vert \
405 $(srcdir)/src/static_fill.frag \
406 $(srcdir)/src/static_blend.vert \
407 $(srcdir)/src/static_blend.frag \
408 $(srcdir)/src/static_blit.vert \
409 $(srcdir)/src/static_blit.frag \
410 $(srcdir)/src/static_gltex.vert \
411 $(srcdir)/src/static_gltex.frag
413 EXTRA_DIST += $(SHADERS)
414 CLEANFILES += src/static_shaders.c
415 genshader_SOURCES = src/genshader.c
417 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
418 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
422 # This generates the unifont sources from raw hex-encoded font data.
425 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
426 UNIFONT_BIN = src/font_unifont_data.bin
428 EXTRA_DIST += $(UNIFONT)
429 CLEANFILES += $(UNIFONT_BIN)
430 genunifont_SOURCES = src/genunifont.c
432 $(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
433 $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
439 if BUILD_ENABLE_FONT_UNIFONT
440 module_LTLIBRARIES += mod-unifont.la
441 noinst_PROGRAMS += genunifont
444 mod_unifont_la_SOURCES = \
445 src/kmscon_module_interface.h \
448 src/kmscon_mod_unifont.c
449 EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
450 mod_unifont_la_LIBADD = libshl.la
451 mod_unifont_la_LDFLAGS = \
455 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
457 if BUILD_ENABLE_FONT_FREETYPE2
458 module_LTLIBRARIES += mod-freetype2.la
461 mod_freetype2_la_SOURCES = \
462 src/kmscon_module_interface.h \
464 src/font_freetype2.c \
465 src/kmscon_mod_freetype2.c
466 mod_freetype2_la_CPPFLAGS = \
469 mod_freetype2_la_LIBADD = \
474 mod_freetype2_la_LDFLAGS = \
479 if BUILD_ENABLE_FONT_PANGO
480 module_LTLIBRARIES += mod-pango.la
483 mod_pango_la_SOURCES = \
484 src/kmscon_module_interface.h \
487 src/kmscon_mod_pango.c
488 mod_pango_la_CPPFLAGS = \
491 mod_pango_la_LIBADD = \
496 mod_pango_la_LDFLAGS = \
501 if BUILD_ENABLE_RENDERER_BBULK
502 module_LTLIBRARIES += mod-bbulk.la
505 mod_bbulk_la_SOURCES = \
506 src/kmscon_module_interface.h \
509 src/kmscon_mod_bbulk.c
510 mod_bbulk_la_LIBADD = libshl.la
511 mod_bbulk_la_LDFLAGS = \
516 if BUILD_ENABLE_RENDERER_GLTEX
517 module_LTLIBRARIES += mod-gltex.la
518 noinst_PROGRAMS += genshader
521 mod_gltex_la_SOURCES = \
522 src/kmscon_module_interface.h \
526 src/static_gl_math.c \
527 src/static_gl_shader.c \
528 src/kmscon_mod_gltex.c
529 nodist_mod_gltex_la_SOURCES = \
531 mod_gltex_la_CPPFLAGS = \
534 mod_gltex_la_LIBADD = \
537 mod_gltex_la_LDFLAGS = \
542 if BUILD_ENABLE_RENDERER_CAIRO
543 module_LTLIBRARIES += mod-cairo.la
546 mod_cairo_la_SOURCES = \
547 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 \
570 src/kmscon_mod_pixman.c
571 mod_pixman_la_CPPFLAGS = \
574 mod_pixman_la_LIBADD = \
577 mod_pixman_la_LDFLAGS = \
584 # These are the sources for the main binaries and test programs. They mostly
585 # consists of a single source file only and include all the libraries that are
586 # built as part of kmscon.
589 if BUILD_ENABLE_KMSCON
590 bin_PROGRAMS += kmscon
596 MANPAGES += docs/man/kmscon.1
613 src/kmscon_module_interface.h \
614 src/kmscon_module.h \
615 src/kmscon_module.c \
616 src/kmscon_terminal.h \
624 nodist_kmscon_SOURCES =
640 if BUILD_ENABLE_SESSION_DUMMY
641 kmscon_SOURCES += src/kmscon_dummy.c
644 if BUILD_ENABLE_SESSION_TERMINAL
645 kmscon_SOURCES += src/kmscon_terminal.c
646 kmscon_LDADD += libtsm.la
649 if BUILD_ENABLE_SESSION_CDEV
650 kmscon_SOURCES += src/kmscon_cdev.c
651 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
652 kmscon_LDADD += $(FUSE_LIBS)
659 if BUILD_ENABLE_WLTERM
660 bin_PROGRAMS += wlterm
713 test_output_SOURCES = \
716 test_output_CPPFLAGS = $(test_cflags)
717 test_output_LDADD = \
724 test_vt_CPPFLAGS = $(test_cflags)
729 test_input_SOURCES = \
732 test_input_CPPFLAGS = $(test_cflags)
740 test_key_CPPFLAGS = $(test_cflags)
741 test_key_LDADD = $(test_libs)
748 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
749 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
751 if BUILD_HAVE_XSLTPROC
752 if BUILD_HAVE_MANPAGES_STYLESHEET
754 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
757 --stringparam man.authors.section.enabled 0 \
758 --stringparam man.copyright.section.enabled 0 \
759 --stringparam funcsynopsis.style ansi \
760 --stringparam man.output.quietly 1 \
763 XSLTPROC_PROCESS_MAN = \
764 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
765 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
768 # Force .man_fixup if $(MANPAGES) are not built
769 .man_fixup: | $(MANPAGES)
772 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
773 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
775 docs/man/%.1: docs/man/%.xml
776 $(XSLTPROC_PROCESS_MAN)
778 docs/man/%.3: docs/man/%.xml
779 $(XSLTPROC_PROCESS_MAN)
781 docs/man/%.5: docs/man/%.xml
782 $(XSLTPROC_PROCESS_MAN)
784 docs/man/%.7: docs/man/%.xml
785 $(XSLTPROC_PROCESS_MAN)
787 endif # BUILD_HAVE_MANPAGES_STYLESHEET
788 endif # BUILD_HAVE_XSLTPROC