2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
6 ACLOCAL_AMFLAGS = -I m4
15 docs/kmsconvt@.service
17 pkgconfigdir = $(libdir)/pkgconfig
31 moduledir = @libdir@/kmscon
36 # Make all files include "config.h" by default. This shouldn't cause any
37 # problems and we cannot forget to include it anymore.
39 # Also make the linker discard all unused symbols.
41 # When compiling in debug mode, we enable debug symbols so debugging with gdb
42 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
43 # Otherwise, we use standard optimizations -O2.
49 -DBUILD_MODULE_DIR='"$(moduledir)"' \
50 -include $(top_builddir)/config.h \
59 if BUILD_ENABLE_OPTIMIZATIONS
66 # SHL - Static Helper Library
67 # The SHL subsystem contains several small code pieces used all over kmscon and
70 # Simply include $(SHL_*) in your source-file list.
71 # SHL_MISC needs xkbcommon
72 # SHL_REGISTER needs pthread
100 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
101 # to the string returned by "git describe". We need to adjust this string for
102 # every build and correctly rebuild any sources that depend on it. Therefore,
103 # you should use this file rarely as it causes rebuilds on every git-commit.
105 # We have a helper-script ./src/genversion.sh that takes as argument the header
106 # file and creates it if necessary. It updates it only if the new git-describe
107 # string is different to the old one. So the file is only modified on changes.
108 # Hence, we can use it as normal dependency in this Makefile.
109 # However, we need to run this script on _every_ "make" invocation before any
110 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
111 # "simply expanded" variable (:=) so the shell command is executed on
112 # variable-declaration and not during expansion.
114 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
115 # tarball might delete that file and have no way to recreate it.
116 # We could delete it on something like "make maintainerclean", but then again,
117 # it seems unnecessary so lets simply not clean it at all.
119 # If the helper-script is executed in a directory that is not a git-repository
120 # (like a distribution tarball) and githead.h exists, then it does nothing as it
121 # expects githead.h to be correctly written by "make dist".
122 # However, if githead.h does not exist, it will print a warning and write
123 # "<unknown>" as git-revision.
124 # This guarantees, that githead.h is always present and has the most correct
125 # value that we can get under any conditions.
127 # The $(emptyvariable) expansion below is used for broken $(shell ...)
128 # syntax-highlighting algorithms in many existing editors.
131 EXTRA_DIST += src/genversion.sh
132 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
136 # This library contains the whole event-loop implementation of kmscon. It is
137 # compiled into a separate object to allow using it in several other programs.
140 if BUILD_ENABLE_ELOOP
141 lib_LTLIBRARIES += libeloop.la
142 include_HEADERS += src/eloop.h
143 pkgconfig_DATA += docs/pc/libeloop.pc
146 libeloop_la_SOURCES = \
153 libeloop_la_CPPFLAGS = \
156 libeloop_la_LDFLAGS = \
160 if BUILD_ENABLE_ELOOP_DBUS
161 libeloop_la_SOURCES += \
162 external/dbus-common.h \
163 external/dbus-loop.h \
165 libeloop_la_CPPFLAGS += \
167 libeloop_la_LIBADD += \
173 # The Terminal-emulator State Machine is a library that implements the whole VTE
174 # layer and everything related to it. It has no external dependencies so it can
175 # be used to implement any kind of terminal emulator or debugger.
189 libtsm_la_SOURCES = \
200 src/tsm_vte_charsets.c \
204 libtsm_la_CPPFLAGS = \
207 libtsm_la_LDFLAGS = \
213 # The uterm library provides helpers to create terminals in user-space. They
214 # are not limited to text-based terminals but rather provide graphics contexts
215 # so arbitrary output can be displayed. Additionally, they provide VT
216 # abstractions and an input layer
219 if BUILD_ENABLE_UTERM
220 lib_LTLIBRARIES += libuterm.la
223 src/uterm_monitor.h \
226 pkgconfig_DATA += docs/pc/libuterm.pc
229 libuterm_la_SOURCES = \
235 src/uterm_monitor.h \
238 src/uterm_input_internal.h \
239 src/uterm_video_internal.h \
240 src/uterm_systemd_internal.h \
242 src/uterm_monitor.c \
245 src/uterm_input_uxkb.c
247 nodist_libuterm_la_SOURCES =
249 libuterm_la_CPPFLAGS = \
252 libuterm_la_LIBADD = \
255 libuterm_la_LDFLAGS = \
258 if BUILD_ENABLE_MULTI_SEAT
259 libuterm_la_SOURCES += src/uterm_systemd.c
260 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
261 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
264 if BUILD_ENABLE_HOTPLUG
265 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
266 libuterm_la_LIBADD += $(UDEV_LIBS)
269 if BUILD_ENABLE_VIDEO_FBDEV
270 libuterm_la_SOURCES += \
271 src/uterm_fbdev_internal.h \
272 src/uterm_fbdev_video.c \
273 src/uterm_fbdev_render.c
276 if BUILD_ENABLE_VIDEO_DRM2D
277 libuterm_la_SOURCES += \
278 src/uterm_drm2d_internal.h \
279 src/uterm_drm2d_video.c \
280 src/uterm_drm2d_render.c
281 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
282 libuterm_la_LIBADD += $(DRM_LIBS)
285 if BUILD_ENABLE_VIDEO_DRM3D
286 libuterm_la_SOURCES += \
287 src/uterm_drm3d_internal.h \
288 src/uterm_drm3d_video.c \
289 src/uterm_drm3d_render.c \
291 src/static_gl_math.c \
292 src/static_gl_shader.c
293 nodist_libuterm_la_SOURCES += \
295 libuterm_la_CPPFLAGS += \
300 libuterm_la_LIBADD += \
307 # add shared sources only once
308 UTERM_DRM_SHARED_SRC = \
309 src/uterm_drm_shared_internal.h \
310 src/uterm_drm_shared.c
311 if BUILD_ENABLE_VIDEO_DRM2D
312 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
314 if BUILD_ENABLE_VIDEO_DRM3D
315 libuterm_la_SOURCES += $(UTERM_DRM_SHARED_SRC)
321 # As there is no need to modify shaders at run-time, we statically compile them
322 # into object files. As autotools would ignore them, we need to add them to
324 # The program that converts the shaders into C-source files is "genshader". It's
325 # pretty simple and just creates a string with the shader source as content.
329 $(srcdir)/src/static_fill.vert \
330 $(srcdir)/src/static_fill.frag \
331 $(srcdir)/src/static_blend.vert \
332 $(srcdir)/src/static_blend.frag \
333 $(srcdir)/src/static_blit.vert \
334 $(srcdir)/src/static_blit.frag \
335 $(srcdir)/src/static_gltex.vert \
336 $(srcdir)/src/static_gltex.frag
338 EXTRA_DIST += $(SHADERS)
339 CLEANFILES += src/static_shaders.c
340 genshader_SOURCES = src/genshader.c
342 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
343 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
347 # This generates the unifont sources from raw hex-encoded font data.
350 UNIFONT = src/font_unifont_data.hex
352 EXTRA_DIST += $(UNIFONT)
353 CLEANFILES += src/font_unifont_data.c
354 genunifont_SOURCES = src/genunifont.c
356 src/font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
357 $(AM_V_GEN)./genunifont$(EXEEXT) src/font_unifont_data.c $(UNIFONT)
363 if BUILD_ENABLE_FONT_UNIFONT
364 module_LTLIBRARIES += mod-unifont.la
367 mod_unifont_la_SOURCES = \
368 src/kmscon_module_interface.h \
371 src/kmscon_mod_unifont.c
372 nodist_mod_unifont_la_SOURCES = \
373 src/font_unifont_data.c
374 mod_unifont_la_LDFLAGS = \
378 if BUILD_ENABLE_FONT_FREETYPE2
379 module_LTLIBRARIES += mod-freetype2.la
382 mod_freetype2_la_SOURCES = \
385 src/kmscon_module_interface.h \
387 src/font_freetype2.c \
388 src/kmscon_mod_freetype2.c
389 mod_freetype2_la_CPPFLAGS = \
392 mod_freetype2_la_LIBADD = \
396 mod_freetype2_la_LDFLAGS = \
400 if BUILD_ENABLE_FONT_PANGO
401 module_LTLIBRARIES += mod-pango.la
404 mod_pango_la_SOURCES = \
407 src/kmscon_module_interface.h \
410 src/kmscon_mod_pango.c
411 mod_pango_la_CPPFLAGS = \
414 mod_pango_la_LIBADD = \
418 mod_pango_la_LDFLAGS = \
422 if BUILD_ENABLE_RENDERER_BBULK
423 module_LTLIBRARIES += mod-bbulk.la
426 mod_bbulk_la_SOURCES = \
427 src/kmscon_module_interface.h \
430 src/kmscon_mod_bbulk.c
431 mod_bbulk_la_LDFLAGS = \
435 if BUILD_ENABLE_RENDERER_GLTEX
436 module_LTLIBRARIES += mod-gltex.la
439 mod_gltex_la_SOURCES = \
440 src/kmscon_module_interface.h \
444 src/static_gl_math.c \
445 src/static_gl_shader.c \
446 src/kmscon_mod_gltex.c
447 nodist_mod_gltex_la_SOURCES = \
449 mod_gltex_la_CPPFLAGS = \
452 mod_gltex_la_LIBADD = \
454 mod_gltex_la_LDFLAGS = \
458 if BUILD_ENABLE_RENDERER_CAIRO
459 module_LTLIBRARIES += mod-cairo.la
462 mod_cairo_la_SOURCES = \
463 src/kmscon_module_interface.h \
466 src/kmscon_mod_cairo.c
467 mod_cairo_la_CPPFLAGS = \
470 mod_cairo_la_LIBADD = \
472 mod_cairo_la_LDFLAGS = \
476 if BUILD_ENABLE_RENDERER_PIXMAN
477 module_LTLIBRARIES += mod-pixman.la
480 mod_pixman_la_SOURCES = \
481 src/kmscon_module_interface.h \
484 src/kmscon_mod_pixman.c
485 mod_pixman_la_CPPFLAGS = \
488 mod_pixman_la_LIBADD = \
490 mod_pixman_la_LDFLAGS = \
496 # These are the sources for the main binaries and test programs. They mostly
497 # consists of a single source file only and include all the libraries that are
498 # built as part of kmscon.
501 if BUILD_ENABLE_KMSCON
502 bin_PROGRAMS += kmscon
508 MANPAGES += docs/man/kmscon.1
533 src/kmscon_module_interface.h \
534 src/kmscon_module.h \
535 src/kmscon_module.c \
536 src/kmscon_terminal.h \
544 nodist_kmscon_SOURCES =
558 if BUILD_ENABLE_SESSION_DUMMY
559 kmscon_SOURCES += src/kmscon_dummy.c
562 if BUILD_ENABLE_SESSION_TERMINAL
563 kmscon_SOURCES += src/kmscon_terminal.c
564 kmscon_LDADD += libtsm.la
567 if BUILD_ENABLE_SESSION_CDEV
568 kmscon_SOURCES += src/kmscon_cdev.c
569 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
570 kmscon_LDADD += $(FUSE_LIBS)
577 if BUILD_ENABLE_WLTERM
578 bin_PROGRAMS += wlterm
627 test_output_SOURCES = \
630 test_output_CPPFLAGS = \
633 test_output_LDADD = \
647 test_input_SOURCES = \
650 test_input_CPPFLAGS = \
660 test_key_CPPFLAGS = \
671 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
672 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
674 if BUILD_HAVE_XSLTPROC
675 if BUILD_HAVE_MANPAGES_STYLESHEET
677 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
680 --stringparam man.authors.section.enabled 0 \
681 --stringparam man.copyright.section.enabled 0 \
682 --stringparam funcsynopsis.style ansi \
683 --stringparam man.output.quietly 1 \
686 XSLTPROC_PROCESS_MAN = \
687 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
688 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
691 # Force .man_fixup if $(MANPAGES) are not built
692 .man_fixup: | $(MANPAGES)
695 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
696 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
698 docs/man/%.1: docs/man/%.xml
699 $(XSLTPROC_PROCESS_MAN)
701 docs/man/%.3: docs/man/%.xml
702 $(XSLTPROC_PROCESS_MAN)
704 docs/man/%.5: docs/man/%.xml
705 $(XSLTPROC_PROCESS_MAN)
707 docs/man/%.7: docs/man/%.xml
708 $(XSLTPROC_PROCESS_MAN)
710 endif # BUILD_HAVE_MANPAGES_STYLESHEET
711 endif # BUILD_HAVE_XSLTPROC