2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
7 # Library Version Numbers
23 # Global Configurations and Initializations
26 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
27 AM_MAKEFLAGS = --no-print-directory
28 AUTOMAKE_OPTIONS = color-tests
29 AM_DISTCHECK_CONFIGURE_FLAGS = --enable-wlterm
41 docs/kmsconvt@.service \
42 docs/pc/libeloop.pc.in \
43 docs/pc/libtsm.pc.in \
44 docs/pc/libuterm.pc.in \
45 docs/sym/libeloop.sym \
49 pkgconfigdir = $(libdir)/pkgconfig
61 moduledir = $(libdir)/kmscon
66 # Make all files include "config.h" by default. This shouldn't cause any
67 # problems and we cannot forget to include it anymore.
69 # Also make the linker discard all unused symbols.
71 # When compiling in debug mode, we enable debug symbols so debugging with gdb
72 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
73 # Otherwise, we use standard optimizations -O2.
81 -fdiagnostics-show-option \
82 -fno-strict-aliasing \
88 -DBUILD_MODULE_DIR='"$(moduledir)"' \
89 -include $(top_builddir)/config.h \
101 if BUILD_ENABLE_OPTIMIZATIONS
109 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
110 # to the string returned by "git describe". We need to adjust this string for
111 # every build and correctly rebuild any sources that depend on it. Therefore,
112 # you should use this file rarely as it causes rebuilds on every git-commit.
114 # We have a helper-script ./src/genversion.sh that takes as argument the header
115 # file and creates it if necessary. It updates it only if the new git-describe
116 # string is different to the old one. So the file is only modified on changes.
117 # Hence, we can use it as normal dependency in this Makefile.
118 # However, we need to run this script on _every_ "make" invocation before any
119 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
120 # "simply expanded" variable (:=) so the shell command is executed on
121 # variable-declaration and not during expansion.
123 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
124 # tarball might delete that file and have no way to recreate it.
125 # We could delete it on something like "make maintainerclean", but then again,
126 # it seems unnecessary so lets simply not clean it at all.
128 # If the helper-script is executed in a directory that is not a git-repository
129 # (like a distribution tarball) and githead.h exists, then it does nothing as it
130 # expects githead.h to be correctly written by "make dist".
131 # However, if githead.h does not exist, it will print a warning and write
132 # "<unknown>" as git-revision.
133 # This guarantees, that githead.h is always present and has the most correct
134 # value that we can get under any conditions.
136 # The $(emptyvariable) expansion below is used for broken $(shell ...)
137 # syntax-highlighting algorithms in many existing editors.
140 EXTRA_DIST += src/genversion.sh
141 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
144 # SHL - Static Helper Library
145 # The SHL subsystem contains several small code pieces used all over kmscon and
146 # other applications.
149 noinst_LTLIBRARIES += libshl.la
151 libshl_la_SOURCES = \
154 src/shl_hashtable.h \
163 libshl_la_CPPFLAGS = \
165 $(XKBCOMMON_CFLAGS) \
167 libshl_la_LDFLAGS = \
176 # This library contains the whole event-loop implementation of kmscon. It is
177 # compiled into a separate object to allow using it in several other programs.
180 if BUILD_ENABLE_ELOOP
181 lib_LTLIBRARIES += libeloop.la
182 include_HEADERS += src/eloop.h
183 pkgconfig_DATA += docs/pc/libeloop.pc
186 libeloop_la_SOURCES = \
190 libeloop_la_LIBADD = libshl.la
191 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
192 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
193 libeloop_la_LDFLAGS = \
195 -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
196 -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
199 if BUILD_ENABLE_ELOOP_DBUS
200 libeloop_la_SOURCES += \
201 external/dbus-common.h \
202 external/dbus-loop.h \
204 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
205 libeloop_la_LIBADD += $(DBUS_LIBS)
210 # The Terminal-emulator State Machine is a library that implements the whole VTE
211 # layer and everything related to it. It has no external dependencies so it can
212 # be used to implement any kind of terminal emulator or debugger.
216 lib_LTLIBRARIES += libtsm.la
221 pkgconfig_DATA += docs/pc/libtsm.pc
224 libtsm_la_SOURCES = \
231 src/tsm_vte_charsets.c \
235 libtsm_la_CPPFLAGS = \
241 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
242 libtsm_la_LDFLAGS = \
244 -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
245 -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
249 # The uterm library provides helpers to create terminals in user-space. They
250 # are not limited to text-based terminals but rather provide graphics contexts
251 # so arbitrary output can be displayed. Additionally, they provide VT
252 # abstractions and an input layer
255 if BUILD_ENABLE_UTERM
256 lib_LTLIBRARIES += libuterm.la
259 src/uterm_monitor.h \
262 pkgconfig_DATA += docs/pc/libuterm.pc
265 libuterm_la_SOURCES = \
267 src/uterm_monitor.h \
270 src/uterm_input_internal.h \
271 src/uterm_video_internal.h \
272 src/uterm_systemd_internal.h \
274 src/uterm_monitor.c \
277 src/uterm_input_uxkb.c
279 nodist_libuterm_la_SOURCES =
281 libuterm_la_CPPFLAGS = \
284 libuterm_la_LIBADD = \
288 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
289 libuterm_la_LDFLAGS = \
291 -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
292 -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
294 if BUILD_ENABLE_MULTI_SEAT
295 libuterm_la_SOURCES += src/uterm_systemd.c
296 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
297 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
300 if BUILD_ENABLE_HOTPLUG
301 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
302 libuterm_la_LIBADD += $(UDEV_LIBS)
305 if BUILD_ENABLE_VIDEO_FBDEV
306 libuterm_la_SOURCES += \
307 src/uterm_fbdev_internal.h \
308 src/uterm_fbdev_video.c \
309 src/uterm_fbdev_render.c
312 if BUILD_ENABLE_VIDEO_DRM2D
313 libuterm_la_SOURCES += \
314 src/uterm_drm2d_internal.h \
315 src/uterm_drm2d_video.c \
316 src/uterm_drm2d_render.c
317 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
318 libuterm_la_LIBADD += $(DRM_LIBS)
321 if BUILD_ENABLE_VIDEO_DRM3D
322 noinst_PROGRAMS += genshader
323 libuterm_la_SOURCES += \
324 src/uterm_drm3d_internal.h \
325 src/uterm_drm3d_video.c \
326 src/uterm_drm3d_render.c \
328 src/static_gl_math.c \
329 src/static_gl_shader.c
330 nodist_libuterm_la_SOURCES += src/static_shaders.c
331 libuterm_la_CPPFLAGS += \
336 libuterm_la_LIBADD += \
343 # add shared sources only once
344 UTERM_DRM_SHARED_SRC = \
345 src/uterm_drm_shared_internal.h \
346 src/uterm_drm_shared.c
347 if BUILD_ENABLE_VIDEO_DRM2D
348 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
350 if BUILD_ENABLE_VIDEO_DRM3D
351 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
357 # As there is no need to modify shaders at run-time, we statically compile them
358 # into object files. As autotools would ignore them, we need to add them to
360 # The program that converts the shaders into C-source files is "genshader". It's
361 # pretty simple and just creates a string with the shader source as content.
365 $(srcdir)/src/static_fill.vert \
366 $(srcdir)/src/static_fill.frag \
367 $(srcdir)/src/static_blend.vert \
368 $(srcdir)/src/static_blend.frag \
369 $(srcdir)/src/static_blit.vert \
370 $(srcdir)/src/static_blit.frag \
371 $(srcdir)/src/static_gltex.vert \
372 $(srcdir)/src/static_gltex.frag
374 EXTRA_DIST += $(SHADERS)
375 CLEANFILES += src/static_shaders.c
376 genshader_SOURCES = src/genshader.c
378 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
379 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
383 # This generates the unifont sources from raw hex-encoded font data.
386 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
387 UNIFONT_BIN = src/font_unifont_data.bin
389 EXTRA_DIST += $(UNIFONT)
390 CLEANFILES += $(UNIFONT_BIN)
391 genunifont_SOURCES = src/genunifont.c
393 $(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
394 $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
400 if BUILD_ENABLE_FONT_UNIFONT
401 module_LTLIBRARIES += mod-unifont.la
402 noinst_PROGRAMS += genunifont
405 mod_unifont_la_SOURCES = \
406 src/kmscon_module_interface.h \
409 src/kmscon_mod_unifont.c
410 EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
411 mod_unifont_la_LIBADD = libshl.la
412 mod_unifont_la_LDFLAGS = \
416 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
418 if BUILD_ENABLE_FONT_FREETYPE2
419 module_LTLIBRARIES += mod-freetype2.la
422 mod_freetype2_la_SOURCES = \
423 src/kmscon_module_interface.h \
425 src/font_freetype2.c \
426 src/kmscon_mod_freetype2.c
427 mod_freetype2_la_CPPFLAGS = \
430 mod_freetype2_la_LIBADD = \
435 mod_freetype2_la_LDFLAGS = \
440 if BUILD_ENABLE_FONT_PANGO
441 module_LTLIBRARIES += mod-pango.la
444 mod_pango_la_SOURCES = \
445 src/kmscon_module_interface.h \
448 src/kmscon_mod_pango.c
449 mod_pango_la_CPPFLAGS = \
452 mod_pango_la_LIBADD = \
457 mod_pango_la_LDFLAGS = \
462 if BUILD_ENABLE_RENDERER_BBULK
463 module_LTLIBRARIES += mod-bbulk.la
466 mod_bbulk_la_SOURCES = \
467 src/kmscon_module_interface.h \
470 src/kmscon_mod_bbulk.c
471 mod_bbulk_la_LIBADD = libshl.la
472 mod_bbulk_la_LDFLAGS = \
477 if BUILD_ENABLE_RENDERER_GLTEX
478 module_LTLIBRARIES += mod-gltex.la
479 noinst_PROGRAMS += genshader
482 mod_gltex_la_SOURCES = \
483 src/kmscon_module_interface.h \
487 src/static_gl_math.c \
488 src/static_gl_shader.c \
489 src/kmscon_mod_gltex.c
490 nodist_mod_gltex_la_SOURCES = \
492 mod_gltex_la_CPPFLAGS = \
495 mod_gltex_la_LIBADD = \
498 mod_gltex_la_LDFLAGS = \
503 if BUILD_ENABLE_RENDERER_CAIRO
504 module_LTLIBRARIES += mod-cairo.la
507 mod_cairo_la_SOURCES = \
508 src/kmscon_module_interface.h \
511 src/kmscon_mod_cairo.c
512 mod_cairo_la_CPPFLAGS = \
515 mod_cairo_la_LIBADD = \
518 mod_cairo_la_LDFLAGS = \
523 if BUILD_ENABLE_RENDERER_PIXMAN
524 module_LTLIBRARIES += mod-pixman.la
527 mod_pixman_la_SOURCES = \
528 src/kmscon_module_interface.h \
531 src/kmscon_mod_pixman.c
532 mod_pixman_la_CPPFLAGS = \
535 mod_pixman_la_LIBADD = \
538 mod_pixman_la_LDFLAGS = \
545 # These are the sources for the main binaries and test programs. They mostly
546 # consists of a single source file only and include all the libraries that are
547 # built as part of kmscon.
550 if BUILD_ENABLE_KMSCON
551 bin_PROGRAMS += kmscon
557 MANPAGES += docs/man/kmscon.1
574 src/kmscon_module_interface.h \
575 src/kmscon_module.h \
576 src/kmscon_module.c \
577 src/kmscon_terminal.h \
585 nodist_kmscon_SOURCES =
601 if BUILD_ENABLE_SESSION_DUMMY
602 kmscon_SOURCES += src/kmscon_dummy.c
605 if BUILD_ENABLE_SESSION_TERMINAL
606 kmscon_SOURCES += src/kmscon_terminal.c
607 kmscon_LDADD += libtsm.la
610 if BUILD_ENABLE_SESSION_CDEV
611 kmscon_SOURCES += src/kmscon_cdev.c
612 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
613 kmscon_LDADD += $(FUSE_LIBS)
620 if BUILD_ENABLE_WLTERM
621 bin_PROGRAMS += wlterm
674 test_output_SOURCES = \
677 test_output_CPPFLAGS = $(test_cflags)
678 test_output_LDADD = \
685 test_vt_CPPFLAGS = $(test_cflags)
690 test_input_SOURCES = \
693 test_input_CPPFLAGS = $(test_cflags)
701 test_key_CPPFLAGS = $(test_cflags)
702 test_key_LDADD = $(test_libs)
709 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
710 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
712 if BUILD_HAVE_XSLTPROC
713 if BUILD_HAVE_MANPAGES_STYLESHEET
715 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
718 --stringparam man.authors.section.enabled 0 \
719 --stringparam man.copyright.section.enabled 0 \
720 --stringparam funcsynopsis.style ansi \
721 --stringparam man.output.quietly 1 \
724 XSLTPROC_PROCESS_MAN = \
725 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
726 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
729 # Force .man_fixup if $(MANPAGES) are not built
730 .man_fixup: | $(MANPAGES)
733 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
734 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
736 docs/man/%.1: docs/man/%.xml
737 $(XSLTPROC_PROCESS_MAN)
739 docs/man/%.3: docs/man/%.xml
740 $(XSLTPROC_PROCESS_MAN)
742 docs/man/%.5: docs/man/%.xml
743 $(XSLTPROC_PROCESS_MAN)
745 docs/man/%.7: docs/man/%.xml
746 $(XSLTPROC_PROCESS_MAN)
748 endif # BUILD_HAVE_MANPAGES_STYLESHEET
749 endif # BUILD_HAVE_XSLTPROC