Modify it to adjust Tizen IVI enviroment
[platform/upstream/kmscon.git] / Makefile.am
index bce78ed..8f97c06 100644 (file)
@@ -1,36 +1,16 @@
 #
 # Kmscon - Global Makefile
-# Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
+# Copyright (c) 2012-2013 David Herrmann <dh.herrmann@googlemail.com>
 #
 
 #
-# Library Version Numbers
-#
-
-LIBELOOP_CURRENT = 1
-LIBELOOP_REVISION = 0
-LIBELOOP_AGE = 0
-
-LIBTSM_CURRENT = 1
-LIBTSM_REVISION = 0
-LIBTSM_AGE = 0
-
-LIBUVT_CURRENT = 1
-LIBUVT_REVISION = 0
-LIBUVT_AGE = 0
-
-LIBUTERM_CURRENT = 1
-LIBUTERM_REVISION = 0
-LIBUTERM_AGE = 0
-
-#
 # Global Configurations and Initializations
 #
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 AM_MAKEFLAGS = --no-print-directory
 AUTOMAKE_OPTIONS = color-tests
-AM_DISTCHECK_CONFIGURE_FLAGS = --enable-wlterm
+AM_DISTCHECK_CONFIGURE_FLAGS = --enable-all
 
 SUBDIRS = .
 
@@ -42,15 +22,7 @@ EXTRA_DIST = \
        COPYING \
        NEWS \
        docs/kmscon.service \
-       docs/kmsconvt@.service \
-       docs/pc/libeloop.pc.in \
-       docs/pc/libtsm.pc.in \
-       docs/pc/libuvt.pc.in \
-       docs/pc/libuterm.pc.in \
-       docs/sym/libeloop.sym \
-       docs/sym/libtsm.sym \
-       docs/sym/libuvt.sym \
-       docs/sym/libuterm.sym
+       docs/kmsconvt@.service
 CLEANFILES =
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA =
@@ -112,12 +84,13 @@ endif
 
 #
 # GIT-HEAD helper
-# The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
-# to the string returned by "git describe". We need to adjust this string for
-# every build and correctly rebuild any sources that depend on it. Therefore,
-# you should use this file rarely as it causes rebuilds on every git-commit.
+# The file ./src/shl_githead.c contains a constant "shl_git_head" which is
+# defined to the string returned by "git describe". We need to adjust this
+# string for every build and correctly rebuild any sources that depend on it.
+# Therefore, you should use this file rarely as it causes rebuilds on every
+# git-commit.
 #
-# We have a helper-script ./src/genversion.sh that takes as argument the header
+# We have a helper-script ./src/genversion.sh that takes as argument the source
 # file and creates it if necessary. It updates it only if the new git-describe
 # string is different to the old one. So the file is only modified on changes.
 # Hence, we can use it as normal dependency in this Makefile.
@@ -126,17 +99,17 @@ endif
 # "simply expanded" variable (:=) so the shell command is executed on
 # variable-declaration and not during expansion.
 #
-# Note that we must not clean ./src/githead.h ever! If we would, a distribution
-# tarball might delete that file and have no way to recreate it.
+# Note that we must not clean ./src/shl_githead.c ever! If we would, a
+# distribution tarball might delete that file and have no way to recreate it.
 # We could delete it on something like "make maintainerclean", but then again,
 # it seems unnecessary so lets simply not clean it at all.
 #
 # If the helper-script is executed in a directory that is not a git-repository
-# (like a distribution tarball) and githead.h exists, then it does nothing as it
-# expects githead.h to be correctly written by "make dist".
-# However, if githead.h does not exist, it will print a warning and write
-# "<unknown>" as git-revision.
-# This guarantees, that githead.h is always present and has the most correct
+# (like a distribution tarball) and shl_githead.c exists, then it does nothing
+# as it expects shl_githead.c to be correctly written by "make dist".
+# However, if shl_githead.c does not exist, it will print a warning and write
+# an unknown random git-revision.
+# This guarantees, that shl_githead.c is always present and has the most correct
 # value that we can get under any conditions.
 #
 # The $(emptyvariable) expansion below is used for broken $(shell ...)
