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 = \
456 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
458 if BUILD_ENABLE_FONT_FREETYPE2
459 module_LTLIBRARIES += mod-freetype2.la
462 mod_freetype2_la_SOURCES = \
463 src/kmscon_module_interface.h \
465 src/font_freetype2.c \
466 src/kmscon_mod_freetype2.c
467 mod_freetype2_la_CPPFLAGS = \
470 mod_freetype2_la_LIBADD = \
475 mod_freetype2_la_LDFLAGS = \
480 if BUILD_ENABLE_FONT_PANGO
481 module_LTLIBRARIES += mod-pango.la
484 mod_pango_la_SOURCES = \
485 src/kmscon_module_interface.h \
488 src/kmscon_mod_pango.c
489 mod_pango_la_CPPFLAGS = \
492 mod_pango_la_LIBADD = \
497 mod_pango_la_LDFLAGS = \
502 if BUILD_ENABLE_RENDERER_BBULK
503 module_LTLIBRARIES += mod-bbulk.la
506 mod_bbulk_la_SOURCES = \
507 src/kmscon_module_interface.h \
510 src/kmscon_mod_bbulk.c
511 mod_bbulk_la_LIBADD = libshl.la
512 mod_bbulk_la_LDFLAGS = \
517 if BUILD_ENABLE_RENDERER_GLTEX
518 module_LTLIBRARIES += mod-gltex.la
519 noinst_PROGRAMS += genshader
522 mod_gltex_la_SOURCES = \
523 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 \
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 \
571 src/kmscon_mod_pixman.c
572 mod_pixman_la_CPPFLAGS = \
575 mod_pixman_la_LIBADD = \
578 mod_pixman_la_LDFLAGS = \
585 # These are the sources for the main binaries and test programs. They mostly
586 # consists of a single source file only and include all the libraries that are
587 # built as part of kmscon.
590 if BUILD_ENABLE_KMSCON
591 bin_PROGRAMS += kmscon
597 MANPAGES += docs/man/kmscon.1
614 src/kmscon_module_interface.h \
615 src/kmscon_module.h \
616 src/kmscon_module.c \
617 src/kmscon_terminal.h \
625 nodist_kmscon_SOURCES =
641 if BUILD_ENABLE_SESSION_DUMMY
642 kmscon_SOURCES += src/kmscon_dummy.c
645 if BUILD_ENABLE_SESSION_TERMINAL
646 kmscon_SOURCES += src/kmscon_terminal.c
647 kmscon_LDADD += libtsm.la
650 if BUILD_ENABLE_SESSION_CDEV
651 kmscon_SOURCES += src/kmscon_cdev.c
652 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
653 kmscon_LDADD += $(FUSE_LIBS)
660 if BUILD_ENABLE_WLTERM
661 bin_PROGRAMS += wlterm
714 test_output_SOURCES = \
717 test_output_CPPFLAGS = $(test_cflags)
718 test_output_LDADD = \
725 test_vt_CPPFLAGS = $(test_cflags)
730 test_input_SOURCES = \
733 test_input_CPPFLAGS = $(test_cflags)
741 test_key_CPPFLAGS = $(test_cflags)
742 test_key_LDADD = $(test_libs)
749 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
750 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
752 if BUILD_HAVE_XSLTPROC
753 if BUILD_HAVE_MANPAGES_STYLESHEET
755 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
758 --stringparam man.authors.section.enabled 0 \
759 --stringparam man.copyright.section.enabled 0 \
760 --stringparam funcsynopsis.style ansi \
761 --stringparam man.output.quietly 1 \
764 XSLTPROC_PROCESS_MAN = \
765 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
766 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
769 # Force .man_fixup if $(MANPAGES) are not built
770 .man_fixup: | $(MANPAGES)
773 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
774 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
776 docs/man/%.1: docs/man/%.xml
777 $(XSLTPROC_PROCESS_MAN)
779 docs/man/%.3: docs/man/%.xml
780 $(XSLTPROC_PROCESS_MAN)
782 docs/man/%.5: docs/man/%.xml
783 $(XSLTPROC_PROCESS_MAN)
785 docs/man/%.7: docs/man/%.xml
786 $(XSLTPROC_PROCESS_MAN)
788 endif # BUILD_HAVE_MANPAGES_STYLESHEET
789 endif # BUILD_HAVE_XSLTPROC