packaging: disable ivi-shell for wearable profile
[platform/upstream/weston.git] / Makefile.am
index f36b85b..b08932d 100644 (file)
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS = -I m4
+
 bin_PROGRAMS =
 noinst_PROGRAMS =
 libexec_PROGRAMS =
@@ -6,9 +8,9 @@ module_LTLIBRARIES =
 noinst_LTLIBRARIES =
 BUILT_SOURCES =
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-setuid-install
+AM_DISTCHECK_CONFIGURE_FLAGS = --disable-setuid-install
 
-EXTRA_DIST = weston.ini.in
+EXTRA_DIST = weston.ini.in ivi-shell/weston.ini.in
 
 weston.ini : $(srcdir)/weston.ini.in
        $(AM_V_GEN)$(SED) \
@@ -17,7 +19,25 @@ weston.ini : $(srcdir)/weston.ini.in
                -e 's|@libexecdir[@]|$(libexecdir)|g' \
                $< > $@
 
-all-local : weston.ini validate-protocol-xml
+ivi-shell/weston.ini : $(srcdir)/ivi-shell/weston.ini.in
+       $(AM_V_GEN)$(SED) \
+               -e 's|@bindir[@]|$(bindir)|g' \
+               -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
+               -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
+               -e 's|@libexecdir[@]|$(libexecdir)|g' \
+               -e 's|@plugin_prefix[@]||g' \
+               $< > $@
+
+tests/weston-ivi.ini : $(srcdir)/ivi-shell/weston.ini.in
+       $(AM_V_GEN)$(SED) \
+               -e 's|@bindir[@]|$(bindir)|g' \
+               -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
+               -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
+               -e 's|@libexecdir[@]|$(libexecdir)|g' \
+               -e 's|@plugin_prefix[@]|$(abs_top_builddir)/.libs/|g' \
+               $< > $@
+
+all-local : weston.ini ivi-shell/weston.ini
 
 AM_CFLAGS = $(GCC_CFLAGS)
 
@@ -27,12 +47,17 @@ AM_CPPFLAGS =                                       \
        -I$(top_builddir)/clients               \
        -I$(top_builddir)/tests                 \
        -I$(top_srcdir)/shared                  \
+       -I$(top_builddir)/protocol              \
        -DDATADIR='"$(datadir)"'                \
        -DMODULEDIR='"$(moduledir)"'            \
        -DLIBEXECDIR='"$(libexecdir)"'          \
        -DBINDIR='"$(bindir)"'
 
-CLEANFILES = weston.ini $(BUILT_SOURCES)
+CLEANFILES = weston.ini                                \
+       ivi-shell/weston.ini                    \
+       tests/weston-ivi.ini                    \
+       internal-screenshot-00.png              \
+       $(BUILT_SOURCES)
 
 bin_PROGRAMS += weston
 
@@ -49,34 +74,42 @@ weston_SOURCES =                                    \
        src/compositor.h                                \
        src/input.c                                     \
        src/data-device.c                               \
-       src/filter.c                                    \
-       src/filter.h                                    \
        src/screenshooter.c                             \
-       src/screenshooter-protocol.c                    \
-       src/screenshooter-server-protocol.h             \
        src/clipboard.c                                 \
-       src/text-cursor-position-protocol.c             \
-       src/text-cursor-position-server-protocol.h      \
        src/zoom.c                                      \
        src/text-backend.c                              \
-       src/text-protocol.c                             \
-       src/text-server-protocol.h                      \
-       src/input-method-protocol.c                     \
-       src/input-method-server-protocol.h              \
-       src/workspaces-protocol.c                       \
-       src/workspaces-server-protocol.h                \
-       src/scaler-protocol.c                           \
-       src/scaler-server-protocol.h                    \
        src/bindings.c                                  \
        src/animation.c                                 \
        src/noop-renderer.c                             \
        src/pixman-renderer.c                           \
        src/pixman-renderer.h                           \
+       src/timeline.c                                  \
+       src/timeline.h                                  \
+       src/timeline-object.h                           \
        shared/matrix.c                                 \
        shared/matrix.h                                 \
        shared/zalloc.h                                 \
+       shared/platform.h                               \
        src/weston-egl-ext.h
 
+nodist_weston_SOURCES =                                        \
+       protocol/screenshooter-protocol.c               \
+       protocol/screenshooter-server-protocol.h        \
+       protocol/text-cursor-position-protocol.c        \
+       protocol/text-cursor-position-server-protocol.h \
+       protocol/text-protocol.c                        \
+       protocol/text-server-protocol.h                 \
+       protocol/input-method-protocol.c                \
+       protocol/input-method-server-protocol.h         \
+       protocol/workspaces-protocol.c                  \
+       protocol/workspaces-server-protocol.h           \
+       protocol/presentation_timing-protocol.c         \
+       protocol/presentation_timing-server-protocol.h  \
+       protocol/scaler-protocol.c                      \
+       protocol/scaler-server-protocol.h
+
+BUILT_SOURCES += $(nodist_weston_SOURCES)
+
 # Track this dependency explicitly instead of using BUILT_SOURCES.  We
 # add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h
 # in case we're building from tarballs.
@@ -108,6 +141,10 @@ endif
 if HAVE_GIT_REPO
 src/git-version.h : $(top_srcdir)/.git/logs/HEAD
        $(AM_V_GEN)echo "#define BUILD_ID \"$(shell git --git-dir=$(top_srcdir)/.git describe --always --dirty) $(shell git --git-dir=$(top_srcdir)/.git log -1 --format='%s (%ci)')\"" > $@
+else
+src/git-version.h :
+       $(AM_V_GEN)echo "#define BUILD_ID \"unknown (not built from git or tarball)\"" > $@
+
 endif
 
 .FORCE :
@@ -125,8 +162,15 @@ weston_launch_LDADD = $(PAM_LIBS) $(SYSTEMD_LOGIN_LIBS) $(LIBDRM_LIBS)
 
 if ENABLE_SETUID_INSTALL
 install-exec-hook:
-       chown root $(DESTDIR)$(bindir)/weston-launch
-       chmod u+s $(DESTDIR)$(bindir)/weston-launch
+       can_suid_files=no; \
+       chown root $(DESTDIR)$(bindir)/weston-launch \
+               && chmod u+s $(DESTDIR)$(bindir)/weston-launch \
+               && can_suid_files=yes;\
+       if test $$can_suid_files = no; then \
+               echo 'Error: unable to unable to change ownership/setuid on weston-launch.'; \
+               echo 'To skip this step, re-run ./configure using --disable-setuid-install'; \
+               false; \
+       fi
 endif
 
 endif # BUILD_WESTON_LAUNCH