@@ -144,7 +117,78 @@ endif
 #
 
 EXTRA_DIST += src/genversion.sh
-GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
+GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/shl_githead.c")
+
+#
+# Binary File Compiler
+# This target gets as input a binary file *.bin and produces an ELF/etc. output
+# object file *.bin.o and the corresponding libtool file *.bin.lo.
+# Note that we fake the libtool object files as there is no way to make libtool
+# create it. The comments in the .lo file are mandatory so don't remove them!
+#
+
+CLEANFILES += src/*.bin.lo src/*.bin.o
+
+src/%.bin.lo: src/%.bin
+       $(AM_V_GEN)$(LD) -r -o "src/$*.bin.o" -z noexecstack --format=binary "$<"
+       $(AM_V_at)$(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents "src/$*.bin.o"
+       $(AM_V_at)echo "# $@ - a libtool object file" >"$@"
+       $(AM_V_at)echo "# Generated by $(shell $(LIBTOOL) --version | head -n 1)" >>"$@"
+       $(AM_V_at)echo "#" >>"$@"
+       $(AM_V_at)echo "# Please DO NOT delete this file!" >>"$@"
+       $(AM_V_at)echo "# It is necessary for linking the library." >>"$@"
+       $(AM_V_at)echo >>"$@"
+       $(AM_V_at)echo "# Name of the PIC object." >>"$@"
+       $(AM_V_at)echo "pic_object='$*.bin.o'" >>"$@"
+       $(AM_V_at)echo >>"$@"
+       $(AM_V_at)echo "# Name of the non-PIC object" >>"$@"
+       $(AM_V_at)echo "non_pic_object='$*.bin.o'" >>"$@"
+       $(AM_V_at)echo >>"$@"
+
+#
+# Shader Converter
+# We use a few built-in shader files. To reduce memory-consumption, this helper
+# removes useless lines from the shaders before they are compiled into an object
+# file.
+#
+# Following regexp are used to remove characters/lines:
+#  ^/*.*$     Start of multi-line comment
+#  ^ *.*$     Multi-line comment body
+#  ^[ \t]*    Indentation whitespace
+#  [\r\n]     Newlines
+#
+
+CLEANFILES += src/*.vert.bin src/*.frag.bin
+SHADER_SED = -e 's/^\/\*.*$$//' -e 's/^ \*.*$$//' -e 's/^[ \t]*//'
+SHADER_TR = -d "\r\n"
+
+src/%.vert.bin: $(top_srcdir)/src/%.vert
+       $(AM_V_at)$(SED) $(SHADER_SED) "$<" | tr $(SHADER_TR) >"$@"
+
+src/%.frag.bin: $(top_srcdir)/src/%.frag
+       $(AM_V_at)$(SED) $(SHADER_SED) "$<" | tr $(SHADER_TR) >"$@"
+
+#
+# XKB Fallback Converter
+# We use a static built-in XKB fallback keymap. To avoid huge memory consumption
+# we remove useless lines/characters first.
+# We also append an ASCII 0 character so it can be used as regular C-string.
+#
+# Following regexp are used to remove characters/lines:
+#   *= *           Whitespace around assignments
+#   *, *           Whitespace around commatas
+#   *[][{}()] *    Whitespace around braces
+#  ^[ \t]*         Indentation whitespace
+#  [\r\n]          Newlines
+#
+
+CLEANFILES += src/*.xkb.bin
+XKB_SED = -e 's/^[ \t]*//' -e 's/ *\([,=]\) */\1/g' -e 's/ *\([][{}()]\) */\1/g'
+XKB_TR = -d "\r\n"
+
+src/%.xkb.bin: $(top_srcdir)/src/%.xkb
+       $(AM_V_at)$(SED) $(XKB_SED) "$<" | tr $(XKB_TR) >"$@"
+       $(AM_V_at)echo -ne "\x00" >>"$@"
 
 #
 # SHL - Static Helper Library
