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
40 docs/kmsconvt@.service \
41 docs/pc/libeloop.pc.in \
42 docs/pc/libtsm.pc.in \
43 docs/pc/libuterm.pc.in \
44 docs/sym/libeloop.sym \
48 pkgconfigdir = $(libdir)/pkgconfig
60 moduledir = $(libdir)/kmscon
65 # Make all files include "config.h" by default. This shouldn't cause any
66 # problems and we cannot forget to include it anymore.
68 # Also make the linker discard all unused symbols.
70 # When compiling in debug mode, we enable debug symbols so debugging with gdb
71 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
72 # Otherwise, we use standard optimizations -O2.
80 -fdiagnostics-show-option \
81 -fno-strict-aliasing \
87 -DBUILD_MODULE_DIR='"$(moduledir)"' \
88 -include $(top_builddir)/config.h \
100 if BUILD_ENABLE_OPTIMIZATIONS
108 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
109 # to the string returned by "git describe". We need to adjust this string for
110 # every build and correctly rebuild any sources that depend on it. Therefore,
111 # you should use this file rarely as it causes rebuilds on every git-commit.
113 # We have a helper-script ./src/genversion.sh that takes as argument the header
114 # file and creates it if necessary. It updates it only if the new git-describe
115 # string is different to the old one. So the file is only modified on changes.
116 # Hence, we can use it as normal dependency in this Makefile.
117 # However, we need to run this script on _every_ "make" invocation before any
118 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
119 # "simply expanded" variable (:=) so the shell command is executed on
120 # variable-declaration and not during expansion.
122 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
123 # tarball might delete that file and have no way to recreate it.
124 # We could delete it on something like "make maintainerclean", but then again,
125 # it seems unnecessary so lets simply not clean it at all.
127 # If the helper-script is executed in a directory that is not a git-repository
128 # (like a distribution tarball) and githead.h exists, then it does nothing as it
129 # expects githead.h to be correctly written by "make dist".
130 # However, if githead.h does not exist, it will print a warning and write
131 # "<unknown>" as git-revision.
132 # This guarantees, that githead.h is always present and has the most correct
133 # value that we can get under any conditions.
135 # The $(emptyvariable) expansion below is used for broken $(shell ...)
136 # syntax-highlighting algorithms in many existing editors.
139 EXTRA_DIST += src/genversion.sh
140 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
143 # SHL - Static Helper Library
144 # The SHL subsystem contains several small code pieces used all over kmscon and
145 # other applications.
148 noinst_LTLIBRARIES += libshl.la
150 libshl_la_SOURCES = \
153 src/shl_hashtable.h \
162 libshl_la_CPPFLAGS = \
164 $(XKBCOMMON_CFLAGS) \
166 libshl_la_LDFLAGS = \
175 # This library contains the whole event-loop implementation of kmscon. It is
176 # compiled into a separate object to allow using it in several other programs.
179 if BUILD_ENABLE_ELOOP
180 lib_LTLIBRARIES += libeloop.la
181 include_HEADERS += src/eloop.h
182 pkgconfig_DATA += docs/pc/libeloop.pc
185 libeloop_la_SOURCES = \
189 libeloop_la_LIBADD = libshl.la
190 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
191 EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
192 libeloop_la_LDFLAGS = \
194 -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
195 -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
198 if BUILD_ENABLE_ELOOP_DBUS
199 libeloop_la_SOURCES += \
200 external/dbus-common.h \
201 external/dbus-loop.h \
203 libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
204 libeloop_la_LIBADD += $(DBUS_LIBS)
209 # The Terminal-emulator State Machine is a library that implements the whole VTE
210 # layer and everything related to it. It has no external dependencies so it can
211 # be used to implement any kind of terminal emulator or debugger.
215 lib_LTLIBRARIES += libtsm.la
220 pkgconfig_DATA += docs/pc/libtsm.pc
223 libtsm_la_SOURCES = \
230 src/tsm_vte_charsets.c \
234 libtsm_la_CPPFLAGS = \
240 EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
241 libtsm_la_LDFLAGS = \
243 -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
244 -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
248 # The uterm library provides helpers to create terminals in user-space. They
249 # are not limited to text-based terminals but rather provide graphics contexts
250 # so arbitrary output can be displayed. Additionally, they provide VT
251 # abstractions and an input layer
254 if BUILD_ENABLE_UTERM
255 lib_LTLIBRARIES += libuterm.la
258 src/uterm_monitor.h \
261 pkgconfig_DATA += docs/pc/libuterm.pc
264 libuterm_la_SOURCES = \
266 src/uterm_monitor.h \
269 src/uterm_input_internal.h \
270 src/uterm_video_internal.h \
271 src/uterm_systemd_internal.h \
273 src/uterm_monitor.c \
276 src/uterm_input_uxkb.c
278 nodist_libuterm_la_SOURCES =
280 libuterm_la_CPPFLAGS = \
283 libuterm_la_LIBADD = \
287 EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
288 libuterm_la_LDFLAGS = \
290 -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
291 -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
293 if BUILD_ENABLE_MULTI_SEAT
294 libuterm_la_SOURCES += src/uterm_systemd.c
295 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
296 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
299 if BUILD_ENABLE_HOTPLUG
300 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
301 libuterm_la_LIBADD += $(UDEV_LIBS)
304 if BUILD_ENABLE_VIDEO_FBDEV
305 libuterm_la_SOURCES += \
306 src/uterm_fbdev_internal.h \
307 src/uterm_fbdev_video.c \
308 src/uterm_fbdev_render.c
311 if BUILD_ENABLE_VIDEO_DRM2D
312 libuterm_la_SOURCES += \
313 src/uterm_drm2d_internal.h \
314 src/uterm_drm2d_video.c \
315 src/uterm_drm2d_render.c
316 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
317 libuterm_la_LIBADD += $(DRM_LIBS)
320 if BUILD_ENABLE_VIDEO_DRM3D
321 noinst_PROGRAMS += genshader
322 libuterm_la_SOURCES += \
323 src/uterm_drm3d_internal.h \
324 src/uterm_drm3d_video.c \
325 src/uterm_drm3d_render.c \
327 src/static_gl_math.c \
328 src/static_gl_shader.c
329 nodist_libuterm_la_SOURCES += src/static_shaders.c
330 libuterm_la_CPPFLAGS += \
335 libuterm_la_LIBADD += \
342 # add shared sources only once
343 UTERM_DRM_SHARED_SRC = \
344 src/uterm_drm_shared_internal.h \
345 src/uterm_drm_shared.c
346 if BUILD_ENABLE_VIDEO_DRM2D
347 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
349 if BUILD_ENABLE_VIDEO_DRM3D
350 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
356 # As there is no need to modify shaders at run-time, we statically compile them
357 # into object files. As autotools would ignore them, we need to add them to
359 # The program that converts the shaders into C-source files is "genshader". It's
360 # pretty simple and just creates a string with the shader source as content.
364 $(srcdir)/src/static_fill.vert \
365 $(srcdir)/src/static_fill.frag \
366 $(srcdir)/src/static_blend.vert \
367 $(srcdir)/src/static_blend.frag \
368 $(srcdir)/src/static_blit.vert \
369 $(srcdir)/src/static_blit.frag \
370 $(srcdir)/src/static_gltex.vert \
371 $(srcdir)/src/static_gltex.frag
373 EXTRA_DIST += $(SHADERS)
374 CLEANFILES += src/static_shaders.c
375 genshader_SOURCES = src/genshader.c
377 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
378 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
382 # This generates the unifont sources from raw hex-encoded font data.
385 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
386 UNIFONT_BIN = src/font_unifont_data.bin
388 EXTRA_DIST += $(UNIFONT)
389 CLEANFILES += $(UNIFONT_BIN)
390 genunifont_SOURCES = src/genunifont.c
392 $(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
393 $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
399 if BUILD_ENABLE_FONT_UNIFONT
400 module_LTLIBRARIES += mod-unifont.la
401 noinst_PROGRAMS += genunifont
404 mod_unifont_la_SOURCES = \
405 src/kmscon_module_interface.h \
408 src/kmscon_mod_unifont.c
409 EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
410 mod_unifont_la_LIBADD = libshl.la
411 mod_unifont_la_LDFLAGS = \
415 -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
417 if BUILD_ENABLE_FONT_FREETYPE2
418 module_LTLIBRARIES += mod-freetype2.la
421 mod_freetype2_la_SOURCES = \
422 src/kmscon_module_interface.h \
424 src/font_freetype2.c \
425 src/kmscon_mod_freetype2.c
426 mod_freetype2_la_CPPFLAGS = \
429 mod_freetype2_la_LIBADD = \
434 mod_freetype2_la_LDFLAGS = \
439 if BUILD_ENABLE_FONT_PANGO
440 module_LTLIBRARIES += mod-pango.la
443 mod_pango_la_SOURCES = \
444 src/kmscon_module_interface.h \
447 src/kmscon_mod_pango.c
448 mod_pango_la_CPPFLAGS = \
451 mod_pango_la_LIBADD = \
456 mod_pango_la_LDFLAGS = \
461 if BUILD_ENABLE_RENDERER_BBULK
462 module_LTLIBRARIES += mod-bbulk.la
465 mod_bbulk_la_SOURCES = \
466 src/kmscon_module_interface.h \
469 src/kmscon_mod_bbulk.c
470 mod_bbulk_la_LIBADD = libshl.la
471 mod_bbulk_la_LDFLAGS = \
476 if BUILD_ENABLE_RENDERER_GLTEX
477 module_LTLIBRARIES += mod-gltex.la
478 noinst_PROGRAMS += genshader
481 mod_gltex_la_SOURCES = \
482 src/kmscon_module_interface.h \
486 src/static_gl_math.c \
487 src/static_gl_shader.c \
488 src/kmscon_mod_gltex.c
489 nodist_mod_gltex_la_SOURCES = \
491 mod_gltex_la_CPPFLAGS = \
494 mod_gltex_la_LIBADD = \
497 mod_gltex_la_LDFLAGS = \
502 if BUILD_ENABLE_RENDERER_CAIRO
503 module_LTLIBRARIES += mod-cairo.la
506 mod_cairo_la_SOURCES = \
507 src/kmscon_module_interface.h \
510 src/kmscon_mod_cairo.c
511 mod_cairo_la_CPPFLAGS = \
514 mod_cairo_la_LIBADD = \
517 mod_cairo_la_LDFLAGS = \
522 if BUILD_ENABLE_RENDERER_PIXMAN
523 module_LTLIBRARIES += mod-pixman.la
526 mod_pixman_la_SOURCES = \
527 src/kmscon_module_interface.h \
530 src/kmscon_mod_pixman.c
531 mod_pixman_la_CPPFLAGS = \
534 mod_pixman_la_LIBADD = \
537 mod_pixman_la_LDFLAGS = \
544 # These are the sources for the main binaries and test programs. They mostly
545 # consists of a single source file only and include all the libraries that are
546 # built as part of kmscon.
549 if BUILD_ENABLE_KMSCON
550 bin_PROGRAMS += kmscon
556 MANPAGES += docs/man/kmscon.1
573 src/kmscon_module_interface.h \
574 src/kmscon_module.h \
575 src/kmscon_module.c \
576 src/kmscon_terminal.h \
584 nodist_kmscon_SOURCES =
600 if BUILD_ENABLE_SESSION_DUMMY
601 kmscon_SOURCES += src/kmscon_dummy.c
604 if BUILD_ENABLE_SESSION_TERMINAL
605 kmscon_SOURCES += src/kmscon_terminal.c
606 kmscon_LDADD += libtsm.la
609 if BUILD_ENABLE_SESSION_CDEV
610 kmscon_SOURCES += src/kmscon_cdev.c
611 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
612 kmscon_LDADD += $(FUSE_LIBS)
619 if BUILD_ENABLE_WLTERM
620 bin_PROGRAMS += wlterm
673 test_output_SOURCES = \
676 test_output_CPPFLAGS = $(test_cflags)
677 test_output_LDADD = \
684 test_vt_CPPFLAGS = $(test_cflags)
689 test_input_SOURCES = \
692 test_input_CPPFLAGS = $(test_cflags)
700 test_key_CPPFLAGS = $(test_cflags)
701 test_key_LDADD = $(test_libs)
708 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
709 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
711 if BUILD_HAVE_XSLTPROC
712 if BUILD_HAVE_MANPAGES_STYLESHEET
714 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
717 --stringparam man.authors.section.enabled 0 \
718 --stringparam man.copyright.section.enabled 0 \
719 --stringparam funcsynopsis.style ansi \
720 --stringparam man.output.quietly 1 \
723 XSLTPROC_PROCESS_MAN = \
724 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
725 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
728 # Force .man_fixup if $(MANPAGES) are not built
729 .man_fixup: | $(MANPAGES)
732 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
733 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
735 docs/man/%.1: docs/man/%.xml
736 $(XSLTPROC_PROCESS_MAN)
738 docs/man/%.3: docs/man/%.xml
739 $(XSLTPROC_PROCESS_MAN)
741 docs/man/%.5: docs/man/%.xml
742 $(XSLTPROC_PROCESS_MAN)
744 docs/man/%.7: docs/man/%.xml
745 $(XSLTPROC_PROCESS_MAN)
747 endif # BUILD_HAVE_MANPAGES_STYLESHEET
748 endif # BUILD_HAVE_XSLTPROC