spice Makefile.am setup is a bit confusing, with source file
names being listed several times in different Makefile.am
(generally, once in EXTRA_DIST and another time in another
Makefile.am in _SOURCES). The client binaries are built
by client/x11/Makefile.am, which means recursing into client,
then into x11 to finally build spicec. This Makefile.am is
also referencing files from common/ and client/, which is
a bit unusual with autotools.

This patch attempts to simplify the build process to get
something more usual from an autotools point of view.
The source from common/ are compiled into a libtool convenience
library, which the server and the client links against which avoids
referencing source files from common/ when building the server and
the client. The client is built in client/Makefile.am and directly
builds files from x11/ windows/ and gui/ if needed (without
recursing in these subdirectories).

This makes the build simpler to understand, and also makes it
possible to list source files once, which avoids potential
make distcheck breakage when adding new files.

There is a regression in this patch with respect to
sw_canvas/gl_canvas/gdi_canvas. They should be built with
different preprocessor #defines resulting in different behaviour
of the canvas for the client and the server. However, this is not
currently the case, both the client and the server will use the same
code for now (which probably means one of them is broken). This will
be fixed in a subsequent commit.

make distcheck passes, but compilation on windows using the
autotools build system hasn't been tested, which means it's likely
to be broken. It shouldn't be too hard ot fix it though, just let
me know of any issues with this.
---
 client/Makefile.am            |  342 ++++++++++++++++++++++++++++-------------
 client/windows/Makefile.am    |  236 ----------------------------
 client/x11/Makefile.am        |  223 ---------------------------
 client/x11/images/Makefile.am |    5 -
 common/Makefile.am            |   87 +++++++----
 configure.ac                  |    7 +-
 server/Makefile.am            |  131 ++++++----------
 server/tests/Makefile.am      |   25 +--
 8 files changed, 350 insertions(+), 706 deletions(-)
 delete mode 100644 client/windows/Makefile.am
 delete mode 100644 client/x11/Makefile.am
 delete mode 100644 client/x11/images/Makefile.am

diff --git a/client/Makefile.am b/client/Makefile.am
index bbea61f..627bd8a 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,9 +1,13 @@
 NULL =
 
-SUBDIRS = . $(red_target) gui
-DIST_SUBDIRS = x11 windows gui
+bin_PROGRAMS = spicec
 
-spice_built_sources = generated_demarshallers.cpp generated_marshallers.cpp 
generated_demarshallers1.cpp generated_marshallers1.cpp
+BUILT_SOURCES =                        \
+       generated_demarshallers.cpp     \
+       generated_marshallers.cpp       \
+       generated_demarshallers1.cpp    \
+       generated_marshallers1.cpp      \
+       $(NULL)
 
 generated_demarshallers.cpp: $(top_srcdir)/spice.proto
        $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py 
--generate-demarshallers --client --include common.h --include messages.h 
$(top_srcdir)/spice.proto generated_demarshallers.cpp
@@ -17,119 +21,243 @@ generated_marshallers.cpp: $(top_srcdir)/spice.proto
 generated_marshallers1.cpp: $(top_srcdir)/spice1.proto
        $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py 
--generate-marshallers -P  --include "common.h" --include messages.h --include 
marshallers.h --client --prefix 1 --ptrsize 8 $(top_srcdir)/spice1.proto 
generated_marshallers1.cpp
 
-if SUPPORT_GL
-GL_SRCS =                              \
-       red_gl_canvas.cpp               \
-       red_gl_canvas.h                 \
-       red_pixmap_gl.h
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+
+spicec_SOURCES =               \
+       application.cpp         \
+       application.h           \
+       audio_channels.h        \
+       audio_devices.h         \
+       cache.hpp               \
+       canvas.cpp              \
+       canvas.h                \
+       client_net_socket.cpp   \
+       client_net_socket.h     \
+       cmd_line_parser.cpp     \
+       cmd_line_parser.h       \
+       common.h                \
+       controller.cpp          \
+       controller.h            \
+       cursor.cpp              \
+       cursor.h                \
+       cursor_channel.cpp      \
+       cursor_channel.h        \
+       debug.h                 \
+       demarshallers.h         \
+       display_channel.cpp     \
+       display_channel.h       \
+       event_sources.h         \
+       foreign_menu.cpp        \
+       foreign_menu.h          \
+       glz_decoded_image.h     \
+       glz_decoder.cpp         \
+       glz_decoder.h           \
+       glz_decoder_config.h    \
+       glz_decoder_window.cpp  \
+       glz_decoder_window.h    \
+       hot_keys.cpp            \
+       hot_keys.h              \
+       icon.h                  \
+       inputs_channel.cpp      \
+       inputs_channel.h        \
+       inputs_handler.h        \
+       jpeg_decoder.cpp        \
+       jpeg_decoder.h          \
+       marshallers.h           \
+       menu.cpp                \
+       menu.h                  \
+       mjpeg_decoder.cpp       \
+       mjpeg_decoder.h         \
+       monitor.cpp             \
+       monitor.h               \
+       pixels_source.h         \
+       platform.h              \
+       playback_channel.cpp    \
+       process_loop.cpp        \
+       process_loop.h          \
+       read_write_mutex.h      \
+       record_channel.cpp      \
+       red_channel.cpp         \
+       red_channel.h           \
+       red_client.cpp          \
+       red_client.h            \
+       red_drawable.h          \
+       red_key.h               \
+       red_peer.cpp            \
+       red_peer.h              \
+       red_pixmap.h            \
+       red_pixmap_sw.h         \
+       red_sw_canvas.cpp       \
+       red_sw_canvas.h         \
+       red_types.h             \
+       red_window.h            \
+       screen.cpp              \
+       screen.h                \
+       screen_layer.cpp        \
+       screen_layer.h          \
+       shared_cache.hpp        \
+       threads.cpp             \
+       threads.h               \
+       utils.cpp               \
+       utils.h                 \
+       zlib_decoder.cpp        \
+       zlib_decoder.h          \
+       $(BUILT_SOURCES)        \
+       $(NULL)
+
+if OS_WIN32
+spicec_SOURCES +=                      \
+       red_gdi_canvas.cpp              \
+       red_gdi_canvas.h                \
+       red_pixmap_gdi.h                \
+       windows/atomic_count.h          \
+       windows/event_sources_p.cpp     \
+       windows/main.cpp                \
+       windows/my_getopt.cpp           \
+       windows/named_pipe.cpp          \
+       windows/named_pipe.h            \
+       windows/pixels_source.cpp       \
+       windows/pixels_source_p.h       \
+       windows/platform.cpp            \
+       windows/platform_utils.cpp      \
+       windows/platform_utils.h        \
+       windows/playback.cpp            \
+       windows/playback.h              \
+       windows/record.cpp              \
+       windows/record.h                \
+       windows/red_drawable.cpp        \
+       windows/red_pixmap.cpp          \
+       windows/red_pixmap_gdi.cpp      \
+       windows/red_pixmap_sw.cpp       \
+       windows/red_window.cpp          \
+       windows/red_window_p.h          \
+       windows/resource.h              \
+       windows/stdint.h                \
+       windows/win_platform.h          \
+       $(NULL)
 else