@@ -155,6 +199,8 @@ GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/gi
 noinst_LTLIBRARIES += libshl.la
 
 libshl_la_SOURCES = \
+       src/shl_githead.h \
+       src/shl_githead.c \
        src/shl_dlist.h \
        src/shl_array.h \
        src/shl_hashtable.h \
@@ -167,7 +213,8 @@ libshl_la_SOURCES = \
        src/shl_log.c \
        src/shl_hook.h \
        src/shl_misc.h \
-       src/shl_register.h
+       src/shl_register.h \
+       src/shl_flagset.h
 libshl_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        $(XKBCOMMON_CFLAGS) \
@@ -179,17 +226,19 @@ libshl_la_LIBADD = \
        $(AM_LIBADD) \
        $(XKBCOMMON_LIBS)
 
+if BUILD_HAVE_GLES2
+libshl_la_SOURCES += src/shl_gl.h src/shl_gl_shader.c src/shl_gl_math.c
+libshl_la_CPPFLAGS += $(GLES2_CFLAGS)
+libshl_la_LIBADD += $(GLES2_LIBS)
+endif
+
 #
 # libeloop
 # This library contains the whole event-loop implementation of kmscon. It is
 # compiled into a separate object to allow using it in several other programs.
 #
 
-if BUILD_ENABLE_ELOOP
-lib_LTLIBRARIES += libeloop.la
-include_HEADERS += src/eloop.h
-pkgconfig_DATA += docs/pc/libeloop.pc
-endif
+noinst_LTLIBRARIES += libeloop.la
 
 libeloop_la_SOURCES = \
        src/eloop.h \
@@ -197,93 +246,7 @@ libeloop_la_SOURCES = \
 
 libeloop_la_LIBADD = libshl.la
 libeloop_la_CPPFLAGS = $(AM_CPPFLAGS)
-EXTRA_libeloop_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libeloop.sym
-libeloop_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBELOOP_CURRENT):$(LIBELOOP_REVISION):$(LIBELOOP_AGE) \
-       -Wl,--version-script=$(top_srcdir)/docs/sym/libeloop.sym
-
-
-if BUILD_ENABLE_ELOOP_DBUS
-libeloop_la_SOURCES += \
-       external/dbus-common.h \
-       external/dbus-loop.h \
-       external/dbus-loop.c
-libeloop_la_CPPFLAGS += $(DBUS_CFLAGS)
-libeloop_la_LIBADD += $(DBUS_LIBS)
-endif
-
-#
-# libtsm
-# The Terminal-emulator State Machine is a library that implements the whole VTE
-# layer and everything related to it. It has no external dependencies so it can
-# be used to implement any kind of terminal emulator or debugger.
-#
-
-if BUILD_ENABLE_TSM
-lib_LTLIBRARIES += libtsm.la
-include_HEADERS += \
-       src/tsm_screen.h \
-       src/tsm_unicode.h \
-       src/tsm_vte.h
-pkgconfig_DATA += docs/pc/libtsm.pc
-endif
-
-libtsm_la_SOURCES = \
-       src/tsm_screen.h \
-       src/tsm_screen.c \
-       src/tsm_unicode.h \
-       src/tsm_unicode.c \
-       src/tsm_vte.h \
-       src/tsm_vte.c \
-       src/tsm_vte_charsets.c \
-       external/wcwidth.h \
-       external/wcwidth.c
-
-libtsm_la_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       $(XKBCOMMON_CFLAGS)
-libtsm_la_LIBADD = \
-       $(XKBCOMMON_LIBS) \
-       libshl.la
-EXTRA_libtsm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libtsm.sym
-libtsm_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
-       -Wl,--version-script="$(top_srcdir)/docs/sym/libtsm.sym"
-
-#
-# libuvt
-# Implementation of Virtual Terminals in user-space with the help of CUSE/FUSE
-# so we can provide character-device drivers in user-space. Aims to be 100%
-# compatible but also provides many other use-cases.
-#
-
-if BUILD_ENABLE_UVT
-lib_LTLIBRARIES += libuvt.la
-include_HEADERS += src/uvt.h
-pkgconfig_DATA += docs/pc/libuvt.pc
-endif
-
-libuvt_la_SOURCES = \
-       src/uvt.h \
-       src/uvt_internal.h \
-       src/uvt_ctx.c \
-       src/uvt_cdev.c \
-       src/uvt_client.c \
-       src/uvt_tty_null.c
-libuvt_la_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       $(FUSE_CFLAGS) \
-       -DFUSE_USE_VERSION=29
-libuvt_la_LIBADD = \
-       $(FUSE_LIBS) \
-       libshl.la
-EXTRA_libuvt_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuvt.sym
-libuvt_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBUVT_CURRENT):$(LIBUVT_REVISION):$(LIBUVT_AGE) \
-       -Wl,--version-script="$(top_srcdir)/docs/sym/libuvt.sym"
+libeloop_la_LDFLAGS = $(AM_LDFLAGS)
 
 #
 # libuterm
