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
34 # Make all files include "config.h" by default. This shouldn't cause any
35 # problems and we cannot forget to include it anymore.
37 # Also make the linker discard all unused symbols.
39 # When compiling in debug mode, we enable debug symbols so debugging with gdb
40 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
41 # Otherwise, we use standard optimizations -O2.
47 -include $(top_builddir)/config.h \
56 if BUILD_ENABLE_OPTIMIZATIONS
63 # SHL - Static Helper Library
64 # The SHL subsystem contains several small code pieces used all over kmscon and
67 # Simply include $(SHL_*) in your source-file list.
68 # SHL_MISC needs xkbcommon
69 # SHL_REGISTER needs pthread
97 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
98 # to the string returned by "git describe". We need to adjust this string for
99 # every build and correctly rebuild any sources that depend on it. Therefore,
100 # you should use this file rarely as it causes rebuilds on every git-commit.
102 # We have a helper-script ./src/genversion.sh that takes as argument the header
103 # file and creates it if necessary. It updates it only if the new git-describe
104 # string is different to the old one. So the file is only modified on changes.
105 # Hence, we can use it as normal dependency in this Makefile.
106 # However, we need to run this script on _every_ "make" invocation before any
107 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
108 # "simply expanded" variable (:=) so the shell command is executed on
109 # variable-declaration and not during expansion.
111 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
112 # tarball might delete that file and have no way to recreate it.
113 # We could delete it on something like "make maintainerclean", but then again,
114 # it seems unnecessary so lets simply not clean it at all.
116 # If the helper-script is executed in a directory that is not a git-repository
117 # (like a distribution tarball) and githead.h exists, then it does nothing as it
118 # expects githead.h to be correctly written by "make dist".
119 # However, if githead.h does not exist, it will print a warning and write
120 # "<unknown>" as git-revision.
121 # This guarantees, that githead.h is always present and has the most correct
122 # value that we can get under any conditions.
124 # The $(emptyvariable) expansion below is used for broken $(shell ...)
125 # syntax-highlighting algorithms in many existing editors.
128 EXTRA_DIST += src/genversion.sh
129 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
133 # This library contains the whole event-loop implementation of kmscon. It is
134 # compiled into a separate object to allow using it in several other programs.
137 if BUILD_ENABLE_ELOOP
138 lib_LTLIBRARIES += libeloop.la
139 include_HEADERS += src/eloop.h
140 pkgconfig_DATA += docs/pc/libeloop.pc
143 libeloop_la_SOURCES = \
150 libeloop_la_CPPFLAGS = \
153 libeloop_la_LDFLAGS = \
157 if BUILD_ENABLE_ELOOP_DBUS
158 libeloop_la_SOURCES += \
159 external/dbus-common.h \
160 external/dbus-loop.h \
162 libeloop_la_CPPFLAGS += \
164 libeloop_la_LIBADD += \
170 # The Terminal-emulator State Machine is a library that implements the whole VTE
171 # layer and everything related to it. It has no external dependencies so it can
172 # be used to implement any kind of terminal emulator or debugger.
186 libtsm_la_SOURCES = \
197 src/tsm_vte_charsets.c \
201 libtsm_la_CPPFLAGS = \
204 libtsm_la_LDFLAGS = \
210 # The uterm library provides helpers to create terminals in user-space. They
211 # are not limited to text-based terminals but rather provide graphics contexts
212 # so arbitrary output can be displayed. Additionally, they provide VT
213 # abstractions and an input layer
216 if BUILD_ENABLE_UTERM
217 lib_LTLIBRARIES += libuterm.la
218 include_HEADERS += src/uterm.h
219 pkgconfig_DATA += docs/pc/libuterm.pc
222 libuterm_la_SOURCES = \
230 src/uterm_systemd.h \
232 src/uterm_monitor.c \
235 src/uterm_input_uxkb.c
237 nodist_libuterm_la_SOURCES =
239 libuterm_la_CPPFLAGS = \
242 libuterm_la_LIBADD = \
245 libuterm_la_LDFLAGS = \
248 if BUILD_ENABLE_MULTI_SEAT
249 libuterm_la_SOURCES += src/uterm_systemd.c
250 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
251 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
254 if BUILD_ENABLE_HOTPLUG
255 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
256 libuterm_la_LIBADD += $(UDEV_LIBS)
259 if BUILD_ENABLE_PCIACCESS
260 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
261 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
262 libuterm_la_SOURCES += src/uterm_pci.c
265 if BUILD_ENABLE_VIDEO_FBDEV
266 libuterm_la_SOURCES += src/uterm_video_fbdev.c
269 if BUILD_ENABLE_VIDEO_DUMB
270 libuterm_la_SOURCES += src/uterm_video_dumb.c
271 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
272 libuterm_la_LIBADD += $(DRM_LIBS)
275 if BUILD_ENABLE_VIDEO_DRM
276 libuterm_la_SOURCES += \
277 src/uterm_video_drm.c \
279 src/static_gl_math.c \
280 src/static_gl_shader.c
281 nodist_libuterm_la_SOURCES += \
283 libuterm_la_CPPFLAGS += \
288 libuterm_la_LIBADD += \
297 # As there is no need to modify shaders at run-time, we statically compile them
298 # into object files. As autotools would ignore them, we need to add them to
300 # The program that converts the shaders into C-source files is "genshader". It's
301 # pretty simple and just creates a string with the shader source as content.
305 $(srcdir)/src/static_fill.vert \
306 $(srcdir)/src/static_fill.frag \
307 $(srcdir)/src/static_blend.vert \
308 $(srcdir)/src/static_blend.frag \
309 $(srcdir)/src/static_blit.vert \
310 $(srcdir)/src/static_blit.frag \
311 $(srcdir)/src/static_gltex.vert \
312 $(srcdir)/src/static_gltex.frag
314 EXTRA_DIST += $(SHADERS)
315 CLEANFILES += src/static_shaders.c
316 genshader_SOURCES = src/genshader.c
318 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
319 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
323 # This generates the unifont sources from raw hex-encoded font data.
326 UNIFONT = src/text_font_unifont_data.hex
328 EXTRA_DIST += $(UNIFONT)
329 CLEANFILES += src/text_font_unifont_data.c
330 genunifont_SOURCES = src/genunifont.c
332 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
333 $(AM_V_GEN)./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
337 # The text-font library is used by kmscon _and_ wlterm but is currently linked
338 # statically as it hasn't been cleaned up entirely.
339 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
342 if BUILD_ENABLE_KMSCON
343 noinst_LTLIBRARIES += libtext-font.la
345 if BUILD_ENABLE_WLTERM
346 noinst_LTLIBRARIES += libtext-font.la
350 libtext_font_la_SOURCES = \
357 nodist_libtext_font_la_SOURCES =
359 libtext_font_la_CPPFLAGS = \
361 libtext_font_la_LIBADD = \
365 if BUILD_ENABLE_FONT_8X16
366 libtext_font_la_SOURCES += src/text_font_8x16.c
369 if BUILD_ENABLE_FONT_UNIFONT
370 libtext_font_la_SOURCES += src/text_font_unifont.c
371 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
374 if BUILD_ENABLE_FONT_FREETYPE2
375 libtext_font_la_SOURCES += src/text_font_freetype2.c
376 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
377 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
380 if BUILD_ENABLE_FONT_PANGO
381 libtext_font_la_SOURCES += src/text_font_pango.c
382 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
383 libtext_font_la_LIBADD += $(PANGO_LIBS)
388 # These are the sources for the main binaries and test programs. They mostly
389 # consists of a single source file only and include all the libraries that are
390 # built as part of kmscon.
393 if BUILD_ENABLE_KMSCON
394 bin_PROGRAMS += kmscon
400 MANPAGES += docs/man/kmscon.1
421 src/kmscon_terminal.h \
429 nodist_kmscon_SOURCES =
441 if BUILD_ENABLE_SESSION_DUMMY
442 kmscon_SOURCES += src/kmscon_dummy.c
445 if BUILD_ENABLE_SESSION_TERMINAL
446 kmscon_SOURCES += src/kmscon_terminal.c
447 kmscon_LDADD += libtsm.la
450 if BUILD_ENABLE_SESSION_CDEV
451 kmscon_SOURCES += src/kmscon_cdev.c
452 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
453 kmscon_LDADD += $(FUSE_LIBS)
456 if BUILD_ENABLE_RENDERER_BBLIT
457 kmscon_SOURCES += src/text_bblit.c
460 if BUILD_ENABLE_RENDERER_BBULK
461 kmscon_SOURCES += src/text_bbulk.c
464 if BUILD_ENABLE_RENDERER_GLTEX
468 src/static_gl_math.c \
469 src/static_gl_shader.c
470 nodist_kmscon_SOURCES += src/static_shaders.c
471 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
472 kmscon_LDADD += $(GLES2_LIBS)
479 if BUILD_ENABLE_WLTERM
480 bin_PROGRAMS += wlterm
530 test_output_SOURCES = \
533 test_output_CPPFLAGS = \
536 test_output_LDADD = \
550 test_input_SOURCES = \
553 test_input_CPPFLAGS = \
563 test_key_CPPFLAGS = \
574 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
575 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
577 if BUILD_HAVE_XSLTPROC
578 if BUILD_HAVE_MANPAGES_STYLESHEET
580 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
583 --stringparam man.authors.section.enabled 0 \
584 --stringparam man.copyright.section.enabled 0 \
585 --stringparam funcsynopsis.style ansi \
586 --stringparam man.output.quietly 1 \
589 XSLTPROC_PROCESS_MAN = \
590 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
591 $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
594 # Force .man_fixup if $(MANPAGES) are not built
595 .man_fixup: | $(MANPAGES)
598 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
599 $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
601 docs/man/%.1: docs/man/%.xml
602 $(XSLTPROC_PROCESS_MAN)
604 docs/man/%.3: docs/man/%.xml
605 $(XSLTPROC_PROCESS_MAN)
607 docs/man/%.5: docs/man/%.xml
608 $(XSLTPROC_PROCESS_MAN)
610 docs/man/%.7: docs/man/%.xml
611 $(XSLTPROC_PROCESS_MAN)
613 endif # BUILD_HAVE_MANPAGES_STYLESHEET
614 endif # BUILD_HAVE_XSLTPROC