2 # Kmscon - Global Makefile
3 # Copyright (c) 2012-2013 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-all
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 \
175 libshl_la_CPPFLAGS = \
177 $(XKBCOMMON_CFLAGS) \
179 libshl_la_LDFLAGS = \
188 # This library contains the whole event-loop implementation of kmscon. It is
189 # compiled into a separate object to allow using it in several other programs.
192 if BUILD_ENABLE_ELOOP
193 lib_LTLIBRARIES += libeloop.la
194 include_HEADERS += src/eloop.h
195 pkgconfig_DATA += docs/pc/libeloop.pc
198 libeloop_la_SOURCES = \
202 libeloop_la_LIBADD = libshl.la
203 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
204 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
205 libeloop_la_LDFLAGS = \
207 -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
208 -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
211 if BUILD_ENABLE_ELOOP_DBUS
212 libeloop_la_SOURCES += \
213 external/dbus-common.h \
214 external/dbus-loop.h \
216 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
217 libeloop_la_LIBADD += $(DBUS_LIBS)
222 # The Terminal-emulator State Machine is a library that implements the whole VTE
223 # layer and everything related to it. It has no external dependencies so it can
224 # be used to implement any kind of terminal emulator or debugger.
228 lib_LTLIBRARIES += libtsm.la
233 pkgconfig_DATA += docs/pc/libtsm.pc
236 libtsm_la_SOURCES = \
243 src/tsm_vte_charsets.c \
247 libtsm_la_CPPFLAGS = \
253 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
254 libtsm_la_LDFLAGS = \
256 -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
257 -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
261 # Implementation of Virtual Terminals in user-space with the help of CUSE/FUSE
262 # so we can provide character-device drivers in user-space. Aims to be 100%
263 # compatible but also provides many other use-cases.
267 lib_LTLIBRARIES += libuvt.la
268 include_HEADERS += src/uvt.h
269 pkgconfig_DATA += docs/pc/libuvt.pc
272 libuvt_la_SOURCES = \
279 libuvt_la_CPPFLAGS = \
282 -DFUSE_USE_VERSION=29
286 EXTRA_libuvt_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuvt.sym
287 libuvt_la_LDFLAGS = \
289 -version-info $(LIBUVT_CURRENT):$(LIBUVT_REVISION):$(LIBUVT_AGE) \
290 -Wl,--version-script="$(top_srcdir)/docs/sym/libuvt.sym"
294 # The uterm library provides helpers to create terminals in user-space. They
295 # are not limited to text-based terminals but rather provide graphics contexts
296 # so arbitrary output can be displayed. Additionally, they provide VT
297 # abstractions and an input layer
300 if BUILD_ENABLE_UTERM
301 lib_LTLIBRARIES += libuterm.la
304 src/uterm_monitor.h \
307 pkgconfig_DATA += docs/pc/libuterm.pc
310 libuterm_la_SOURCES = \
312 src/uterm_monitor.h \
315 src/uterm_input_internal.h \
316 src/uterm_video_internal.h \
317 src/uterm_systemd_internal.h \
319 src/uterm_monitor.c \
322 src/uterm_input_uxkb.c
324 nodist_libuterm_la_SOURCES =
326 libuterm_la_CPPFLAGS = \
329 libuterm_la_LIBADD = \
333 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
334 libuterm_la_LDFLAGS = \
336 -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
337 -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
339 if BUILD_ENABLE_MULTI_SEAT
340 libuterm_la_SOURCES += src/uterm_systemd.c
341 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
342 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
345 if BUILD_ENABLE_HOTPLUG
346 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
347 libuterm_la_LIBADD += $(UDEV_LIBS)
350 if BUILD_ENABLE_VIDEO_FBDEV
351 libuterm_la_SOURCES += \
352 src/uterm_fbdev_internal.h \
353 src/uterm_fbdev_video.c \
354 src/uterm_fbdev_render.c
357 if BUILD_ENABLE_VIDEO_DRM2D
358 libuterm_la_SOURCES += \
359 src/uterm_drm2d_internal.h \
360 src/uterm_drm2d_video.c \
361 src/uterm_drm2d_render.c
362 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
363 libuterm_la_LIBADD += $(DRM_LIBS)
366 if BUILD_ENABLE_VIDEO_DRM3D
367 noinst_PROGRAMS += genshader
368 libuterm_la_SOURCES += \
369 src/uterm_drm3d_internal.h \
370 src/uterm_drm3d_video.c \
371 src/uterm_drm3d_render.c \
373 src/static_gl_math.c \
374 src/static_gl_shader.c
375 nodist_libuterm_la_SOURCES += src/static_shaders.c
376 libuterm_la_CPPFLAGS += \
381 libuterm_la_LIBADD += \
388 # add shared sources only once
389 UTERM_DRM_SHARED_SRC = \
390 src/uterm_drm_shared_internal.h \
391 src/uterm_drm_shared.c
392 if BUILD_ENABLE_VIDEO_DRM2D
393 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
395 if BUILD_ENABLE_VIDEO_DRM3D
396 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
402 # As there is no need to modify shaders at run-time, we statically compile them
403 # into object files. As autotools would ignore them, we need to add them to
405 # The program that converts the shaders into C-source files is "genshader". It's
406 # pretty simple and just creates a string with the shader source as content.
410 $(srcdir)/src/static_fill.vert \
411 $(srcdir)/src/static_fill.frag \
412 $(srcdir)/src/static_blend.vert \
413 $(srcdir)/src/static_blend.frag \
414 $(srcdir)/src/static_blit.vert \
415 $(srcdir)/src/static_blit.frag \
416 $(srcdir)/src/static_gltex.vert \
417 $(srcdir)/src/static_gltex.frag
419 EXTRA_DIST += $(SHADERS)
420 CLEANFILES += src/static_shaders.c
421 genshader_SOURCES = src/genshader.c
423 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
424 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
428 # This generates the unifont sources from raw hex-encoded font data.
431 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
432 UNIFONT_BIN = src/font_unifont_data.bin
434 EXTRA_DIST += $(UNIFONT)
435 CLEANFILES += $(UNIFONT_BIN)
436 genunifont_SOURCES = src/genunifont.c
438 $(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
439 $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
445 if BUILD_ENABLE_FONT_UNIFONT
446 module_LTLIBRARIES += mod-unifont.la
447 noinst_PROGRAMS += genunifont
450 mod_unifont_la_SOURCES = \
451 src/kmscon_module_interface.h \
453 src/kmscon_mod_unifont.c
454 EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
455 mod_unifont_la_LIBADD = libshl.la
456 mod_unifont_la_LDFLAGS = \
461 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
463 if BUILD_ENABLE_FONT_FREETYPE2
464 module_LTLIBRARIES += mod-freetype2.la
467 mod_freetype2_la_SOURCES = \
468 src/kmscon_module_interface.h \
469 src/font_freetype2.c \
470 src/kmscon_mod_freetype2.c
471 mod_freetype2_la_CPPFLAGS = \
474 mod_freetype2_la_LIBADD = \
479 mod_freetype2_la_LDFLAGS = \
484 if BUILD_ENABLE_FONT_PANGO
485 module_LTLIBRARIES += mod-pango.la
488 mod_pango_la_SOURCES = \
489 src/kmscon_module_interface.h \
491 src/kmscon_mod_pango.c
492 mod_pango_la_CPPFLAGS = \
495 mod_pango_la_LIBADD = \
500 mod_pango_la_LDFLAGS = \
505 if BUILD_ENABLE_RENDERER_BBULK
506 module_LTLIBRARIES += mod-bbulk.la
509 mod_bbulk_la_SOURCES = \
510 src/kmscon_module_interface.h \
512 src/kmscon_mod_bbulk.c
513 mod_bbulk_la_LIBADD = libshl.la
514 mod_bbulk_la_LDFLAGS = \
519 if BUILD_ENABLE_RENDERER_GLTEX
520 module_LTLIBRARIES += mod-gltex.la
521 noinst_PROGRAMS += genshader
524 mod_gltex_la_SOURCES = \
525 src/kmscon_module_interface.h \
528 src/static_gl_math.c \
529 src/static_gl_shader.c \
530 src/kmscon_mod_gltex.c
531 nodist_mod_gltex_la_SOURCES = \
533 mod_gltex_la_CPPFLAGS = \
536 mod_gltex_la_LIBADD = \
539 mod_gltex_la_LDFLAGS = \
544 if BUILD_ENABLE_RENDERER_CAIRO
545 module_LTLIBRARIES += mod-cairo.la
548 mod_cairo_la_SOURCES = \
549 src/kmscon_module_interface.h \
551 src/kmscon_mod_cairo.c
552 mod_cairo_la_CPPFLAGS = \
555 mod_cairo_la_LIBADD = \
558 mod_cairo_la_LDFLAGS = \
563 if BUILD_ENABLE_RENDERER_PIXMAN
564 module_LTLIBRARIES += mod-pixman.la
567 mod_pixman_la_SOURCES = \
568 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
610 src/kmscon_module_interface.h \
611 src/kmscon_module.h \
612 src/kmscon_module.c \
613 src/kmscon_terminal.h \
621 nodist_kmscon_SOURCES =
637 if BUILD_ENABLE_SESSION_DUMMY
638 kmscon_SOURCES += src/kmscon_dummy.c
641 if BUILD_ENABLE_SESSION_TERMINAL
642 kmscon_SOURCES += src/kmscon_terminal.c
643 kmscon_LDADD += libtsm.la
646 if BUILD_ENABLE_SESSION_CDEV
647 kmscon_SOURCES += src/kmscon_cdev.c
648 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
649 kmscon_LDADD += $(FUSE_LIBS)
656 if BUILD_ENABLE_WLTERM
657 bin_PROGRAMS += wlterm
733 test_output_SOURCES = \
736 test_output_CPPFLAGS = $(test_cflags)
737 test_output_LDADD = \
744 test_vt_CPPFLAGS = $(test_cflags)
749 test_input_SOURCES = \
752 test_input_CPPFLAGS = $(test_cflags)
760 test_key_CPPFLAGS = $(test_cflags)
761 test_key_LDADD = $(test_libs)
768 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
769 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
771 if BUILD_HAVE_XSLTPROC
772 if BUILD_HAVE_MANPAGES_STYLESHEET
774 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
777 --stringparam man.authors.section.enabled 0 \
778 --stringparam man.copyright.section.enabled 0 \
779 --stringparam funcsynopsis.style ansi \
780 --stringparam man.output.quietly 1 \
783 XSLTPROC_PROCESS_MAN = \
784 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
785 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
788 # Force .man_fixup if $(MANPAGES) are not built
789 .man_fixup: | $(MANPAGES)
792 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
793 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
795 docs/man/%.1: docs/man/%.xml
796 $(XSLTPROC_PROCESS_MAN)
798 docs/man/%.3: docs/man/%.xml
799 $(XSLTPROC_PROCESS_MAN)
801 docs/man/%.5: docs/man/%.xml
802 $(XSLTPROC_PROCESS_MAN)
804 docs/man/%.7: docs/man/%.xml
805 $(XSLTPROC_PROCESS_MAN)
807 endif # BUILD_HAVE_MANPAGES_STYLESHEET
808 endif # BUILD_HAVE_XSLTPROC