@@ -293,15 +256,7 @@ libuvt_la_LDFLAGS = \
 # abstractions and an input layer
 #
 
-if BUILD_ENABLE_UTERM
-lib_LTLIBRARIES += libuterm.la
-include_HEADERS += \
-       src/uterm_input.h \
-       src/uterm_monitor.h \
-       src/uterm_video.h \
-       src/uterm_vt.h
-pkgconfig_DATA += docs/pc/libuterm.pc
-endif
+noinst_LTLIBRARIES += libuterm.la
 
 libuterm_la_SOURCES = \
        src/uterm_input.h \
@@ -321,16 +276,16 @@ nodist_libuterm_la_SOURCES =
 
 libuterm_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
+       $(UDEV_CFLAGS) \
        $(XKBCOMMON_CFLAGS)
 libuterm_la_LIBADD = \
+       $(UDEV_LIBS) \
        $(XKBCOMMON_LIBS) \
        libeloop.la \
-       libshl.la
-EXTRA_libuterm_la_DEPENDENCIES = ${top_srcdir}/docs/sym/libuterm.sym
+       libshl.la \
+       src/uterm_input_fallback.xkb.bin.lo
 libuterm_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -version-info $(LIBUTERM_CURRENT):$(LIBUTERM_REVISION):$(LIBUTERM_AGE) \
-       -Wl,--version-script="$(top_srcdir)/docs/sym/libuterm.sym"
+       $(AM_LDFLAGS)
 
 if BUILD_ENABLE_MULTI_SEAT
 libuterm_la_SOURCES += src/uterm_systemd.c
@@ -338,11 +293,6 @@ libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
 endif
 
-if BUILD_ENABLE_HOTPLUG
-libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
-libuterm_la_LIBADD += $(UDEV_LIBS)
-endif
-
 if BUILD_ENABLE_VIDEO_FBDEV
 libuterm_la_SOURCES += \
        src/uterm_fbdev_internal.h \
@@ -360,15 +310,10 @@ libuterm_la_LIBADD += $(DRM_LIBS)
 endif
 
 if BUILD_ENABLE_VIDEO_DRM3D
-noinst_PROGRAMS += genshader
 libuterm_la_SOURCES += \
        src/uterm_drm3d_internal.h \
        src/uterm_drm3d_video.c \
-       src/uterm_drm3d_render.c \
-       src/static_gl.h \
-       src/static_gl_math.c \
-       src/static_gl_shader.c
-nodist_libuterm_la_SOURCES += src/static_shaders.c
+       src/uterm_drm3d_render.c
 libuterm_la_CPPFLAGS += \
        $(DRM_CFLAGS) \
        $(EGL_CFLAGS) \