@@ -134,13 +178,19 @@ endif # BUILD_WESTON_LAUNCH
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = src/weston.pc
 
+wayland_sessiondir = $(datadir)/wayland-sessions
+wayland_session_DATA = src/weston.desktop
+dist_wayland_session_DATA = $(wayland_session_DATA)
+
 westonincludedir = $(includedir)/weston
 westoninclude_HEADERS =                                \
        src/version.h                           \
        src/compositor.h                        \
+       src/timeline-object.h                   \
        shared/matrix.h                         \
        shared/config-parser.h                  \
-       shared/zalloc.h
+       shared/zalloc.h                         \
+       shared/platform.h
 
 if ENABLE_EGL
 module_LTLIBRARIES += gl-renderer.la
@@ -172,13 +222,21 @@ x11_backend_la_CFLAGS =                           \
 x11_backend_la_SOURCES = src/compositor-x11.c
 endif
 
+INPUT_BACKEND_LIBS = $(LIBINPUT_BACKEND_LIBS)
+INPUT_BACKEND_SOURCES =                                \
+       src/libinput-seat.c                     \
+       src/libinput-seat.h                     \
+       src/libinput-device.c                   \
+       src/libinput-device.h
+
 if ENABLE_DRM_COMPOSITOR
 module_LTLIBRARIES += drm-backend.la
 drm_backend_la_LDFLAGS = -module -avoid-version
 drm_backend_la_LIBADD =                                \
        $(COMPOSITOR_LIBS)                      \
        $(DRM_COMPOSITOR_LIBS)                  \
-       libshared.la -lrt               \
+       $(INPUT_BACKEND_LIBS)                   \
+       libshared.la -lrt                       \
        libsession-helper.la
 drm_backend_la_CFLAGS =                                \
        $(COMPOSITOR_CFLAGS)                    \
@@ -187,11 +245,7 @@ drm_backend_la_CFLAGS =                            \
        $(GCC_CFLAGS)
 drm_backend_la_SOURCES =                       \
        src/compositor-drm.c                    \
-       src/udev-seat.c                         \
-       src/udev-seat.h                         \
-       src/evdev.c                             \
-       src/evdev.h                             \
-       src/evdev-touchpad.c                    \
+       $(INPUT_BACKEND_SOURCES)                \
        src/libbacklight.c                      \
        src/libbacklight.h
 
@@ -217,6 +271,9 @@ wayland_backend_la_CFLAGS =                 \
        $(WAYLAND_COMPOSITOR_CFLAGS)            \
        $(GCC_CFLAGS)
 wayland_backend_la_SOURCES = src/compositor-wayland.c
+nodist_wayland_backend_la_SOURCES =                    \
+       protocol/fullscreen-shell-protocol.c            \
+       protocol/fullscreen-shell-client-protocol.h
 endif
 
 if ENABLE_RPI_COMPOSITOR
@@ -230,6 +287,7 @@ rpi_backend_la_LDFLAGS = -module -avoid-version
 rpi_backend_la_LIBADD = $(COMPOSITOR_LIBS)     \
        $(RPI_COMPOSITOR_LIBS)                  \
        $(RPI_BCM_HOST_LIBS)                    \
+       $(INPUT_BACKEND_LIBS)                   \
        libsession-helper.la                    \
        libshared.la
 rpi_backend_la_CFLAGS =                                \
@@ -242,11 +300,7 @@ rpi_backend_la_SOURCES =                   \
        src/rpi-renderer.c                      \
        src/rpi-renderer.h                      \
        src/rpi-bcm-stubs.h                     \
-       src/udev-seat.c                         \
-       src/udev-seat.h                         \
-       src/evdev.c                             \
-       src/evdev.h                             \
-       src/evdev-touchpad.c
+       $(INPUT_BACKEND_SOURCES)
 
 if ENABLE_EGL
 rpi_backend_la_LIBADD += $(EGL_LIBS)
@@ -258,11 +312,8 @@ endif
 if ENABLE_HEADLESS_COMPOSITOR
 module_LTLIBRARIES += headless-backend.la
 headless_backend_la_LDFLAGS = -module -avoid-version
-headless_backend_la_LIBADD = $(COMPOSITOR_LIBS) \
-       libshared.la
-headless_backend_la_CFLAGS =                   \
-       $(COMPOSITOR_CFLAGS)                    \
-       $(GCC_CFLAGS)
+headless_backend_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+headless_backend_la_CFLAGS = $(COMPOSITOR_CFLAGS) $(GCC_CFLAGS)
 headless_backend_la_SOURCES = src/compositor-headless.c
 endif
 
@@ -272,6 +323,7 @@ fbdev_backend_la_LDFLAGS = -module -avoid-version
 fbdev_backend_la_LIBADD =                      \
        $(COMPOSITOR_LIBS)                      \
        $(FBDEV_COMPOSITOR_LIBS)                \
+       $(INPUT_BACKEND_LIBS)                   \
        libsession-helper.la                    \
        libshared.la
 fbdev_backend_la_CFLAGS =                      \
@@ -282,11 +334,7 @@ fbdev_backend_la_CFLAGS =                  \
        $(GCC_CFLAGS)
 fbdev_backend_la_SOURCES =                     \
        src/compositor-fbdev.c                  \
-       src/udev-seat.c                         \
-       src/udev-seat.h                         \
-       src/evdev.c                             \
-       src/evdev.h                             \
-       src/evdev-touchpad.c
+       $(INPUT_BACKEND_SOURCES)
 endif
 
 if ENABLE_RDP_COMPOSITOR
@@ -317,8 +365,8 @@ cms_colord_la_LDFLAGS = -module -avoid-version
 cms_colord_la_LIBADD = $(COMPOSITOR_LIBS) $(COLORD_LIBS)
 cms_colord_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS) $(COLORD_CFLAGS)
 cms_colord_la_SOURCES =                                \
-       src/cms-colord.c                                \
-       src/cms-helper.c                                \
+       src/cms-colord.c                        \
+       src/cms-helper.c                        \
        src/cms-helper.h
 endif
 endif
@@ -333,20 +381,6 @@ spring_tool_SOURCES =                              \
        shared/matrix.h                         \
        src/compositor.h
 
-BUILT_SOURCES +=                                       \
-       src/screenshooter-server-protocol.h             \
-       src/screenshooter-protocol.c                    \
-       src/text-cursor-position-server-protocol.h      \
-       src/text-cursor-position-protocol.c             \
-       src/text-protocol.c                             \
-       src/text-server-protocol.h                      \
-       src/input-method-protocol.c                     \
-       src/input-method-server-protocol.h              \
-       src/workspaces-server-protocol.h                \
-       src/workspaces-protocol.c                       \
-       src/scaler-server-protocol.h                    \
-       src/scaler-protocol.c
-
 if BUILD_CLIENTS
 
 bin_PROGRAMS += weston-terminal weston-info
@@ -357,6 +391,11 @@ libexec_PROGRAMS +=                                \
        weston-keyboard                         \
        weston-simple-im
 
+if ENABLE_IVI_SHELL
+libexec_PROGRAMS +=                            \
+       weston-ivi-shell-user-interface
+endif
+
 demo_clients =                                 \
        weston-flower                           \
        weston-image                            \
@@ -382,35 +421,58 @@ endif
 if BUILD_SIMPLE_CLIENTS
 demo_clients +=                                        \
        weston-simple-shm                       \
+       weston-simple-damage                    \
        weston-simple-touch                     \
+       weston-presentation-shm                 \
        weston-multi-resource
 
-weston_simple_shm_SOURCES =                    \
-       clients/simple-shm.c                    \
-       shared/os-compatibility.c               \
-       shared/os-compatibility.h
-weston_simple_shm_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS)
-weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS)
-
-weston_simple_touch_SOURCES =                  \
-       clients/simple-touch.c                  \
-       shared/os-compatibility.c               \
-       shared/os-compatibility.h
-weston_simple_touch_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS)
-weston_simple_touch_LDADD = $(SIMPLE_CLIENT_LIBS)
-
-weston_multi_resource_SOURCES =                        \
-       clients/multi-resource.c                \
-       shared/os-compatibility.c               \
-       shared/os-compatibility.h
-weston_multi_resource_CPPFLAGS = $(SIMPLE_CLIENT_CFLAGS)
-weston_multi_resource_LDADD = $(SIMPLE_CLIENT_LIBS) -lm
+weston_simple_shm_SOURCES = clients/simple-shm.c
+nodist_weston_simple_shm_SOURCES =             \
+       protocol/xdg-shell-protocol.c           \
+       protocol/xdg-shell-client-protocol.h    \
+       protocol/fullscreen-shell-protocol.c    \
+       protocol/fullscreen-shell-client-protocol.h     \
+       protocol/ivi-application-protocol.c             \
+       protocol/ivi-application-client-protocol.h
+weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
+weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
+
+weston_simple_damage_SOURCES = clients/simple-damage.c
+nodist_weston_simple_damage_SOURCES =          \
+       protocol/scaler-protocol.c              \
+       protocol/scaler-client-protocol.h       \
+       protocol/xdg-shell-protocol.c           \
+       protocol/xdg-shell-client-protocol.h    \
+       protocol/fullscreen-shell-protocol.c    \
+       protocol/fullscreen-shell-client-protocol.h
+weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
+weston_simple_damage_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
+
+weston_simple_touch_SOURCES = clients/simple-touch.c
+weston_simple_touch_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
+weston_simple_touch_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
+
+weston_presentation_shm_SOURCES = clients/presentation-shm.c
+nodist_weston_presentation_shm_SOURCES =               \
+       protocol/presentation_timing-protocol.c         \
+       protocol/presentation_timing-client-protocol.h
+weston_presentation_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
+weston_presentation_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lm
+
+weston_multi_resource_SOURCES = clients/multi-resource.c
+weston_multi_resource_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
+weston_multi_resource_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la -lrt -lm
 endif
 
 if BUILD_SIMPLE_EGL_CLIENTS
 demo_clients += weston-simple-egl
 weston_simple_egl_SOURCES = clients/simple-egl.c
-weston_simple_egl_CPPFLAGS = $(SIMPLE_EGL_CLIENT_CFLAGS)
+nodist_weston_simple_egl_SOURCES =             \
+       protocol/xdg-shell-protocol.c           \
+       protocol/xdg-shell-client-protocol.h            \
+       protocol/ivi-application-protocol.c             \
+       protocol/ivi-application-client-protocol.h
+weston_simple_egl_CFLAGS = $(AM_CFLAGS) $(SIMPLE_EGL_CLIENT_CFLAGS)
 weston_simple_egl_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm
 endif
 
@@ -418,163 +480,197 @@ noinst_LTLIBRARIES += libtoytoolkit.la
 
 libtoytoolkit_la_SOURCES =                             \
        clients/window.c                                \
-       clients/window.h                                \
-       clients/text-cursor-position-protocol.c         \
-       clients/text-cursor-position-client-protocol.h  \
-       clients/scaler-protocol.c                       \
-       clients/scaler-client-protocol.h                \
-       clients/workspaces-protocol.c                   \
-       clients/workspaces-client-protocol.h
+       clients/window.h
+
+nodist_libtoytoolkit_la_SOURCES =                      \
+       protocol/text-cursor-position-protocol.c        \
+       protocol/text-cursor-position-client-protocol.h \
+       protocol/scaler-protocol.c                      \
+       protocol/scaler-client-protocol.h               \
+       protocol/workspaces-protocol.c                  \
+       protocol/workspaces-client-protocol.h           \
+       protocol/presentation_timing-protocol.c         \
+       protocol/presentation_timing-client-protocol.h  \
+       protocol/xdg-shell-protocol.c                   \
+       protocol/xdg-shell-client-protocol.h            \
+       protocol/ivi-application-protocol.c             \
+       protocol/ivi-application-client-protocol.h
+
+BUILT_SOURCES += $(nodist_libtoytoolkit_la_SOURCES)
+
 
 libtoytoolkit_la_LIBADD =                      \
        $(CLIENT_LIBS)                          \
        $(CAIRO_EGL_LIBS)                       \
        libshared-cairo.la -lrt -lm
-libtoytoolkit_la_CFLAGS = $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS)
+libtoytoolkit_la_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) $(CAIRO_EGL_CFLAGS)
 
 weston_flower_SOURCES = clients/flower.c
 weston_flower_LDADD = libtoytoolkit.la
-weston_flower_CFLAGS = $(CLIENT_CFLAGS)
+weston_flower_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
-weston_screenshooter_SOURCES =                 \
-       clients/screenshot.c                            \
-       clients/screenshooter-protocol.c                \
-       clients/screenshooter-client-protocol.h         \
-       shared/os-compatibility.c               \
-       shared/os-compatibility.h
-weston_screenshooter_LDADD = $(CLIENT_LIBS)
-weston_screenshooter_CFLAGS = $(CLIENT_CFLAGS)
+weston_screenshooter_SOURCES =                         \
+       clients/screenshot.c
+nodist_weston_screenshooter_SOURCES =                  \
+       protocol/screenshooter-protocol.c               \
+       protocol/screenshooter-client-protocol.h
+weston_screenshooter_LDADD = $(CLIENT_LIBS) libshared.la
+weston_screenshooter_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_terminal_SOURCES = clients/terminal.c
 weston_terminal_LDADD = libtoytoolkit.la -lutil
-weston_terminal_CFLAGS = $(CLIENT_CFLAGS)
+weston_terminal_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_image_SOURCES = clients/image.c
 weston_image_LDADD = libtoytoolkit.la
-weston_image_CFLAGS = $(CLIENT_CFLAGS)
+weston_image_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
-weston_cliptest_SOURCES = clients/cliptest.c
-weston_cliptest_CFLAGS = $(AM_CPPFLAGS) $(CLIENT_CFLAGS)
+weston_cliptest_SOURCES =                              \
+       clients/cliptest.c                              \
+       src/vertex-clipping.c                           \
+       src/vertex-clipping.h
+weston_cliptest_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 weston_cliptest_LDADD = libtoytoolkit.la
 
 weston_dnd_SOURCES = clients/dnd.c
 weston_dnd_LDADD = libtoytoolkit.la
-weston_dnd_CFLAGS = $(CLIENT_CFLAGS)
+weston_dnd_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_smoke_SOURCES = clients/smoke.c
 weston_smoke_LDADD = libtoytoolkit.la
-weston_smoke_CFLAGS = $(CLIENT_CFLAGS)
+weston_smoke_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_resizor_SOURCES = clients/resizor.c
 weston_resizor_LDADD = libtoytoolkit.la
-weston_resizor_CFLAGS = $(CLIENT_CFLAGS)
+weston_resizor_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_scaler_SOURCES = clients/scaler.c
 weston_scaler_LDADD = libtoytoolkit.la
-weston_scaler_CFLAGS = $(CLIENT_CFLAGS)
+weston_scaler_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 if HAVE_CAIRO_GLESV2
 demo_clients += weston-nested weston-nested-client
 
 weston_nested_SOURCES = clients/nested.c
 weston_nested_LDADD = libtoytoolkit.la $(SERVER_LIBS)
-weston_nested_CFLAGS = $(CLIENT_CFLAGS)
+weston_nested_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_nested_client_SOURCES = clients/nested-client.c
 weston_nested_client_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm
+weston_nested_client_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 endif
 
 weston_eventdemo_SOURCES = clients/eventdemo.c
 weston_eventdemo_LDADD = libtoytoolkit.la
-weston_eventdemo_CFLAGS = $(CLIENT_CFLAGS)
+weston_eventdemo_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_clickdot_SOURCES = clients/clickdot.c
 weston_clickdot_LDADD = libtoytoolkit.la
-weston_clickdot_CFLAGS = $(CLIENT_CFLAGS)
+weston_clickdot_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_transformed_SOURCES = clients/transformed.c
 weston_transformed_LDADD = libtoytoolkit.la
-weston_transformed_CFLAGS = $(CLIENT_CFLAGS)
+weston_transformed_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_fullscreen_SOURCES = clients/fullscreen.c
+nodist_weston_fullscreen_SOURCES =                     \
+       protocol/fullscreen-shell-protocol.c            \
+       protocol/fullscreen-shell-client-protocol.h
 weston_fullscreen_LDADD = libtoytoolkit.la
-weston_fullscreen_CFLAGS = $(CLIENT_CFLAGS)
+weston_fullscreen_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_stacking_SOURCES = clients/stacking.c
 weston_stacking_LDADD = libtoytoolkit.la
-weston_stacking_CFLAGS = $(CLIENT_CFLAGS)
+weston_stacking_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_calibrator_SOURCES = clients/calibrator.c       \
        shared/matrix.c                                 \
        shared/matrix.h
 weston_calibrator_LDADD = libtoytoolkit.la
-weston_calibrator_CFLAGS = $(CLIENT_CFLAGS)
+weston_calibrator_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 if BUILD_SUBSURFACES_CLIENT
 demo_clients += weston-subsurfaces
 weston_subsurfaces_SOURCES = clients/subsurfaces.c
-weston_subsurfaces_CFLAGS = $(SIMPLE_EGL_CLIENT_CFLAGS) $(CLIENT_CFLAGS)
+weston_subsurfaces_CFLAGS =                    \
+       $(AM_CFLAGS)                            \
+       $(SIMPLE_EGL_CLIENT_CFLAGS)             \
+       $(CLIENT_CFLAGS)
 weston_subsurfaces_LDADD = libtoytoolkit.la $(SIMPLE_EGL_CLIENT_LIBS) -lm
 endif
 
 if HAVE_PANGO
 demo_clients += weston-editor
-weston_editor_SOURCES =                                \
-       clients/editor.c                        \
-       clients/text-protocol.c                 \
-       clients/text-client-protocol.h
+weston_editor_SOURCES = clients/editor.c
+nodist_weston_editor_SOURCES =                 \
+       protocol/text-protocol.c                \
+       protocol/text-client-protocol.h
 weston_editor_LDADD = libtoytoolkit.la $(PANGO_LIBS)
-weston_editor_CFLAGS = $(CLIENT_CFLAGS) $(PANGO_CFLAGS)
+weston_editor_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) $(PANGO_CFLAGS)
 endif
 
-weston_keyboard_SOURCES =                      \
-       clients/keyboard.c                      \
-       clients/desktop-shell-client-protocol.h \
-       clients/desktop-shell-protocol.c        \
-       clients/input-method-protocol.c         \
-       clients/input-method-client-protocol.h
+weston_keyboard_SOURCES = clients/keyboard.c
+nodist_weston_keyboard_SOURCES =                       \
+       protocol/desktop-shell-client-protocol.h        \
+       protocol/desktop-shell-protocol.c               \
+       protocol/input-method-protocol.c                \
+       protocol/input-method-client-protocol.h
 weston_keyboard_LDADD = libtoytoolkit.la
-weston_keyboard_CFLAGS = $(CLIENT_CFLAGS)
+weston_keyboard_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
-weston_simple_im_SOURCES =                     \
-       clients/weston-simple-im.c              \
-       clients/input-method-protocol.c         \
-       clients/input-method-client-protocol.h
+weston_simple_im_SOURCES = clients/weston-simple-im.c
+nodist_weston_simple_im_SOURCES =              \
+       protocol/input-method-protocol.c        \
+       protocol/input-method-client-protocol.h
 weston_simple_im_LDADD = $(CLIENT_LIBS)
-weston_simple_im_CFLAGS = $(CLIENT_CFLAGS)
-
-weston_info_SOURCES =                          \
-       clients/weston-info.c                   \
-       shared/os-compatibility.c               \
-       shared/os-compatibility.h
-weston_info_LDADD = $(WESTON_INFO_LIBS)
-
-weston_desktop_shell_SOURCES =                 \
-       clients/desktop-shell.c                 \
-       clients/desktop-shell-client-protocol.h \
-       clients/desktop-shell-protocol.c
+weston_simple_im_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
+
+weston_info_SOURCES = clients/weston-info.c
+nodist_weston_info_SOURCES =                           \
+       protocol/presentation_timing-protocol.c         \
+       protocol/presentation_timing-client-protocol.h
+weston_info_LDADD = $(WESTON_INFO_LIBS) libshared.la
+weston_info_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
+
+weston_desktop_shell_SOURCES = clients/desktop-shell.c
+nodist_weston_desktop_shell_SOURCES =                  \
+       protocol/desktop-shell-client-protocol.h        \
+       protocol/desktop-shell-protocol.c
 weston_desktop_shell_LDADD = libtoytoolkit.la
-weston_desktop_shell_CFLAGS = $(CLIENT_CFLAGS)
+weston_desktop_shell_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
+
+if ENABLE_IVI_SHELL
+weston_ivi_shell_user_interface_SOURCES = clients/ivi-shell-user-interface.c
+nodist_weston_ivi_shell_user_interface_SOURCES =                       \
+       protocol/ivi-hmi-controller-client-protocol.h                   \
+       protocol/ivi-hmi-controller-protocol.c                          \
+       protocol/ivi-application-client-protocol.h                      \
+        protocol/ivi-application-protocol.c
+weston_ivi_shell_user_interface_LDADD = libtoytoolkit.la
+weston_ivi_shell_user_interface_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
+endif
 
 if BUILD_FULL_GL_CLIENTS
 demo_clients += weston-gears
 weston_gears_SOURCES = clients/gears.c
 weston_gears_LDADD = libtoytoolkit.la
-weston_gears_CFLAGS = $(CLIENT_CFLAGS)
+weston_gears_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 if HAVE_GLU
 libexec_PROGRAMS += weston-screensaver
-weston_screensaver_SOURCES =                   \
-       clients/wscreensaver.c                  \
-       clients/wscreensaver.h                  \
-       clients/desktop-shell-client-protocol.h \
-       clients/desktop-shell-protocol.c        \
-       clients/wscreensaver-glue.c             \
-       clients/wscreensaver-glue.h             \
-       clients/glmatrix.c                      \
+weston_screensaver_SOURCES =                           \
+       clients/wscreensaver.c                          \
+       clients/wscreensaver.h                          \
+       clients/wscreensaver-glue.c                     \
+       clients/wscreensaver-glue.h                     \
+       clients/glmatrix.c                              \
        clients/matrix3.xpm
+nodist_weston_screensaver_SOURCES =                    \
+       protocol/desktop-shell-client-protocol.h        \
+       protocol/desktop-shell-protocol.c
+
 weston_screensaver_LDADD = libtoytoolkit.la $(GLU_LIBS)
-weston_screensaver_CFLAGS = $(GLU_CFLAGS) $(CLIENT_CFLAGS)
+weston_screensaver_CFLAGS = $(AM_CFLAGS) $(GLU_CFLAGS) $(CLIENT_CFLAGS)
 
 endif
 
@@ -583,21 +679,28 @@ endif
 endif
 
 BUILT_SOURCES +=                                       \
-       clients/screenshooter-client-protocol.h         \
-       clients/screenshooter-protocol.c                \
-       clients/text-cursor-position-client-protocol.h  \
-       clients/text-cursor-position-protocol.c         \
-       clients/text-protocol.c                         \
-       clients/text-client-protocol.h                  \
-       clients/input-method-protocol.c                 \
-       clients/input-method-client-protocol.h          \
-       clients/desktop-shell-client-protocol.h         \
-       clients/desktop-shell-protocol.c                \
-       clients/scaler-client-protocol.h                \
-       clients/scaler-protocol.c                       \
-       clients/workspaces-client-protocol.h            \
-       clients/workspaces-protocol.c
-
+       protocol/screenshooter-protocol.c               \
+       protocol/screenshooter-client-protocol.h        \
+       protocol/text-cursor-position-client-protocol.h \
+       protocol/text-cursor-position-protocol.c        \
+       protocol/text-protocol.c                        \
+       protocol/text-client-protocol.h                 \
+       protocol/input-method-protocol.c                \
+       protocol/input-method-client-protocol.h         \
+       protocol/desktop-shell-client-protocol.h        \
+       protocol/desktop-shell-protocol.c               \
+       protocol/scaler-client-protocol.h               \
+       protocol/scaler-protocol.c                      \
+       protocol/workspaces-client-protocol.h           \
+       protocol/workspaces-protocol.c                  \
+       protocol/fullscreen-shell-protocol.c            \
+       protocol/fullscreen-shell-client-protocol.h     \
+       protocol/xdg-shell-protocol.c                   \
+       protocol/xdg-shell-client-protocol.h            \
+       protocol/ivi-hmi-controller-protocol.c          \
+       protocol/ivi-hmi-controller-client-protocol.h   \
+       protocol/ivi-application-protocol.c             \
+       protocol/ivi-application-client-protocol.h
 
 westondatadir = $(datadir)/weston
 dist_westondata_DATA =                         \
@@ -611,6 +714,22 @@ dist_westondata_DATA =                             \
        data/sign_maximize.png                  \
        data/sign_minimize.png
 
+if ENABLE_IVI_SHELL
+dist_westondata_DATA +=                                \
+       data/background.png                     \
+       data/tiling.png                         \
+       data/fullscreen.png                     \
+       data/panel.png                          \
+       data/random.png                         \
+       data/sidebyside.png                     \
+       data/home.png                           \
+       data/icon_ivi_clickdot.png              \
+       data/icon_ivi_flower.png                \
+       data/icon_ivi_simple-egl.png            \
+       data/icon_ivi_simple-shm.png            \
+       data/icon_ivi_smoke.png
+endif
+
 
 if BUILD_WCAP_TOOLS
 bin_PROGRAMS += wcap-decode
@@ -630,6 +749,7 @@ if ENABLE_DESKTOP_SHELL
 module_LTLIBRARIES += desktop-shell.la
 
 desktop_shell_la_CPPFLAGS =                    \
+       -I$(top_builddir)/protocol              \
        -I$(top_srcdir)/shared                  \
        -I$(top_srcdir)/src                     \
        -I$(top_builddir)/src                   \
@@ -640,32 +760,113 @@ desktop_shell_la_CPPFLAGS =                      \
        -DIN_WESTON
 
 desktop_shell_la_LDFLAGS = -module -avoid-version
-desktop_shell_la_LIBADD = $(COMPOSITOR_LIBS)   \
-       libshared.la
+desktop_shell_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
 desktop_shell_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
 desktop_shell_la_SOURCES =                             \
        desktop-shell/shell.h                           \
        desktop-shell/shell.c                           \
        desktop-shell/exposay.c                         \
-       desktop-shell/input-panel.c                     \
-       desktop-shell/desktop-shell-protocol.c          \
-       desktop-shell/desktop-shell-server-protocol.h   \
-       desktop-shell/xdg-shell-protocol.c              \
-       desktop-shell/xdg-shell-server-protocol.h
+       desktop-shell/input-panel.c
+nodist_desktop_shell_la_SOURCES =                      \
+       protocol/desktop-shell-protocol.c               \
+       protocol/desktop-shell-server-protocol.h        \
+       protocol/xdg-shell-protocol.c                   \
+       protocol/xdg-shell-server-protocol.h
+
+BUILT_SOURCES += $(nodist_desktop_shell_la_SOURCES)
+endif
+
+if ENABLE_FULLSCREEN_SHELL
+
+module_LTLIBRARIES += fullscreen-shell.la
+
+fullscreen_shell_la_CPPFLAGS =                 \
+       -I$(top_builddir)/protocol              \
+       -I$(top_srcdir)/shared                  \
+       -I$(top_srcdir)/src                     \
+       -I$(top_builddir)/src                   \
+       -DIN_WESTON
+
+fullscreen_shell_la_LDFLAGS = -module -avoid-version
+fullscreen_shell_la_LIBADD = $(COMPOSITOR_LIBS)
+fullscreen_shell_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+fullscreen_shell_la_SOURCES =                  \
+       fullscreen-shell/fullscreen-shell.c
+nodist_fullscreen_shell_la_SOURCES =                   \
+       protocol/fullscreen-shell-protocol.c            \
+       protocol/fullscreen-shell-server-protocol.h
+
+BUILT_SOURCES += $(nodist_fullscreen_shell_la_SOURCES)
+endif
+
+if ENABLE_IVI_SHELL
+
+module_LTLIBRARIES +=                          \
+       $(ivi_shell)                            \
+       $(hmi_controller)
+
+ivi_shell = ivi-shell.la
+ivi_shell_la_LDFLAGS = -module -avoid-version
+ivi_shell_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+ivi_shell_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+ivi_shell_la_SOURCES =                         \
+       ivi-shell/ivi-layout-export.h           \
+       ivi-shell/ivi-layout-private.h          \
+       ivi-shell/ivi-layout.c                  \
+       ivi-shell/ivi-layout-transition.c       \
+       ivi-shell/ivi-shell.h                   \
+       ivi-shell/ivi-shell.c                   \
+       ivi-shell/input-panel-ivi.c
+nodist_ivi_shell_la_SOURCES =                  \
+       protocol/ivi-application-protocol.c             \
+       protocol/ivi-application-server-protocol.h
+
+BUILT_SOURCES += $(nodist_ivi_shell_la_SOURCES)
+
+hmi_controller = hmi-controller.la
+hmi_controller_la_LDFLAGS = -module -avoid-version
+hmi_controller_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+hmi_controller_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+hmi_controller_la_SOURCES =                            \
+       ivi-shell/ivi-layout-export.h                   \
+       ivi-shell/hmi-controller.c
+nodist_hmi_controller_la_SOURCES =                     \
+       protocol/ivi-hmi-controller-protocol.c          \
+       protocol/ivi-hmi-controller-server-protocol.h
+
+BUILT_SOURCES += $(nodist_hmi_controller_la_SOURCES)
 
-BUILT_SOURCES +=                                       \
-       desktop-shell/desktop-shell-protocol.c          \
-       desktop-shell/desktop-shell-server-protocol.h   \
-       desktop-shell/xdg-shell-protocol.c              \
-       desktop-shell/xdg-shell-server-protocol.h
 endif
 
 
+if ENABLE_SCREEN_SHARING
+
+module_LTLIBRARIES += screen-share.la
+
+screen_share_la_CPPFLAGS = $(AM_CPPFLAGS) -DBINDIR='"$(bindir)"'
+screen_share_la_LDFLAGS = -module -avoid-version
+screen_share_la_LIBADD =                       \
+       $(COMPOSITOR_LIBS)                      \
+       $(SCREEN_SHARE_LIBS)                    \
+       libshared-cairo.la
+screen_share_la_CFLAGS =                       \
+       $(COMPOSITOR_CFLAGS)                    \
+       $(SCREEN_SHARE_CFLAGS)                  \
+       $(GCC_CFLAGS)
+screen_share_la_SOURCES =                      \
+       src/screen-share.c
+nodist_screen_share_la_SOURCES =                       \
+       protocol/fullscreen-shell-protocol.c            \
+       protocol/fullscreen-shell-client-protocol.h
+
+endif
+
 if ENABLE_XWAYLAND
 
 module_LTLIBRARIES += xwayland.la
 
 xwayland_la_CPPFLAGS =                         \
+       -I$(top_builddir)/protocol              \
        -I$(top_srcdir)/shared                  \
        -I$(top_srcdir)/src                     \
        -I$(top_builddir)/src                   \
@@ -690,14 +891,8 @@ xwayland_la_SOURCES =                              \
        xwayland/selection.c                    \
        xwayland/dnd.c                          \
        xwayland/launcher.c                     \
-       xwayland/xserver-protocol.c             \
-       xwayland/xserver-server-protocol.h      \
        xwayland/hash.c                         \
        xwayland/hash.h
-
-BUILT_SOURCES +=                               \
-       xwayland/xserver-protocol.c             \
-       xwayland/xserver-server-protocol.h
 endif
 
 
@@ -713,6 +908,10 @@ libshared_la_SOURCES =                             \
        shared/config-parser.c                  \
        shared/option-parser.c                  \
        shared/config-parser.h                  \
+       shared/file-util.c                      \
+       shared/file-util.h                      \
+       shared/str-util.c                       \
+       shared/str-util.h                       \
        shared/os-compatibility.c               \
        shared/os-compatibility.h
 
@@ -745,10 +944,14 @@ libshared_cairo_la_SOURCES =                      \
 # tests subdirectory
 #
 
-TESTS = $(shared_tests) $(module_tests) $(weston_tests)
+TESTS = $(internal_tests) $(shared_tests) $(module_tests) $(weston_tests) $(ivi_tests)
+
+internal_tests =                               \
+       internal-screenshot.weston
 
 shared_tests =                                 \
        config-parser.test                      \
+       strutil.test                            \
        vertex-clip.test
 
 module_tests =                                 \
@@ -761,18 +964,25 @@ weston_tests =                                    \
        event.weston                            \
        button.weston                           \
        text.weston                             \
-       subsurface.weston
+       presentation.weston                     \
+       roles.weston                            \
+       subsurface.weston                       \
+       devices.weston
+
+ivi_tests =
 
+$(ivi_tests) : $(builddir)/tests/weston-ivi.ini
 
 AM_TESTS_ENVIRONMENT = \
-       abs_builddir='$(abs_builddir)'; export abs_builddir;
+       abs_builddir='$(abs_builddir)'; export abs_builddir; \
+       abs_top_srcdir='$(abs_top_srcdir)'; export abs_top_srcdir;
 
 TEST_EXTENSIONS = .la .weston
 LA_LOG_COMPILER = $(srcdir)/tests/weston-tests-env
 WESTON_LOG_COMPILER = $(srcdir)/tests/weston-tests-env
 
 clean-local:
-       -rm -rf tests/logs
+       -rm -rf logs
 
 # To remove when automake 1.11 support is dropped
 export abs_builddir
@@ -785,8 +995,10 @@ noinst_LTLIBRARIES +=                      \
 
 noinst_PROGRAMS +=                     \
        $(setbacklight)                 \
+       $(internal_tests)               \
        $(shared_tests)                 \
        $(weston_tests)                 \
+       $(ivi_tests)                    \
        matrix-test
 
 test_module_ldflags = \
@@ -803,10 +1015,10 @@ surface_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
 weston_test_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
 weston_test_la_LDFLAGS = $(test_module_ldflags)
 weston_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
-weston_test_la_SOURCES =                       \
-       tests/weston-test.c                     \
-       tests/wayland-test-protocol.c           \
-       tests/wayland-test-server-protocol.h
+weston_test_la_SOURCES = tests/weston-test.c
+nodist_weston_test_la_SOURCES =                        \
+       protocol/weston-test-protocol.c \
+       protocol/weston-test-server-protocol.h
 
 if ENABLE_EGL
 weston_test_la_CFLAGS += $(EGL_TESTS_CFLAGS)
@@ -821,37 +1033,80 @@ libtest_runner_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
 config_parser_test_SOURCES = tests/config-parser-test.c
 config_parser_test_LDADD = libshared.la libtest-runner.la $(COMPOSITOR_LIBS)
 
+strutil_test_SOURCES = tests/strutil-test.c
+strutil_test_LDADD = libshared.la libtest-runner.la $(COMPOSITOR_LIBS)
+
 vertex_clip_test_SOURCES =                     \
        tests/vertex-clip-test.c                \
        src/vertex-clipping.c                   \
        src/vertex-clipping.h
 vertex_clip_test_LDADD = libtest-runner.la -lm -lrt
 
-libtest_client_la_SOURCES =            \
+libtest_client_la_SOURCES =                    \
        tests/weston-test-client-helper.c       \
-       tests/weston-test-client-helper.h       \
-       tests/wayland-test-protocol.c           \
-       tests/wayland-test-client-protocol.h
+       tests/weston-test-client-helper.h
+nodist_libtest_client_la_SOURCES =             \
+       protocol/weston-test-protocol.c \
+       protocol/weston-test-client-protocol.h
+libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
 
+
+#
+# Internal tests - tests functionality of the testsuite itself
+#
+
+internal_screenshot_weston_SOURCES = tests/internal-screenshot-test.c
+internal_screenshot_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CAIRO_CFLAGS)
+internal_screenshot_weston_LDADD = libtest-client.la  $(CAIRO_LIBS)
+
+
+#
+# Weston Tests
+#
+
 bad_buffer_weston_SOURCES = tests/bad-buffer-test.c
+bad_buffer_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 bad_buffer_weston_LDADD = libtest-client.la
 
 keyboard_weston_SOURCES = tests/keyboard-test.c
+keyboard_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 keyboard_weston_LDADD = libtest-client.la
 
 event_weston_SOURCES = tests/event-test.c
+event_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 event_weston_LDADD = libtest-client.la
 
 button_weston_SOURCES = tests/button-test.c
+button_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 button_weston_LDADD = libtest-client.la
 
-text_weston_SOURCES = tests/text-test.c tests/text-protocol.c
+devices_weston_SOURCES = tests/devices-test.c
+devices_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+devices_weston_LDADD = libtest-client.la
+
+text_weston_SOURCES = tests/text-test.c
+nodist_text_weston_SOURCES =                   \
+       protocol/text-protocol.c                \
+       protocol/text-client-protocol.h
+text_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 text_weston_LDADD = libtest-client.la
 
 subsurface_weston_SOURCES = tests/subsurface-test.c
+subsurface_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 subsurface_weston_LDADD = libtest-client.la
 
+presentation_weston_SOURCES = tests/presentation-test.c
+nodist_presentation_weston_SOURCES =           \
+       protocol/presentation_timing-protocol.c \
+       protocol/presentation_timing-client-protocol.h
+presentation_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+presentation_weston_LDADD = libtest-client.la
+
+roles_weston_SOURCES = tests/roles-test.c
+roles_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+roles_weston_LDADD = libtest-client.la
+
 if ENABLE_EGL
 weston_tests += buffer-count.weston
 buffer_count_weston_SOURCES = tests/buffer-count-test.c
@@ -860,10 +1115,10 @@ buffer_count_weston_LDADD = libtest-client.la $(EGL_TESTS_LIBS)
 endif
 
 if ENABLE_XWAYLAND_TEST
-weston_tests +=        xwayland.weston
-xwayland_weston_SOURCES = tests/xwayland-test.c
-xwayland_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS)
-xwayland_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS)
+weston_tests +=        xwayland-test.weston
+xwayland_test_weston_SOURCES = tests/xwayland-test.c
+xwayland_test_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS)
+xwayland_test_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS)
 endif
 
 matrix_test_SOURCES =                          \
@@ -873,50 +1128,105 @@ matrix_test_SOURCES =                           \
 matrix_test_CPPFLAGS = -DUNIT_TEST
 matrix_test_LDADD = -lm -lrt
 
+if ENABLE_IVI_SHELL
+module_tests +=                                \
+       ivi-layout-internal-test.la             \
+       ivi-layout-test.la
+
+ivi_layout_internal_test_la_LIBADD = $(COMPOSITOR_LIBS)
+ivi_layout_internal_test_la_LDFLAGS = $(test_module_ldflags)
+ivi_layout_internal_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+ivi_layout_internal_test_la_SOURCES =                  \
+       tests/ivi_layout-internal-test.c
+
+ivi_layout_test_la_LIBADD = $(COMPOSITOR_LIBS)
+ivi_layout_test_la_LDFLAGS = $(test_module_ldflags)
+ivi_layout_test_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+ivi_layout_test_la_SOURCES =                   \
+       tests/ivi_layout-test-plugin.c          \
+       tests/ivi-test.h
+nodist_ivi_layout_test_la_SOURCES =            \
+       protocol/weston-test-protocol.c         \
+       protocol/weston-test-server-protocol.h
+
+ivi_tests +=                                   \
+       ivi-shell-app.weston
+
+ivi_shell_app_weston_SOURCES = tests/ivi-shell-app-test.c
+nodist_ivi_shell_app_weston_SOURCES =          \
+       protocol/ivi-application-protocol.c     \
+       protocol/ivi-application-client-protocol.h
+ivi_shell_app_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+ivi_shell_app_weston_LDADD = libtest-client.la
+
+noinst_PROGRAMS += ivi-layout.ivi
+
+ivi_layout_ivi_SOURCES =                       \
+       tests/ivi_layout-test.c                 \
+       tests/ivi-test.h
+nodist_ivi_layout_ivi_SOURCES =                \
+       protocol/ivi-application-protocol.c     \
+       protocol/ivi-application-client-protocol.h
+ivi_layout_ivi_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+ivi_layout_ivi_LDADD = libtest-client.la
+endif
+
 if BUILD_SETBACKLIGHT
 noinst_PROGRAMS += setbacklight
-setbacklight_SOURCES =                         \
-       tests/setbacklight.c                    \
-       src/libbacklight.c                      \
+setbacklight_SOURCES =                 \
+       tests/setbacklight.c            \
+       shared/str-util.c               \
+       shared/str-util.h               \
+       src/libbacklight.c              \
        src/libbacklight.h
 setbacklight_CFLAGS = $(AM_CFLAGS) $(SETBACKLIGHT_CFLAGS)
 setbacklight_LDADD = $(SETBACKLIGHT_LIBS)
 endif
 
-EXTRA_DIST += tests/weston-tests-env
+EXTRA_DIST +=                                                  \
+       tests/weston-tests-env                                  \
+       tests/internal-screenshot.ini                           \
+       tests/reference/internal-screenshot-bad-00.png          \
+       tests/reference/internal-screenshot-good-00.png
 
 BUILT_SOURCES +=                               \
-       tests/wayland-test-protocol.c           \
-       tests/wayland-test-server-protocol.h    \
-       tests/wayland-test-client-protocol.h    \
-       tests/text-protocol.c                   \
-       tests/text-client-protocol.h
+       protocol/weston-test-protocol.c \
+       protocol/weston-test-server-protocol.h  \
+       protocol/weston-test-client-protocol.h  \
+       protocol/text-protocol.c                \
+       protocol/text-client-protocol.h
 
-protocol_sources =                             \
+EXTRA_DIST +=                                  \
        protocol/desktop-shell.xml              \
        protocol/screenshooter.xml              \
-       protocol/xserver.xml                    \
        protocol/text.xml                       \
        protocol/input-method.xml               \
        protocol/workspaces.xml                 \
        protocol/text-cursor-position.xml       \
-       protocol/wayland-test.xml               \
+       protocol/weston-test.xml                \
        protocol/xdg-shell.xml                  \
-       protocol/scaler.xml
-
-if HAVE_XMLLINT
-.PHONY : validate-protocol-xml
+       protocol/fullscreen-shell.xml           \
+       protocol/presentation_timing.xml        \
+       protocol/scaler.xml                     \
+       protocol/ivi-application.xml            \
+       protocol/ivi-hmi-controller.xml
 
-.%.xml.valid : $(top_srcdir)/protocol/%.xml
-       $(AM_V_GEN)$(XMLLINT) --noout --dtdvalid $(dtddir)/wayland.dtd $^ > $@
+#
+# manual test modules in tests subdirectory
+#
 
-validate-protocol-xml : $(protocol_sources:protocol/%.xml=.%.xml.valid)
+noinst_LTLIBRARIES +=                          \
+       surface-screenshot.la
 
-CLEANFILES += $(protocol_sources:protocol/%.xml=.%.xml.valid)
-EXTRA_DIST += $(protocol_sources)
+surface_screenshot_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+surface_screenshot_la_LDFLAGS = $(test_module_ldflags)
+surface_screenshot_la_CFLAGS = $(GCC_CFLAGS) $(COMPOSITOR_CFLAGS)
+surface_screenshot_la_SOURCES = tests/surface-screenshot.c
 
-endif
 
+#
+# Documentation
+#
 
 man_MANS = weston.1 weston.ini.5
 
@@ -943,13 +1253,11 @@ EXTRA_DIST +=                                    \
 CLEANFILES += $(man_MANS)
 
 
-wayland_protocoldir = $(top_srcdir)/protocol
-
-%-protocol.c : $(wayland_protocoldir)/%.xml
-       $(AM_V_GEN)$(wayland_scanner) code < $< > $@
+protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
+       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
 
-%-server-protocol.h : $(wayland_protocoldir)/%.xml
-       $(AM_V_GEN)$(wayland_scanner) server-header < $< > $@
+protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml
+       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
 
-%-client-protocol.h : $(wayland_protocoldir)/%.xml
-       $(AM_V_GEN)$(wayland_scanner) client-header < $< > $@
+protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml
+       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@