-GL_SRCS =
+spicec_SOURCES +=                      \
+       x11/atomic_count.h              \
+       x11/event_sources_p.cpp         \
+       x11/event_sources_p.h           \
+       x11/main.cpp                    \
+       x11/named_pipe.cpp              \
+       x11/named_pipe.h                \
+       x11/pixels_source.cpp           \
+       x11/pixels_source_p.h           \
+       x11/platform.cpp                \
+       x11/platform_utils.cpp          \
+       x11/platform_utils.h            \
+       x11/playback.cpp                \
+       x11/playback.h                  \
+       x11/record.cpp                  \
+       x11/record.h                    \
+       x11/red_drawable.cpp            \
+       x11/red_pixmap.cpp              \
+       x11/red_pixmap_sw.cpp           \
+       x11/red_window.cpp              \
+       x11/red_window_p.h              \
+       x11/res.cpp                     \
+       x11/res.h                       \
+       x11/resource.h                  \
+       x11/x_icon.cpp                  \
+       x11/x_icon.h                    \
+       x11/x_platform.h                \
+       $(NULL)
 endif
 
-SMARTCARD_SRC_ENABLED = smartcard_channel.cpp smartcard_channel.h
+if SUPPORT_TUNNEL
+spicec_SOURCES +=              \
+       tunnel_channel.cpp      \
+       tunnel_channel.h        \
+       $(NULL)
+endif
 
-if SUPPORT_SMARTCARD
-SMARTCARD_SRCS = $(SMARTCARD_SRC_ENABLED)
-else
-SMARTCARD_SRCS =
+if SUPPORT_GUI
+spicec_SOURCES +=                      \
+       gui/gui.cpp                     \
+       gui/gui.h                       \
+       gui/resource_provider.cpp       \
+       gui/resource_provider.h         \
+       gui/softrenderer.cpp            \
+       gui/softrenderer.h              \
+       gui/softtexture.cpp             \
+       gui/softtexture.h               \
+       $(NULL)
 endif
 
-RED_COMMON_SRCS =                      \
-       application.cpp                 \
-       application.h                   \
-       audio_channels.h                \
-       audio_devices.h                 \
-       cache.hpp                       \
-       canvas.cpp                      \
-       canvas.h                        \
-       red_sw_canvas.cpp               \
-       red_sw_canvas.h                 \
-       client_net_socket.cpp           \
-       client_net_socket.h             \
-       cmd_line_parser.cpp             \
-       cmd_line_parser.h               \
-       common.h                        \
-       demarshallers.h                 \
-       marshallers.h                   \
-       generated_demarshallers.cpp     \
-       generated_demarshallers1.cpp    \
-       generated_marshallers.cpp       \
-       generated_marshallers1.cpp      \
-       controller.cpp                  \
-       controller.h                    \
-       cursor_channel.cpp              \
-       cursor_channel.h                \
-       cursor.cpp                      \
-       cursor.h                        \
-       debug.h                         \
-       display_channel.cpp             \
-       display_channel.h               \
-       foreign_menu.cpp                \
-       foreign_menu.h                  \
-       glz_decoded_image.h             \
-       glz_decoder_config.h            \
-       glz_decoder.cpp                 \
-       glz_decoder.h                   \
-       glz_decoder_window.cpp          \
-       glz_decoder_window.h            \
-       glz_decode_tmpl.c               \
-       inputs_channel.cpp              \
-       inputs_channel.h                \
-       inputs_handler.h                \
-       jpeg_decoder.cpp                \
-       jpeg_decoder.h                  \
-       monitor.cpp                     \
-       monitor.h                       \
-       mem.cpp                         \
-       menu.cpp                        \
-       menu.h                          \
-       mjpeg_decoder.h                 \
-       mjpeg_decoder.cpp               \
-       event_sources.h                 \
-       pixels_source.h                 \
-       platform.h                      \
-       playback_channel.cpp            \
-       process_loop.cpp                \
-       process_loop.h                  \
-       read_write_mutex.h              \
-       record_channel.cpp              \
-       red_channel.cpp                 \
-       red_channel.h                   \
-       red_client.cpp                  \
-       red_client.h                    \
-       red_drawable.h                  \
-       red_key.h                       \
-       red_peer.cpp                    \
-       red_peer.h                      \
-       red_pixmap_sw.h                 \
-       red_pixmap.h                    \
-       red_types.h                     \
-       red_window.h                    \
-       screen.cpp                      \
-       screen.h                        \
-       screen_layer.cpp                \
-       screen_layer.h                  \
-       shared_cache.hpp                \
-       tunnel_channel.cpp              \
-       tunnel_channel.h                \
-       hot_keys.cpp                    \
-       hot_keys.h                      \
-       threads.cpp                     \
-       threads.h                       \
-       utils.cpp                       \
-       utils.h                         \
-       zlib_decoder.cpp                \
-       zlib_decoder.h                  \
+if SUPPORT_GL
+spicec_SOURCES +=              \
+       red_gl_canvas.cpp       \
+       red_gl_canvas.h         \
+       red_pixmap_gl.h         \
        $(NULL)
 
-GDI_FILES =                            \
-       red_gdi_canvas.cpp              \
-       red_gdi_canvas.h                \
-       red_pixmap_gdi.h                \
+if !OS_WIN32
+spicec_SOURCES += x11/red_pixmap_gl.cpp
+endif
+
+endif
+
+if SUPPORT_SMARTCARD
+spicec_SOURCES +=              \
+       smartcard_channel.cpp   \
+       smartcard_channel.h     \
+       $(NULL)
+endif
+
+
+INCLUDES = \
+       -DSW_CANVAS_CACHE                               \
+       -D__STDC_LIMIT_MACROS                           \
+       -I$(top_srcdir)/client/x11                      \
+       -I$(top_srcdir)/common                          \
+       $(ALSA_CFLAGS)                                  \
+       $(CEGUI_CFLAGS)                                 \
+       $(CEGUI06_CFLAGS)                               \
+       $(CELT051_CFLAGS)                               \
+       $(GL_CFLAGS)                                    \
+       $(MISC_X_CFLAGS)                                \
+       $(PIXMAN_CFLAGS)                                \
+       $(PROTOCOL_CFLAGS)                              \
+       $(SPICE_NONPKGCONFIG_CFLAGS)                    \
+       $(SMARTCARD_CFLAGS)                             \
+       $(SSL_CFLAGS)                                   \
+       $(XRANDR_CFLAGS)                                \
+       $(XFIXES_CFLAGS)                                \
+       $(WARN_CFLAGS)                                  \
        $(NULL)
 