@@ -378,7 +323,13 @@ libuterm_la_LIBADD += \
        $(DRM_LIBS) \
        $(EGL_LIBS) \
        $(GBM_LIBS) \
-       $(GLES2_LIBS)
+       $(GLES2_LIBS) \
+       src/uterm_drm3d_blend.vert.bin.lo \
+       src/uterm_drm3d_blend.frag.bin.lo \
+       src/uterm_drm3d_blit.vert.bin.lo \
+       src/uterm_drm3d_blit.frag.bin.lo \
+       src/uterm_drm3d_fill.vert.bin.lo \
+       src/uterm_drm3d_fill.frag.bin.lo
 endif
 
 # add shared sources only once
@@ -394,45 +345,24 @@ endif
 endif
 
 #
-# Shaders
-# As there is no need to modify shaders at run-time, we statically compile them
-# into object files. As autotools would ignore them, we need to add them to
-# EXTRA_DIST.
-# The program that converts the shaders into C-source files is "genshader". It's
-# pretty simple and just creates a string with the shader source as content.
-#
-
-SHADERS = \
-       $(srcdir)/src/static_fill.vert \
-       $(srcdir)/src/static_fill.frag \
-       $(srcdir)/src/static_blend.vert \
-       $(srcdir)/src/static_blend.frag \
-       $(srcdir)/src/static_blit.vert \
-       $(srcdir)/src/static_blit.frag \
-       $(srcdir)/src/static_gltex.vert \
-       $(srcdir)/src/static_gltex.frag
-
-EXTRA_DIST += $(SHADERS)
-CLEANFILES += src/static_shaders.c
-genshader_SOURCES = src/genshader.c
-
-src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
-       $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
-
-#
 # Unifont Generator
 # This generates the unifont sources from raw hex-encoded font data.
 #
 
 UNIFONT = $(top_srcdir)/src/font_unifont_data.hex
 UNIFONT_BIN = src/font_unifont_data.bin
+UNIFONT_LT = src/font_unifont_data.bin.lo
 
 EXTRA_DIST += $(UNIFONT)
 CLEANFILES += $(UNIFONT_BIN)
 genunifont_SOURCES = src/genunifont.c
 
