2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
6 ACLOCAL_AMFLAGS = -I m4
15 docs/kmscon@.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 # This library contains the whole event-loop implementation of kmscon. It is
98 # compiled into a separate object to allow using it in several other programs.
101 if BUILD_ENABLE_ELOOP
102 lib_LTLIBRARIES += libeloop.la
103 include_HEADERS += src/eloop.h
104 pkgconfig_DATA += docs/pc/libeloop.pc
107 libeloop_la_SOURCES = \
114 libeloop_la_CPPFLAGS = \
117 libeloop_la_LDFLAGS = \
121 if BUILD_ENABLE_ELOOP_DBUS
122 libeloop_la_SOURCES += \
123 external/dbus-common.h \
124 external/dbus-loop.h \
126 libeloop_la_CPPFLAGS += \
128 libeloop_la_LIBADD += \
134 # The Terminal-emulator State Machine is a library that implements the whole VTE
135 # layer and everything related to it. It has no external dependencies so it can
136 # be used to implement any kind of terminal emulator or debugger.
150 libtsm_la_SOURCES = \
161 src/tsm_vte_charsets.c \
165 libtsm_la_CPPFLAGS = \
168 libtsm_la_LDFLAGS = \
174 # The uterm library provides helpers to create terminals in user-space. They
175 # are not limited to text-based terminals but rather provide graphics contexts
176 # so arbitrary output can be displayed. Additionally, they provide VT
177 # abstractions and an input layer
180 if BUILD_ENABLE_UTERM
181 lib_LTLIBRARIES += libuterm.la
182 include_HEADERS += src/uterm.h
183 pkgconfig_DATA += docs/pc/libuterm.pc
186 libuterm_la_SOURCES = \
194 src/uterm_systemd.h \
196 src/uterm_monitor.c \
199 src/uterm_input_uxkb.c
201 nodist_libuterm_la_SOURCES =
203 libuterm_la_CPPFLAGS = \
206 libuterm_la_LIBADD = \
209 libuterm_la_LDFLAGS = \
212 if BUILD_ENABLE_MULTI_SEAT
213 libuterm_la_SOURCES += src/uterm_systemd.c
214 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
215 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
218 if BUILD_ENABLE_HOTPLUG
219 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
220 libuterm_la_LIBADD += $(UDEV_LIBS)
223 if BUILD_ENABLE_PCIACCESS
224 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
225 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
226 libuterm_la_SOURCES += src/uterm_pci.c
229 if BUILD_ENABLE_VIDEO_FBDEV
230 libuterm_la_SOURCES += src/uterm_video_fbdev.c
233 if BUILD_ENABLE_VIDEO_DUMB
234 libuterm_la_SOURCES += src/uterm_video_dumb.c
235 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
236 libuterm_la_LIBADD += $(DRM_LIBS)
239 if BUILD_ENABLE_VIDEO_DRM
240 libuterm_la_SOURCES += \
241 src/uterm_video_drm.c \
243 src/static_gl_math.c \
244 src/static_gl_shader.c
245 nodist_libuterm_la_SOURCES += \
247 libuterm_la_CPPFLAGS += \
252 libuterm_la_LIBADD += \
261 # As there is no need to modify shaders at run-time, we statically compile them
262 # into object files. As autotools would ignore them, we need to add them to
264 # The program that converts the shaders into C-source files is "genshader". It's
265 # pretty simple and just creates a string with the shader source as content.
269 $(srcdir)/src/static_fill.vert \
270 $(srcdir)/src/static_fill.frag \
271 $(srcdir)/src/static_blend.vert \
272 $(srcdir)/src/static_blend.frag \
273 $(srcdir)/src/static_blit.vert \
274 $(srcdir)/src/static_blit.frag \
275 $(srcdir)/src/static_gltex.vert \
276 $(srcdir)/src/static_gltex.frag
278 EXTRA_DIST += $(SHADERS)
279 CLEANFILES += src/static_shaders.c
280 genshader_SOURCES = src/genshader.c
282 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
283 $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
287 # This generates the unifont sources from raw hex-encoded font data.
290 UNIFONT = src/text_font_unifont_data.hex
292 EXTRA_DIST += $(UNIFONT)
293 CLEANFILES += src/text_font_unifont_data.c
294 genunifont_SOURCES = src/genunifont.c
296 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
297 $(AM_V_GEN)./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
301 # The text-font library is used by kmscon _and_ wlterm but is currently linked
302 # statically as it hasn't been cleaned up entirely.
303 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
306 if BUILD_ENABLE_KMSCON
307 noinst_LTLIBRARIES += libtext-font.la
309 if BUILD_ENABLE_WLTERM
310 noinst_LTLIBRARIES += libtext-font.la
314 libtext_font_la_SOURCES = \
321 nodist_libtext_font_la_SOURCES =
323 libtext_font_la_CPPFLAGS = \
325 libtext_font_la_LIBADD = \
329 if BUILD_ENABLE_FONT_8X16
330 libtext_font_la_SOURCES += src/text_font_8x16.c
333 if BUILD_ENABLE_FONT_UNIFONT
334 libtext_font_la_SOURCES += src/text_font_unifont.c
335 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
338 if BUILD_ENABLE_FONT_FREETYPE2
339 libtext_font_la_SOURCES += src/text_font_freetype2.c
340 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
341 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
344 if BUILD_ENABLE_FONT_PANGO
345 libtext_font_la_SOURCES += src/text_font_pango.c
346 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
347 libtext_font_la_LIBADD += $(PANGO_LIBS)
352 # These are the sources for the main binaries and test programs. They mostly
353 # consists of a single source file only and include all the libraries that are
354 # built as part of kmscon.
357 if BUILD_ENABLE_KMSCON
358 bin_PROGRAMS += kmscon
383 src/kmscon_terminal.h \
391 nodist_kmscon_SOURCES =
403 if BUILD_ENABLE_SESSION_DUMMY
404 kmscon_SOURCES += src/kmscon_dummy.c
407 if BUILD_ENABLE_SESSION_TERMINAL
408 kmscon_SOURCES += src/kmscon_terminal.c
409 kmscon_LDADD += libtsm.la
412 if BUILD_ENABLE_SESSION_CDEV
413 kmscon_SOURCES += src/kmscon_cdev.c
414 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
415 kmscon_LDADD += $(FUSE_LIBS)
418 if BUILD_ENABLE_RENDERER_BBLIT
419 kmscon_SOURCES += src/text_bblit.c
422 if BUILD_ENABLE_RENDERER_BBULK
423 kmscon_SOURCES += src/text_bbulk.c
426 if BUILD_ENABLE_RENDERER_GLTEX
430 src/static_gl_math.c \
431 src/static_gl_shader.c
432 nodist_kmscon_SOURCES += src/static_shaders.c
433 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
434 kmscon_LDADD += $(GLES2_LIBS)
435 MANPAGES += docs/man/kmscon.1
442 if BUILD_ENABLE_WLTERM
443 bin_PROGRAMS += wlterm
493 test_output_SOURCES = \
496 test_output_CPPFLAGS = \
499 test_output_LDADD = \
513 test_input_SOURCES = \
516 test_input_CPPFLAGS = \
526 test_key_CPPFLAGS = \
536 MAN_XML_FILES = ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
538 EXTRA_DIST += $(MAN_XML_FILES)
540 if BUILD_HAVE_XSLTPROC
541 if BUILD_HAVE_MANPAGES_STYLESHEET
543 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
544 EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES)
545 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES) man_fixup_aliases
548 --stringparam man.authors.section.enabled 0 \
549 --stringparam man.copyright.section.enabled 0 \
550 --stringparam funcsynopsis.style ansi \
551 --stringparam man.output.quietly 1 \
554 XSLTPROC_PROCESS_MAN = \
555 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
556 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) $<
558 TPHONY += man_fixup_aliases
559 man_fixup_aliases: $(MANPAGES) $(MANPAGES_ALIASES)
560 $(AM_V_GEN)if test -n "$(MANPAGES_ALIASES)" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' $(MANPAGES_ALIASES) ; fi
562 docs/man/%.1: docs/man/%.xml
563 $(XSLTPROC_PROCESS_MAN)
565 docs/man/%.3: docs/man/%.xml
566 $(XSLTPROC_PROCESS_MAN)
568 docs/man/%.5: docs/man/%.xml
569 $(XSLTPROC_PROCESS_MAN)
571 docs/man/%.7: docs/man/%.xml
572 $(XSLTPROC_PROCESS_MAN)
574 endif # BUILD_HAVE_MANPAGES_STYLESHEET
575 endif # BUILD_HAVE_XSLTPROC