-MAINTAINERCLEANFILES = $(spice_built_sources)
+spicec_LDFLAGS = $(SPICEC_STATIC_LINKAGE_BSTATIC)
 
-EXTRA_DIST = $(RED_COMMON_SRCS) $(spice_built_sources) $(GL_SRCS) $(GDI_FILES) 
$(SMARTCARD_SRC_ENABLED)
+spicec_LDADD =                                         \
+       $(top_builddir)/common/libspice-common.la       \
+       $(ALSA_LIBS)                                    \
+       $(CEGUI_LIBS)                                   \
+       $(CEGUI06_LIBS)                                 \
+       $(CELT051_LIBS)                                 \
+       $(GL_LIBS)                                      \
+       $(JPEG_LIBS)                                    \
+       $(MISC_X_LIBS)                                  \
+       $(PIXMAN_LIBS)                                  \
+       $(SMARTCARD_LIBS)                               \
+       $(SPICE_NONPKGCONFIG_LIBS)                      \
+       $(SSL_LIBS)                                     \
+       $(XFIXES_LIBS)                                  \
+       $(XRANDR_LIBS)                                  \
+       $(Z_LIBS)                                       \
+       $(NULL)
 
-BUILT_SOURCES = $(spice_built_sources)
+EXTRA_DIST =                           \
+       glz_decode_tmpl.c               \
+       x11/images/red_icon.c           \
+       x11/images/alt_image.c          \
+       gui/commonv2c.ttf.c             \
+       gui/commonwealth-10.font.c      \
+       gui/dejavu_sans-10.font.c       \
+       gui/dejavu_sans.ttf.c           \
+       gui/taharez_look.imageset.c     \
+       gui/taharez_look.looknfeel.c    \
+       gui/taharez_look.scheme.c       \
+       gui/taharez_look.tga.c          \
+       $(NULL)
diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
deleted file mode 100644
index eae0bbe..0000000
--- a/client/windows/Makefile.am
+++ /dev/null
@@ -1,236 +0,0 @@
-NULL =
-
-COMMON_DIR=$(SPICE_COMMON_SRCDIR)
-CLIENT_DIR=$(top_srcdir)/client
-
-INCLUDES = \
-       -DSW_CANVAS_CACHE                               \
-       -DSW_CANVAS_NO_CHUNKS                           \
-       -DUSE_GLZ                                       \
-       -D__STDC_LIMIT_MACROS                           \
-       -I.                                             \
-       -I..                                            \
-       -I$(COMMON_DIR)                                 \
-       -I$(COMMON_DIR)/win                             \
-       -I$(CLIENT_DIR)                                 \
-       $(PROTOCOL_CFLAGS)                              \
-       $(GL_CFLAGS)                                    \
-       $(PIXMAN_CFLAGS)                                \
-       $(CELT051_CFLAGS)                               \
-       $(SSL_CFLAGS)                                   \
-       $(CEGUI_CFLAGS)                                 \
-       $(WARN_CFLAGS)                                  \
-       $(SPICE_NONPKGCONFIG_CFLAGS)                    \
-       $(CXIMAGE_CFLAGS)               \
-       $(NULL)
-
-
-RED_COMMON_SRCS =                                      \
-       $(CLIENT_DIR)/application.cpp                   \
-       $(CLIENT_DIR)/application.h                     \
-       $(CLIENT_DIR)/audio_channels.h                  \
-       $(CLIENT_DIR)/audio_devices.h                   \
-       $(CLIENT_DIR)/cache.hpp                         \
-       $(CLIENT_DIR)/demarshallers.h                   \
-       $(CLIENT_DIR)/generated_demarshallers.cpp       \
-       $(CLIENT_DIR)/generated_demarshallers1.cpp      \
-       $(COMMON_DIR)/marshaller.c                      \
-       $(CLIENT_DIR)/marshallers.h                     \
-       $(CLIENT_DIR)/generated_marshallers.cpp         \
-       $(CLIENT_DIR)/generated_marshallers1.cpp        \
-       $(COMMON_DIR)/sw_canvas.c                       \
-       $(CLIENT_DIR)/canvas.cpp                        \
-       $(COMMON_DIR)/gdi_canvas.c                      \
-       $(CLIENT_DIR)/canvas.h                          \
-       $(COMMON_DIR)/canvas_utils.c                    \
-       $(CLIENT_DIR)/red_sw_canvas.cpp                 \
-       $(CLIENT_DIR)/red_sw_canvas.h                   \
-       $(CLIENT_DIR)/cmd_line_parser.cpp               \
-       $(CLIENT_DIR)/cmd_line_parser.h                 \
-       $(CLIENT_DIR)/client_net_socket.cpp             \
-       $(CLIENT_DIR)/client_net_socket.h               \
-       $(CLIENT_DIR)/common.h                          \
-       $(CLIENT_DIR)/controller.cpp                    \
-       $(CLIENT_DIR)/controller.h                      \
-       $(CLIENT_DIR)/cursor_channel.cpp                \
-       $(CLIENT_DIR)/cursor_channel.h                  \
-       $(CLIENT_DIR)/cursor.cpp                        \
-       $(CLIENT_DIR)/cursor.h                          \
-       $(CLIENT_DIR)/debug.h                           \
-       $(CLIENT_DIR)/display_channel.cpp               \
-       $(CLIENT_DIR)/display_channel.h                 \
-       $(CLIENT_DIR)/foreign_menu.cpp                  \
-       $(CLIENT_DIR)/foreign_menu.h                    \
-       $(CLIENT_DIR)/glz_decoded_image.h               \
-       $(CLIENT_DIR)/glz_decoder_config.h              \
-       $(CLIENT_DIR)/glz_decoder.cpp                   \
-       $(CLIENT_DIR)/glz_decoder.h                     \
-       $(CLIENT_DIR)/glz_decoder_window.cpp            \
-       $(CLIENT_DIR)/glz_decoder_window.h              \
-       $(CLIENT_DIR)/inputs_channel.cpp                \
-       $(CLIENT_DIR)/inputs_channel.h                  \
-       $(CLIENT_DIR)/inputs_handler.h                  \
-       $(CLIENT_DIR)/jpeg_decoder.cpp                  \
-       $(CLIENT_DIR)/jpeg_decoder.h                    \
-       $(COMMON_DIR)/lz.c                              \
-       $(COMMON_DIR)/lines.c                           \
-       $(CLIENT_DIR)/monitor.cpp                       \
-       $(CLIENT_DIR)/monitor.h                         \
-       $(COMMON_DIR)/mem.c                             \
-       $(CLIENT_DIR)/menu.cpp                          \
-       $(CLIENT_DIR)/menu.h                            \
-       $(CLIENT_DIR)/mjpeg_decoder.h                   \
-       $(CLIENT_DIR)/mjpeg_decoder.cpp                 \
-       $(CLIENT_DIR)/pixels_source.h                   \
-       $(COMMON_DIR)/pixman_utils.c                    \
-       $(CLIENT_DIR)/platform.h                        \
-       $(CLIENT_DIR)/playback_channel.cpp              \
-       $(CLIENT_DIR)/process_loop.cpp                  \
-       $(COMMON_DIR)/quic.c                            \
-       $(CLIENT_DIR)/record_channel.cpp                \
-       $(CLIENT_DIR)/red_channel.cpp                   \
-       $(CLIENT_DIR)/red_channel.h                     \
-       $(CLIENT_DIR)/red_client.cpp                    \
-       $(CLIENT_DIR)/red_client.h                      \
-       $(CLIENT_DIR)/red_drawable.h                    \
-       $(CLIENT_DIR)/red_key.h                         \
-       $(CLIENT_DIR)/red_peer.cpp                      \
-       $(CLIENT_DIR)/red_gdi_canvas.cpp                \
-       $(CLIENT_DIR)/red_peer.h                        \
-       $(CLIENT_DIR)/red_pixmap_sw.h                   \
-       $(CLIENT_DIR)/red_pixmap.h                      \
-       $(CLIENT_DIR)/red_types.h                       \
-       $(CLIENT_DIR)/red_window.h                      \
-       $(COMMON_DIR)/region.c                          \
-       $(COMMON_DIR)/rop3.c                            \
-       $(CLIENT_DIR)/screen.cpp                        \
-       $(CLIENT_DIR)/screen.h                          \
-       $(CLIENT_DIR)/screen_layer.cpp                  \
-       $(CLIENT_DIR)/screen_layer.h                    \
-       $(CLIENT_DIR)/shared_cache.hpp                  \
-       $(CLIENT_DIR)/hot_keys.cpp                      \
-       $(CLIENT_DIR)/hot_keys.h                        \
-       $(CLIENT_DIR)/threads.cpp                       \
-       $(CLIENT_DIR)/tunnel_channel.cpp                \
-       $(CLIENT_DIR)/tunnel_channel.h                  \
-       $(CLIENT_DIR)/utils.cpp                         \
-       $(CLIENT_DIR)/utils.h                           \
-       $(CLIENT_DIR)/zlib_decoder.cpp                  \
-       $(CLIENT_DIR)/zlib_decoder.h                    \
-       $(CLIENT_DIR)/icon.h                            \
-       $(NULL)
-
-if SUPPORT_GUI
-RED_GUI_SRCS =                                         \
-       $(CLIENT_DIR)/gui/softrenderer.h                \
-       $(CLIENT_DIR)/gui/softrenderer.cpp              \
-       $(CLIENT_DIR)/gui/softtexture.h                 \
-       $(CLIENT_DIR)/gui/softtexture.cpp               \
-       $(CLIENT_DIR)/gui/resource_provider.h           \
-       $(CLIENT_DIR)/gui/resource_provider.cpp         \
-       $(CLIENT_DIR)/gui/gui.h                         \
-       $(CLIENT_DIR)/gui/gui.cpp
-else
-RED_GUI_SRCS =
-endif
-
-
-if SUPPORT_GL
-RED_OGL_SRCS =                                         \
-       $(COMMON_DIR)/gl_canvas.c                       \
-       $(COMMON_DIR)/glc.c                             \
-       $(CLIENT_DIR)/red_gl_canvas.cpp                 \
-       $(CLIENT_DIR)/red_gl_canvas.h                   \
-       $(CLIENT_DIR)/red_pixmap_gl.h
-else
-RED_OGL_SRCS =
-endif
-
-bin_PROGRAMS = spicec
-
-spicec_SOURCES =                       \
-       atomic_count.h                  \
-       event_sources_p.cpp             \
-       main.cpp                        \
-       my_getopt.cpp                   \
-       named_pipe.h                    \
-       named_pipe.cpp                  \
-       pixels_source.cpp               \
-       pixels_source_p.h               \
-       platform.cpp                    \
-       platform_utils.h                \
-       platform_utils.cpp              \
-       playback.cpp                    \
-       playback.h                      \
-       record.cpp                      \
-       record.h                        \
-       red_drawable.cpp                \
-       red_pixmap.cpp                  \
-       red_pixmap_gdi.cpp              \
-       red_pixmap_sw.cpp               \
-       red_window.cpp                  \
-       red_window_p.h                  \
-       resource.h                      \
-       stdint.h                        \
-       win_platform.h                  \
-       $(RED_COMMON_SRCS)              \
-       $(RED_GUI_SRCS)                 \
-       $(RED_OGL_SRCS)                 \
-       $(NULL)
-
-spicec_LDFLAGS = \
-       $(SPICEC_STATIC_LINKAGE_BSTATIC)                \
-       $(CELT051_LIBS)                                 \
-       $(SSL_LIBS)                                     \
-       $(CEGUI_LIBS)                                   \
-       $(JPEG_LIBS)                                    \
-       $(Z_LIBS)                                       \
-       $(SPICE_NONPKGCONFIG_LIBS)
-
-spicec_LDADD =                                         \
-       redc.res                                        \
-       $(PIXMAN_LIBS)                                  \
-       $(GL_LIBS)                                      \
-       $(CEGUI_LIBS)
-
-spicec_DEPENDENCIES = redc.res
-
-redc.res: redc.rc
-       $(WINDRES) -J rc -i $< -O coff -o $@
-
-EXTRA_DIST = \
-       atomic_count.h          \
-       event_sources_p.cpp     \
-       event_sources_p.h       \
-       generate1.bat           \
-       generate.bat            \
-       main.cpp                \
-       my_getopt.cpp           \
-       named_pipe.cpp          \
-       named_pipe.h            \
-       pixels_source.cpp       \
-       pixels_source_p.h       \
-       platform.cpp            \
-       platform_utils.cpp      \
-       platform_utils.h        \
-       playback.cpp            \
-       playback.h              \
-       record.cpp              \
-       record.h                \
-       redc.rc                 \
-       redc.sln                \
-       redc.vcproj             \
-       red_drawable.cpp        \
-       red_pixmap.cpp          \
-       red_pixmap_gdi.cpp      \
-       red_pixmap_sw.cpp       \
-       red_window.cpp          \
-       red_window_p.h          \
-       resource.h              \
-       spicec.exe.manifest     \
-       spice.ico               \
-       stdint.h                \
-       sticky_alt.bmp          \
-       win_platform.h          \
-        $(NULL)
-
diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am
deleted file mode 100644
index 54d05ce..0000000
--- a/client/x11/Makefile.am
+++ /dev/null
@@ -1,223 +0,0 @@
-NULL =
-
-COMMON_DIR=$(SPICE_COMMON_SRCDIR)
-CLIENT_DIR=$(top_srcdir)/client
-
-SUBDIRS = images
-
-INCLUDES = \
-       -DSW_CANVAS_CACHE                               \
-       -DSW_CANVAS_NO_CHUNKS                           \
-       -DUSE_GLZ                                       \
-       -D__STDC_LIMIT_MACROS                           \
-       -I.                                             \
-       -I..                                            \
-       -I$(COMMON_DIR)                                 \
-       -I$(COMMON_DIR)/linux                           \
-       -I$(CLIENT_DIR)                                 \
-       $(PROTOCOL_CFLAGS)                              \
-       $(GL_CFLAGS)                                    \
-       $(ALSA_CFLAGS)                                  \
-       $(PIXMAN_CFLAGS)                                \
-       $(CELT051_CFLAGS)                               \
-       $(SSL_CFLAGS)                                   \
-       $(XRANDR_CFLAGS)                                \
-       $(XFIXES_CFLAGS)                                \
-       $(MISC_X_CFLAGS)                                \
-       $(CEGUI_CFLAGS)                                 \
-       $(CEGUI06_CFLAGS)                                       \
-       $(WARN_CFLAGS)                                  \
-       $(SPICE_NONPKGCONFIG_CFLAGS)                    \
-       $(SMARTCARD_CFLAGS)                             \
-       $(NULL)
-
-
-RED_COMMON_SRCS =                                      \
-       $(CLIENT_DIR)/application.cpp                   \
-       $(CLIENT_DIR)/application.h                     \
-       $(CLIENT_DIR)/audio_channels.h                  \
-       $(CLIENT_DIR)/audio_devices.h                   \
-       $(CLIENT_DIR)/cache.hpp                         \
-       $(CLIENT_DIR)/demarshallers.h                   \
-       $(CLIENT_DIR)/generated_demarshallers.cpp       \
-       $(CLIENT_DIR)/generated_demarshallers1.cpp      \
-       $(COMMON_DIR)/marshaller.c                      \
-       $(CLIENT_DIR)/marshallers.h                     \
-       $(CLIENT_DIR)/generated_marshallers.cpp         \
-       $(CLIENT_DIR)/generated_marshallers1.cpp        \
-       $(COMMON_DIR)/sw_canvas.c                       \
-       $(CLIENT_DIR)/canvas.cpp                        \
-       $(CLIENT_DIR)/canvas.h                          \
-       $(COMMON_DIR)/canvas_utils.c                    \
-       $(CLIENT_DIR)/red_sw_canvas.cpp                 \
-       $(CLIENT_DIR)/red_sw_canvas.h                   \
-       $(CLIENT_DIR)/cmd_line_parser.cpp               \
-       $(CLIENT_DIR)/cmd_line_parser.h                 \
-       $(CLIENT_DIR)/client_net_socket.cpp             \
-       $(CLIENT_DIR)/client_net_socket.h               \
-       $(CLIENT_DIR)/common.h                          \
-       $(CLIENT_DIR)/controller.cpp                    \
-       $(CLIENT_DIR)/controller.h                      \
-       $(CLIENT_DIR)/cursor_channel.cpp                \
-       $(CLIENT_DIR)/cursor_channel.h                  \
-       $(CLIENT_DIR)/cursor.cpp                        \
-       $(CLIENT_DIR)/cursor.h                          \
-       $(CLIENT_DIR)/debug.h                           \
-       $(CLIENT_DIR)/display_channel.cpp               \
-       $(CLIENT_DIR)/display_channel.h                 \
-       $(CLIENT_DIR)/foreign_menu.cpp                  \
-       $(CLIENT_DIR)/foreign_menu.h                    \
-       $(CLIENT_DIR)/glz_decoded_image.h               \
-       $(CLIENT_DIR)/glz_decoder_config.h              \
-       $(CLIENT_DIR)/glz_decoder.cpp                   \
-       $(CLIENT_DIR)/glz_decoder.h                     \
-       $(CLIENT_DIR)/glz_decoder_window.cpp            \
-       $(CLIENT_DIR)/glz_decoder_window.h              \
-       $(CLIENT_DIR)/inputs_channel.cpp                \
-       $(CLIENT_DIR)/inputs_channel.h                  \
-       $(CLIENT_DIR)/inputs_handler.h                  \
-       $(CLIENT_DIR)/jpeg_decoder.cpp                  \
-       $(CLIENT_DIR)/jpeg_decoder.h                    \
-       $(COMMON_DIR)/lz.c                              \
-       $(COMMON_DIR)/lines.c                           \
-       $(CLIENT_DIR)/monitor.cpp                       \
-       $(CLIENT_DIR)/monitor.h                         \
-       $(COMMON_DIR)/mem.c                             \
-       $(CLIENT_DIR)/menu.cpp                          \
-       $(CLIENT_DIR)/menu.h                            \
-       $(CLIENT_DIR)/mjpeg_decoder.h                   \
-       $(CLIENT_DIR)/mjpeg_decoder.cpp                 \
-       $(CLIENT_DIR)/pixels_source.h                   \
-       $(COMMON_DIR)/pixman_utils.c                    \
-       $(CLIENT_DIR)/platform.h                        \
-       $(CLIENT_DIR)/playback_channel.cpp              \
-       $(CLIENT_DIR)/process_loop.cpp                  \
-       $(COMMON_DIR)/quic.c                            \
-       $(CLIENT_DIR)/record_channel.cpp                \
-       $(CLIENT_DIR)/red_channel.cpp                   \
-       $(CLIENT_DIR)/red_channel.h                     \
-       $(CLIENT_DIR)/red_client.cpp                    \
-       $(CLIENT_DIR)/red_client.h                      \
-       $(CLIENT_DIR)/red_drawable.h                    \
-       $(CLIENT_DIR)/red_key.h                         \
-       $(CLIENT_DIR)/red_peer.cpp                      \
-       $(CLIENT_DIR)/red_peer.h                        \
-       $(CLIENT_DIR)/red_pixmap_sw.h                   \
-       $(CLIENT_DIR)/red_pixmap.h                      \
-       $(CLIENT_DIR)/red_types.h                       \
-       $(CLIENT_DIR)/red_window.h                      \
-       $(COMMON_DIR)/region.c                          \
-       $(COMMON_DIR)/rop3.c                            \
-       $(CLIENT_DIR)/screen.cpp                        \
-       $(CLIENT_DIR)/screen.h                          \
-       $(CLIENT_DIR)/screen_layer.cpp                  \
-       $(CLIENT_DIR)/screen_layer.h                    \
-       $(CLIENT_DIR)/shared_cache.hpp                  \
-       $(CLIENT_DIR)/hot_keys.cpp                      \
-       $(CLIENT_DIR)/hot_keys.h                        \
-       $(CLIENT_DIR)/threads.cpp                       \
-       $(CLIENT_DIR)/utils.cpp                         \
-       $(CLIENT_DIR)/utils.h                           \
-       $(CLIENT_DIR)/zlib_decoder.cpp                  \
-       $(CLIENT_DIR)/zlib_decoder.h                    \
-       $(CLIENT_DIR)/icon.h                            \
-       $(NULL)
-
-if SUPPORT_TUNNEL
-RED_TUNNEL_SRCS =                                      \
-       $(CLIENT_DIR)/tunnel_channel.cpp                \
-       $(CLIENT_DIR)/tunnel_channel.h                  \
-       $(NULL)
-else
-RED_TUNNEL_SRCS =
-endif
-
-if SUPPORT_GUI
-RED_GUI_SRCS =                                         \
-       $(CLIENT_DIR)/gui/softrenderer.h                \
-       $(CLIENT_DIR)/gui/softrenderer.cpp              \
-       $(CLIENT_DIR)/gui/softtexture.h                 \
-       $(CLIENT_DIR)/gui/softtexture.cpp               \
-       $(CLIENT_DIR)/gui/resource_provider.h           \
-       $(CLIENT_DIR)/gui/resource_provider.cpp         \
-       $(CLIENT_DIR)/gui/gui.h                         \
-       $(CLIENT_DIR)/gui/gui.cpp                       \
-       $(NULL)
-else
-RED_GUI_SRCS =
-endif
-
-
-if SUPPORT_GL
-RED_OGL_SRCS =                                         \
-       $(COMMON_DIR)/gl_canvas.c                       \
-       $(COMMON_DIR)/glc.c                             \
-       $(CLIENT_DIR)/red_gl_canvas.cpp                 \
-       $(CLIENT_DIR)/red_gl_canvas.h                   \
-       $(CLIENT_DIR)/red_pixmap_gl.h                   \
-       red_pixmap_gl.cpp
-else
-RED_OGL_SRCS =
-endif
-
-if SUPPORT_SMARTCARD
-RED_SCARD_SRCS = $(CLIENT_DIR)/smartcard_channel.cpp
-else
-RED_SCARD_SRCS =
-endif
-
-bin_PROGRAMS = spicec
-
-spicec_SOURCES =                       \
-       atomic_count.h                  \
-       event_sources_p.cpp             \
-       event_sources_p.h               \
-       main.cpp                        \
-       named_pipe.h                    \
-       named_pipe.cpp                  \
-       pixels_source.cpp               \
-       pixels_source_p.h               \
-       platform.cpp                    \
-       platform_utils.h                \
-       platform_utils.cpp              \
-       playback.cpp                    \
-       playback.h                      \
-       record.cpp                      \
-       record.h                        \
-       red_drawable.cpp                \
-       red_pixmap.cpp                  \
-       red_pixmap_sw.cpp               \
-       red_window.cpp                  \
-       red_window_p.h                  \
-       res.cpp                         \
-       res.h                           \
-       resource.h                      \
-       x_icon.cpp                      \
-       x_icon.h                        \
-       x_platform.h                    \
-       $(RED_COMMON_SRCS)              \
-       $(RED_GUI_SRCS)                 \
-       $(RED_TUNNEL_SRCS)              \
-       $(RED_OGL_SRCS)                 \
-       $(RED_SCARD_SRCS)               \
-       $(NULL)
-
-spicec_LDFLAGS = \
-       $(SPICEC_STATIC_LINKAGE_BSTATIC)                \
-       $(CELT051_LIBS)                                 \
-       $(SSL_LIBS)                                     \
-       $(CEGUI_LIBS)                                   \
-       $(CEGUI06_LIBS)                                 \
-       $(JPEG_LIBS)                                    \
-       $(Z_LIBS)                                       \
-       $(SMARTCARD_LIBS)                               \
-       $(SPICE_NONPKGCONFIG_LIBS)
-
-spicec_LDADD =                                         \
-       $(PIXMAN_LIBS)                                  \
-       $(ALSA_LIBS)                                    \
-       $(GL_LIBS)                                      \
-       $(XRANDR_LIBS)                                  \
-       $(XFIXES_LIBS)                                  \
-       $(MISC_X_LIBS)                                  \
-       $(CEGUI_LIBS)
diff --git a/client/x11/images/Makefile.am b/client/x11/images/Makefile.am
deleted file mode 100644
index 9012158..0000000
--- a/client/x11/images/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-EXTRA_DIST = \
-        red_icon.c                                      \
-        alt_image.c                                     \
-        $(NULL)
-
diff --git a/common/Makefile.am b/common/Makefile.am
index 407de1d..0a2f9c1 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,53 +1,78 @@
+if OS_WIN32
 SUBDIRS = win
+endif
 
 NULL =
 
-COMMON_SRCS =                          \
-       sw_canvas.h                     \
-       sw_canvas.c                     \
-       pixman_utils.h                  \
-       pixman_utils.c                  \
+noinst_LTLIBRARIES = libspice-common.la
+libspice_common_la_SOURCES =           \
        canvas_base.h                   \
-       canvas_base.c                   \
-       canvas_utils.h                  \
        canvas_utils.c                  \
+       canvas_utils.h                  \
        draw.h                          \
-       gdi_canvas.h                    \
-       gdi_canvas.c                    \
-       gl_canvas.h                     \
-       gl_canvas.c                     \
-       glc.h                           \
-       glc.c                           \
-       gl_utils.h                      \
+       lines.c                         \
+       lines.h                         \
+       lz.c                            \
+       lz.h                            \
        lz_common.h                     \
+       lz_config.h                     \
+       marshaller.c                    \
+       marshaller.h                    \
+       mem.c                           \
+       mem.h                           \
+       messages.h                      \
        mutex.h                         \
-       ogl_ctx.h                       \
-       ogl_ctx.c                       \
-       quic.h                          \
+       pixman_utils.c                  \
+       pixman_utils.h                  \
        quic.c                          \
+       quic.h                          \
        quic_config.h                   \
        rect.h                          \
-       region.h                        \
        region.c                        \
+       region.h                        \
        ring.h                          \
-       rop3.h                          \
        rop3.c                          \
-       lines.h                         \
-       lines.c                         \
-       lz.c                            \
+       rop3.h                          \
+       spice_common.h                  \
+       sw_canvas.c                     \
+       sw_canvas.h                     \
+       $(NULL)
+
+if OS_WIN32
+libspice_common_la_SOURCES +=          \
+       gdi_canvas.h                    \
+       gdi_canvas.c                    \
+       $(NULL)
+endif
+
+if SUPPORT_GL
+libspice_common_la_SOURCES +=          \
+       gl_canvas.h                     \
+       gl_canvas.c                     \
+       gl_utils.h                      \
+       glc.h                           \
+       glc.c                           \
+       ogl_ctx.h                       \
+       ogl_ctx.c                       \
+       $(NULL)
+endif
+
+INCLUDES = \
+       -DSW_CANVAS_IMAGE_CACHE         \
+       $(GL_CFLAGS)                    \
+       $(PIXMAN_CFLAGS)                \
+       $(PROTOCOL_CFLAGS)              \
+       $(VISIBILITY_HIDDEN_CFLAGS)     \
+       $(WARN_CFLAGS)                  \
+       -std=gnu99                      \
+       $(NULL)
+
+EXTRA_DIST =                           \
+       canvas_base.c                   \
        lz_compress_tmpl.c              \
-       lz_config.h                     \
        lz_decompress_tmpl.c            \
-       lz.h                            \
-       marshaller.h                    \
-       marshaller.c                    \
-       messages.h                      \
-       mem.h                           \
-       mem.c                           \
        quic_family_tmpl.c              \
        quic_rgb_tmpl.c                 \
        quic_tmpl.c                     \
        $(NULL)
 
-EXTRA_DIST = $(COMMON_SRCS)
-
diff --git a/configure.ac b/configure.ac
index a972470..92957fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_AUX_DIR(.)
 
-AM_INIT_AUTOMAKE([dist-bzip2])
+AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
 AM_MAINTAINER_MODE
 
 # Define default SPICE_COMMON_SRCDIR
@@ -85,7 +85,6 @@ if test "$platform_win32" = yes; then
 else
   red_target=x11
 fi
-AC_SUBST(red_target)
 
 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
@@ -507,10 +506,6 @@ python_modules/Makefile
 server/Makefile
 server/tests/Makefile
 client/Makefile
-client/x11/Makefile
-client/x11/images/Makefile
-client/gui/Makefile
-client/windows/Makefile
 ])
 
 dnl ==========================================================================
diff --git a/server/Makefile.am b/server/Makefile.am
index 37ff183..73a886f 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -3,23 +3,21 @@ SUBDIRS = . tests
 NULL =
 
 INCLUDES = \
-       -I.                                     \
+       -I$(top_srcdir)                         \
        -I$(top_srcdir)/common                  \
-       -I$(top_srcdir)/common/linux    \
-       $(PROTOCOL_CFLAGS)                      \
-       $(JPEG_CFLAGS)                          \
+       -DRED_STATISTICS                        \
+       -DSW_CANVAS_IMAGE_CACHE                 \
+       $(Z_LIBS)                               \
+       $(CELT051_CFLAGS)                       \
        $(PIXMAN_CFLAGS)                        \
-       $(GL_CFLAGS)                            \
-       $(SSL_CFLAGS)                           \
+       $(PROTOCOL_CFLAGS)                      \
        $(SASL_CFLAGS)                          \
-       $(CELT051_CFLAGS)                       \
        $(SLIRP_CFLAGS)                         \
-       -DSW_CANVAS_IMAGE_CACHE                 \
-       -DRED_STATISTICS                        \
-       $(WARN_CFLAGS)                          \
+       $(SMARTCARD_CFLAGS)                     \
+       $(SSL_CFLAGS)                           \
        $(VISIBILITY_HIDDEN_CFLAGS)             \
-       $(SMARTCARD_CFLAGS)                             \
-       -std=gnu99 \
+       $(WARN_CFLAGS)                          \
+       -std=gnu99                              \
        $(NULL)
 
 spice_built_sources = generated_marshallers.c generated_marshallers.h 
generated_demarshallers.c
@@ -34,29 +32,6 @@ generated_marshallers.c: $(top_srcdir)/spice.proto
 generated_marshallers.h: $(top_srcdir)/spice.proto
        $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py 
--generate-marshallers $(STRUCTS) --server -H $(top_srcdir)/spice.proto 
generated_marshallers.h
 
-if SUPPORT_GL
-GL_SRCS =                              \
-       $(top_srcdir)/common/gl_canvas.c                \
-       $(top_srcdir)/common/glc.c                      \
-       $(top_srcdir)/common/ogl_ctx.c                  \
-       $(NULL)
-else
-GL_SRCS =
-endif
-
-COMMON_SRCS =                                          \
-       $(top_srcdir)/common/sw_canvas.c                \
-       $(top_srcdir)/common/pixman_utils.c             \
-       $(top_srcdir)/common/lines.c                    \
-       $(top_srcdir)/common/region.c                   \
-       $(top_srcdir)/common/rop3.c                     \
-       $(top_srcdir)/common/quic.c                     \
-       $(top_srcdir)/common/lz.c                       \
-       $(top_srcdir)/common/canvas_utils.c             \
-       $(top_srcdir)/common/mem.c                      \
-       $(top_srcdir)/common/marshaller.c               \
-       $(NULL)
-
 lib_LTLIBRARIES = libspice-server.la
 
 libspice_server_la_LDFLAGS =                   \
@@ -64,51 +39,43 @@ libspice_server_la_LDFLAGS =                        \
        -no-undefined                           \
        $(NULL)
 
-libspice_server_la_LIBADD =                    \
-       $(GL_LIBS)                              \
-       $(JPEG_LIBS)                            \
-       $(PIXMAN_LIBS)                          \
-       $(SSL_LIBS)                             \
-       $(SASL_LIBS)                            \
-       $(CELT051_LIBS)                         \
-       $(SLIRP_LIBS)                           \
-       $(LIBRT)                                \
-       $(Z_LIBS)                               \
+libspice_server_la_LIBADD =                            \
+       $(top_builddir)/common/libspice-common.la       \
+       $(CELT051_LIBS)                                 \
+       $(GL_LIBS)                                      \
+       $(JPEG_LIBS)                                    \
+       $(LIBRT)                                        \
+       $(PIXMAN_LIBS)                                  \
+       $(SASL_LIBS)                                    \
+       $(SLIRP_LIBS)                                   \
+       $(SSL_LIBS)                                     \
        $(NULL)
 
-if SUPPORT_TUNNEL
-TUNNEL_SRCS =                  \
-       red_tunnel_worker.c     \
-       red_tunnel_worker.h     \
-       $(NULL)
-else
-TUNNEL_SRCS =
-endif
-
-if SUPPORT_SMARTCARD
-SMARTCARD_SRCS =               \
-       smartcard.c                     \
-       smartcard.h                     \
-       $(NULL)
-else
-SMARTCARD_SRCS =
-endif
-
 libspice_server_la_SOURCES =                   \
        agent-msg-filter.c                      \
        agent-msg-filter.h                      \
+       char_device.h                           \
        demarshallers.h                         \
+       generated_demarshallers.c               \
+       generated_marshallers.c                 \
+       generated_marshallers.h                 \
        glz_encoder.c                           \
+       glz_encoder.h                           \
        glz_encoder_config.h                    \
        glz_encoder_dictionary.c                \
        glz_encoder_dictionary.h                \
        glz_encoder_dictionary_protected.h      \
-       glz_encoder.h                           \
+       inputs_channel.c                        \
+       inputs_channel.h                        \
        jpeg_encoder.c                          \
        jpeg_encoder.h                          \
-       mjpeg_encoder.h                         \
+       main_channel.c                          \
+       main_channel.h                          \
        mjpeg_encoder.c                         \
+       mjpeg_encoder.h                         \
        red_bitmap_utils.h                      \
+       red_channel.c                           \
+       red_channel.h                           \
        red_client_cache.h                      \
        red_client_shared_cache.h               \
        red_common.h                            \
@@ -118,31 +85,33 @@ libspice_server_la_SOURCES =                       \
        red_memslots.h                          \
        red_parse_qxl.c                         \
        red_parse_qxl.h                         \
-       reds.c                                  \
-       main_channel.c                          \
-       inputs_channel.c                        \
-       reds.h                                  \
-       stat.h                                  \
        red_worker.c                            \
        red_worker.h                            \
+       reds.c                                  \
+       reds.h                                  \
        snd_worker.c                            \
        snd_worker.h                            \
-       red_channel.h                           \
-       red_channel.c                           \
-       spice.h                                 \
        spice-experimental.h                    \
-       generated_demarshallers.c               \
-       generated_marshallers.c                 \
-       generated_marshallers.h                 \
+       spice.h                                 \
+       stat.h                                  \
        zlib_encoder.c                          \
        zlib_encoder.h                          \
-       char_device.h                           \
-       $(TUNNEL_SRCS)                          \
-       $(SMARTCARD_SRCS)                       \
-       $(COMMON_SRCS)                          \
-       $(GL_SRCS)                              \
        $(NULL)
 
+if SUPPORT_TUNNEL
+libspice_server_la_SOURCES +=  \
+       red_tunnel_worker.c     \
+       red_tunnel_worker.h     \
+       $(NULL)
+endif
+
+if SUPPORT_SMARTCARD
+libspice_server_la_SOURCES +=  \
+       smartcard.c             \
+       smartcard.h             \
+       $(NULL)
+endif
+
 libspice_serverincludedir = $(includedir)/spice-server
 libspice_serverinclude_HEADERS =               \
        spice.h                                 \
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index 9d20264..8ec4094 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -1,35 +1,26 @@
 NULL =
 
-INCLUDES =                          \
-       -I..                            \
-       -I../../common                  \
+INCLUDES =                              \
+       -I$(top_srcdir)                 \
+       -I$(top_srcdir)/common          \
+       -I$(top_srcdir)/server          \
+       -I$(top_srcdir)/server/tests    \
        $(PROTOCOL_CFLAGS)              \
        $(SPICE_NONPKGCONFIG_CFLAGS)    \
        $(NULL)
 
-AM_LDFLAGS = -L../.libs -lspice-server
+AM_LDFLAGS = $(top_builddir)/server/libspice-server.la
 
 noinst_PROGRAMS = test_just_sockets_no_ssl test_empty_success 
test_fail_on_null_core_interface test_display_no_ssl test_display_streaming 
test_playback
 
-test_display_streaming_SOURCES = test_display_streaming.c test_display_base.c 
basic_event_loop.c basic_event_loop.h test_util.h
+test_display_streaming_SOURCES = test_display_streaming.c test_display_base.c 
test_display_base.h basic_event_loop.c basic_event_loop.h test_util.h
 
-test_display_no_ssl_SOURCES = test_display_no_ssl.c test_display_base.c 
basic_event_loop.c basic_event_loop.h test_util.h
-
-test_display_no_ssl_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
+test_display_no_ssl_SOURCES = test_display_no_ssl.c test_display_base.c 
test_display_base.h basic_event_loop.c basic_event_loop.h test_util.h
 
 test_just_sockets_no_ssl_SOURCES = test_just_sockets_no_ssl.c 
basic_event_loop.c basic_event_loop.h test_util.h
 
-test_just_sockets_no_ssl_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_empty_success_SOURCES = test_empty_success.c
 
-test_empty_success_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_fail_on_null_core_interface_SOURCES = test_fail_on_null_core_interface.c
 
-test_fail_on_null_core_interface_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
 test_playback_SOURCES = test_playback.c basic_event_loop.c basic_event_loop.h 
test_util.h
-
-test_playback_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS)
-
-- 
1.7.4.4

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to