-$(UNIFONT_BIN): $(UNIFONT) genunifont$(EXEEXT)
-       $(AM_V_GEN)./genunifont$(EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
+genunifont$(BUILD_EXEEXT) $(genunifont_OBJECTS): CC = $(CC_FOR_BUILD)
+genunifont$(BUILD_EXEEXT) $(genunifont_OBJECTS): CFLAGS = $(CFLAGS_FOR_BUILD)
+genunifont$(BUILD_EXEEXT): LDFLAGS = $(LDFLAGS_FOR_BUILD)
+
+$(UNIFONT_BIN): $(UNIFONT) genunifont$(BUILD_EXEEXT)
+       $(AM_V_GEN)./genunifont$(BUILD_EXEEXT) $(UNIFONT_BIN) $(UNIFONT)
 
 #
 # Kmscon Modules
@@ -445,36 +375,12 @@ endif
 
 mod_unifont_la_SOURCES = \
        src/kmscon_module_interface.h \
-       src/githead.h \
        src/font_unifont.c \
        src/kmscon_mod_unifont.c
-EXTRA_mod_unifont_la_DEPENDENCIES = $(UNIFONT_BIN)
-mod_unifont_la_LIBADD = libshl.la
-mod_unifont_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -module \
-       -avoid-version \
-       -Wl,-z,noexecstack \
-       -Wl,--format=binary -Wl,$(UNIFONT_BIN) -Wl,--format=default
-
-if BUILD_ENABLE_FONT_FREETYPE2
-module_LTLIBRARIES += mod-freetype2.la
-endif
-
-mod_freetype2_la_SOURCES = \
-       src/kmscon_module_interface.h \
-       src/githead.h \
-       src/font_freetype2.c \
-       src/kmscon_mod_freetype2.c
-mod_freetype2_la_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       $(FREETYPE2_CFLAGS)
-mod_freetype2_la_LIBADD = \
-       $(FREETYPE2_LIBS) \
-       -lpthread \
-       libtsm.la \
+mod_unifont_la_LIBADD = \
+       $(UNIFONT_LT) \
        libshl.la
-mod_freetype2_la_LDFLAGS = \
+mod_unifont_la_LDFLAGS = \
        $(AM_LDFLAGS) \
        -module \
        -avoid-version
@@ -485,16 +391,16 @@ endif
 
 mod_pango_la_SOURCES = \
        src/kmscon_module_interface.h \
-       src/githead.h \
        src/font_pango.c \
        src/kmscon_mod_pango.c
 mod_pango_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
-       $(PANGO_CFLAGS)
+       $(PANGO_CFLAGS) \
+       $(TSM_CFLAGS)
 mod_pango_la_LIBADD = \
        $(PANGO_LIBS) \
+       $(TSM_LIBS) \
        -lpthread \
-       libtsm.la \
        libshl.la
 mod_pango_la_LDFLAGS = \
        $(AM_LDFLAGS) \
@@ -507,10 +413,14 @@ endif
 
 mod_bbulk_la_SOURCES = \
        src/kmscon_module_interface.h \
-       src/githead.h \
        src/text_bbulk.c \
        src/kmscon_mod_bbulk.c
-mod_bbulk_la_LIBADD = libshl.la
+mod_bbulk_la_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
+       $(TSM_CFLAGS)
+mod_bbulk_la_LIBADD = \
+       $(TSM_LIBS) \
+       libshl.la
 mod_bbulk_la_LDFLAGS = \
        $(AM_LDFLAGS) \
        -module \
@@ -518,57 +428,33 @@ mod_bbulk_la_LDFLAGS = \
 
 if BUILD_ENABLE_RENDERER_GLTEX
 module_LTLIBRARIES += mod-gltex.la
-noinst_PROGRAMS += genshader
 endif
 
 mod_gltex_la_SOURCES = \
        src/kmscon_module_interface.h \
-       src/githead.h \
        src/text_gltex.c \
-       src/static_gl.h \
-       src/static_gl_math.c \
-       src/static_gl_shader.c \
        src/kmscon_mod_gltex.c
-nodist_mod_gltex_la_SOURCES = \
-       src/static_shaders.c
 mod_gltex_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
+       $(TSM_CFLAGS) \
        $(GLES2_CFLAGS)
 mod_gltex_la_LIBADD = \
        $(GLES2_LIBS) \
-       libshl.la
+       $(TSM_LIBS) \
+       libshl.la \
+       src/text_gltex_atlas.vert.bin.lo \
+       src/text_gltex_atlas.frag.bin.lo
 mod_gltex_la_LDFLAGS = \
        $(AM_LDFLAGS) \
        -module \
        -avoid-version
 
-if BUILD_ENABLE_RENDERER_CAIRO
-module_LTLIBRARIES += mod-cairo.la
-endif
-
-mod_cairo_la_SOURCES = \
-       src/kmscon_module_interface.h \
-       src/githead.h \
-       src/text_cairo.c \
-       src/kmscon_mod_cairo.c
-mod_cairo_la_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       $(CAIRO_CFLAGS)
-mod_cairo_la_LIBADD = \
-       $(CAIRO_LIBS) \
-       libshl.la
-mod_cairo_la_LDFLAGS = \
-       $(AM_LDFLAGS) \
-       -module \
-       -avoid-version
-
 if BUILD_ENABLE_RENDERER_PIXMAN
 module_LTLIBRARIES += mod-pixman.la
 endif
 
 mod_pixman_la_SOURCES = \
        src/kmscon_module_interface.h \
-       src/githead.h \
        src/text_pixman.c \
        src/kmscon_mod_pixman.c
 mod_pixman_la_CPPFLAGS = \
@@ -589,7 +475,6 @@ mod_pixman_la_LDFLAGS = \
 # built as part of kmscon.
 #
 
-if BUILD_ENABLE_KMSCON
 bin_PROGRAMS += kmscon
 check_PROGRAMS += \
        test_output \
@@ -597,10 +482,8 @@ check_PROGRAMS += \
        test_input \
        test_key
 MANPAGES += docs/man/kmscon.1
-endif
 
 kmscon_SOURCES = \
-       src/githead.h \
        src/conf.h \
        src/conf.c \
        src/pty.h \
@@ -616,7 +499,6 @@ kmscon_SOURCES = \
        src/kmscon_module.c \
        src/kmscon_terminal.h \
        src/kmscon_dummy.h \
-       src/kmscon_cdev.h \
        src/kmscon_seat.h \
        src/kmscon_seat.c \
        src/kmscon_conf.h \
@@ -626,9 +508,11 @@ nodist_kmscon_SOURCES =
 
 kmscon_CPPFLAGS = \
        $(AM_CPPFLAGS) \
-       $(XKBCOMMON_CFLAGS)
+       $(XKBCOMMON_CFLAGS) \
+       $(TSM_CFLAGS)
 kmscon_LDADD = \
        $(XKBCOMMON_LIBS) \
+       $(TSM_LIBS) \
        libeloop.la \
        libuterm.la \
        libshl.la \
@@ -644,55 +528,9 @@ endif
 
 if BUILD_ENABLE_SESSION_TERMINAL
 kmscon_SOURCES += src/kmscon_terminal.c
-kmscon_LDADD += libtsm.la
-endif
-
-if BUILD_ENABLE_SESSION_CDEV
-kmscon_SOURCES += src/kmscon_cdev.c
-kmscon_CPPFLAGS += $(FUSE_CFLAGS)
-kmscon_LDADD += $(FUSE_LIBS)
 endif
 
 #
-# Wayland Terminal
-#
-
-if BUILD_ENABLE_WLTERM
-bin_PROGRAMS += wlterm
-endif
-
-wlterm_SOURCES = \
-       src/wlt_main.h \
-       src/wlt_main.c \
-       src/wlt_toolkit.h \
-       src/wlt_toolkit.c \
-       src/wlt_theme.h \
-       src/wlt_theme.c \
-       src/wlt_terminal.h \
-       src/wlt_terminal.c \
-       src/conf.h \
-       src/conf.c \
-       src/pty.h \
-       src/pty.c \
-       src/font.h \
-       src/font.c \
-       src/font_8x16.c \
-       src/font_pango.c
-wlterm_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       $(WAYLAND_CFLAGS) \
-       $(PANGO_CFLAGS) \
-       $(XKBCOMMON_CFLAGS)
-wlterm_LDADD = \
-       $(WAYLAND_LIBS) \
-       $(PANGO_LIBS) \
-       $(XKBCOMMON_LIBS) \
-       libeloop.la \
-       libtsm.la \
-       libshl.la \
-       -lpthread
-
-#
 # Tests
 #
 
@@ -705,7 +543,8 @@ test_cflags = \
        $(XKBCOMMON_CFLAGS)
 test_libs = \
        $(XKBCOMMON_LIBS) \
-       libeloop.la
+       libeloop.la \
+       libshl.la
 
 test_output_SOURCES = \
        $(test_sources) \
@@ -789,3 +628,10 @@ endif # BUILD_HAVE_XSLTPROC
 #
 
 .PHONY: $(TPHONY)
+
+#
+# Empty .SECONDARY target causes alle intermediate files to be treated as
+# secondary files. That is, they don't get deleted after make finished.
+#
+
+.SECONDARY: