2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
6 ACLOCAL_AMFLAGS = -I m4
15 docs/kmsconvt@.service \
18 pkgconfigdir = $(libdir)/pkgconfig
32 moduledir = @libdir@/kmscon
37 # Make all files include "config.h" by default. This shouldn't cause any
38 # problems and we cannot forget to include it anymore.
40 # Also make the linker discard all unused symbols.
42 # When compiling in debug mode, we enable debug symbols so debugging with gdb
43 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
44 # Otherwise, we use standard optimizations -O2.
50 -DBUILD_MODULE_DIR='"$(moduledir)"' \
51 -include $(top_builddir)/config.h \
60 if BUILD_ENABLE_OPTIMIZATIONS
67 # SHL - Static Helper Library
68 # The SHL subsystem contains several small code pieces used all over kmscon and
71 # Simply include $(SHL_*) in your source-file list.
72 # SHL_MISC needs xkbcommon
73 # SHL_REGISTER needs pthread
101 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
102 # to the string returned by "git describe". We need to adjust this string for
103 # every build and correctly rebuild any sources that depend on it. Therefore,
104 # you should use this file rarely as it causes rebuilds on every git-commit.
106 # We have a helper-script ./src/genversion.sh that takes as argument the header
107 # file and creates it if necessary. It updates it only if the new git-describe
108 # string is different to the old one. So the file is only modified on changes.
109 # Hence, we can use it as normal dependency in this Makefile.
110 # However, we need to run this script on _every_ "make" invocation before any
111 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
112 # "simply expanded" variable (:=) so the shell command is executed on
113 # variable-declaration and not during expansion.
115 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
116 # tarball might delete that file and have no way to recreate it.
117 # We could delete it on something like "make maintainerclean", but then again,
118 # it seems unnecessary so lets simply not clean it at all.
120 # If the helper-script is executed in a directory that is not a git-repository
121 # (like a distribution tarball) and githead.h exists, then it does nothing as it
122 # expects githead.h to be correctly written by "make dist".
123 # However, if githead.h does not exist, it will print a warning and write
124 # "<unknown>" as git-revision.
125 # This guarantees, that githead.h is always present and has the most correct
126 # value that we can get under any conditions.
128 # The $(emptyvariable) expansion below is used for broken $(shell ...)
129 # syntax-highlighting algorithms in many existing editors.
132 EXTRA_DIST += src/genversion.sh
133 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
137 # This library contains the whole event-loop implementation of kmscon. It is
138 # compiled into a separate object to allow using it in several other programs.
141 if BUILD_ENABLE_ELOOP
142 lib_LTLIBRARIES += libeloop.la
143 include_HEADERS += src/eloop.h
144 pkgconfig_DATA += docs/pc/libeloop.pc
147 libeloop_la_SOURCES = \
154 libeloop_la_CPPFLAGS = \
157 libeloop_la_LDFLAGS = \
161 if BUILD_ENABLE_ELOOP_DBUS
162 libeloop_la_SOURCES += \
163 external/dbus-common.h \
164 external/dbus-loop.h \
166 libeloop_la_CPPFLAGS += \
168 libeloop_la_LIBADD += \
174 # The Terminal-emulator State Machine is a library that implements the whole VTE
175 # layer and everything related to it. It has no external dependencies so it can
176 # be used to implement any kind of terminal emulator or debugger.
190 libtsm_la_SOURCES = \
201 src/tsm_vte_charsets.c \
205 libtsm_la_CPPFLAGS = \
208 libtsm_la_LDFLAGS = \
214 # The uterm library provides helpers to create terminals in user-space. They
215 # are not limited to text-based terminals but rather provide graphics contexts
216 # so arbitrary output can be displayed. Additionally, they provide VT
217 # abstractions and an input layer
220 if BUILD_ENABLE_UTERM
221 lib_LTLIBRARIES += libuterm.la
222 include_HEADERS += src/uterm.h
223 pkgconfig_DATA += docs/pc/libuterm.pc
226 libuterm_la_SOURCES = \
234 src/uterm_systemd.h \
236 src/uterm_monitor.c \
239 src/uterm_input_uxkb.c
241 nodist_libuterm_la_SOURCES =
243 libuterm_la_CPPFLAGS = \
246 libuterm_la_LIBADD = \
249 libuterm_la_LDFLAGS = \
252 if BUILD_ENABLE_MULTI_SEAT
253 libuterm_la_SOURCES += src/uterm_systemd.c
254 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
255 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
258 if BUILD_ENABLE_HOTPLUG
259 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
260 libuterm_la_LIBADD += $(UDEV_LIBS)
263 if BUILD_ENABLE_PCIACCESS
264 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
265 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
266 libuterm_la_SOURCES += src/uterm_pci.c
269 if BUILD_ENABLE_VIDEO_FBDEV
270 libuterm_la_SOURCES += src/uterm_video_fbdev.c
273 if BUILD_ENABLE_VIDEO_DUMB
274 libuterm_la_SOURCES += src/uterm_video_dumb.c
275 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
276 libuterm_la_LIBADD += $(DRM_LIBS)
279 if BUILD_ENABLE_VIDEO_DRM
280 libuterm_la_SOURCES += \
281 src/uterm_video_drm.c \
283 src/static_gl_math.c \
284 src/static_gl_shader.c
285 nodist_libuterm_la_SOURCES += \
287 libuterm_la_CPPFLAGS += \
292 libuterm_la_LIBADD += \
301 # As there is no need to modify shaders at run-time, we statically compile them
302 # into object files. As autotools would ignore them, we need to add them to
304 # The program that converts the shaders into C-source files is "genshader". It's
305 # pretty simple and just creates a string with the shader source as content.
309 $(srcdir)/src/static_fill.vert \
310 $(srcdir)/src/static_fill.frag \
311 $(srcdir)/src/static_blend.vert \
312 $(srcdir)/src/static_blend.frag \
313 $(srcdir)/src/static_blit.vert \
314 $(srcdir)/src/static_blit.frag \
315 $(srcdir)/src/static_gltex.vert \
316 $(srcdir)/src/static_gltex.frag
318 EXTRA_DIST += $(SHADERS)
319 CLEANFILES += src/static_shaders.c
320 genshader_SOURCES = src/genshader.c
322 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
323 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
327 # This generates the unifont sources from raw hex-encoded font data.
330 UNIFONT = src/font_unifont_data.hex
332 EXTRA_DIST += $(UNIFONT)
333 CLEANFILES += src/font_unifont_data.c
334 genunifont_SOURCES = src/genunifont.c
336 src/font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
337 $(AM_V_GEN)./genunifont$(EXEEXT) src/font_unifont_data.c $(UNIFONT)
341 # The font library is used by kmscon _and_ wlterm but is currently linked
342 # statically as it hasn't been cleaned up entirely.
343 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
346 if BUILD_ENABLE_KMSCON
347 noinst_LTLIBRARIES += libfont.la
350 libfont_la_SOURCES = \
355 libfont_la_LIBADD = \
357 libfont_la_LDFLAGS = \
364 if BUILD_ENABLE_FONT_UNIFONT
365 module_LTLIBRARIES += mod-unifont.la
368 mod_unifont_la_SOURCES = \
369 src/kmscon_module_interface.h \
372 src/kmscon_mod_unifont.c
373 nodist_mod_unifont_la_SOURCES = \
374 src/font_unifont_data.c
375 mod_unifont_la_LDFLAGS = \
379 if BUILD_ENABLE_FONT_FREETYPE2
380 module_LTLIBRARIES += mod-freetype2.la
383 mod_freetype2_la_SOURCES = \
386 src/kmscon_module_interface.h \
388 src/font_freetype2.c \
389 src/kmscon_mod_freetype2.c
390 mod_freetype2_la_CPPFLAGS = \
393 mod_freetype2_la_LIBADD = \
397 mod_freetype2_la_LDFLAGS = \
401 if BUILD_ENABLE_FONT_PANGO
402 module_LTLIBRARIES += mod-pango.la
405 mod_pango_la_SOURCES = \
408 src/kmscon_module_interface.h \
411 src/kmscon_mod_pango.c
412 mod_pango_la_CPPFLAGS = \
415 mod_pango_la_LIBADD = \
419 mod_pango_la_LDFLAGS = \
425 # These are the sources for the main binaries and test programs. They mostly
426 # consists of a single source file only and include all the libraries that are
427 # built as part of kmscon.
430 if BUILD_ENABLE_KMSCON
431 bin_PROGRAMS += kmscon
437 MANPAGES += docs/man/kmscon.1
458 src/kmscon_module_interface.h \
459 src/kmscon_module.h \
460 src/kmscon_module.c \
461 src/kmscon_terminal.h \
469 nodist_kmscon_SOURCES =
483 if BUILD_ENABLE_SESSION_DUMMY
484 kmscon_SOURCES += src/kmscon_dummy.c
487 if BUILD_ENABLE_SESSION_TERMINAL
488 kmscon_SOURCES += src/kmscon_terminal.c
489 kmscon_LDADD += libtsm.la
492 if BUILD_ENABLE_SESSION_CDEV
493 kmscon_SOURCES += src/kmscon_cdev.c
494 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
495 kmscon_LDADD += $(FUSE_LIBS)
498 if BUILD_ENABLE_RENDERER_BBLIT
499 kmscon_SOURCES += src/text_bblit.c
502 if BUILD_ENABLE_RENDERER_BBULK
503 kmscon_SOURCES += src/text_bbulk.c
506 if BUILD_ENABLE_RENDERER_GLTEX
510 src/static_gl_math.c \
511 src/static_gl_shader.c
512 nodist_kmscon_SOURCES += src/static_shaders.c
513 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
514 kmscon_LDADD += $(GLES2_LIBS)
521 if BUILD_ENABLE_WLTERM
522 bin_PROGRAMS += wlterm
571 test_output_SOURCES = \
574 test_output_CPPFLAGS = \
577 test_output_LDADD = \
591 test_input_SOURCES = \
594 test_input_CPPFLAGS = \
604 test_key_CPPFLAGS = \
615 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
616 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
618 if BUILD_HAVE_XSLTPROC
619 if BUILD_HAVE_MANPAGES_STYLESHEET
621 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
624 --stringparam man.authors.section.enabled 0 \
625 --stringparam man.copyright.section.enabled 0 \
626 --stringparam funcsynopsis.style ansi \
627 --stringparam man.output.quietly 1 \
630 XSLTPROC_PROCESS_MAN = \
631 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
632 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
635 # Force .man_fixup if $(MANPAGES) are not built
636 .man_fixup: | $(MANPAGES)
639 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
640 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
642 docs/man/%.1: docs/man/%.xml
643 $(XSLTPROC_PROCESS_MAN)
645 docs/man/%.3: docs/man/%.xml
646 $(XSLTPROC_PROCESS_MAN)
648 docs/man/%.5: docs/man/%.xml
649 $(XSLTPROC_PROCESS_MAN)
651 docs/man/%.7: docs/man/%.xml
652 $(XSLTPROC_PROCESS_MAN)
654 endif # BUILD_HAVE_MANPAGES_STYLESHEET
655 endif # BUILD_HAVE_XSLTPROC