[gnome-keyring] Makefile.am: Use a single non-recursive Makefile



commit 0b751a90927f0f9768cd587fe8cab5e72a74517f
Author: Stef Walter <stefw gnome org>
Date:   Tue Mar 4 17:50:47 2014 +0100

    Makefile.am: Use a single non-recursive Makefile
    
    This allows all the code to be built in parallel, and only
    rebuilding stuff that's changed when developing. Much quicker.
    
    In the meantime disable the p11-tests checks, which
    were very rarely used. We'll need to migrate them to TAP.

 Makefile.am                                        |  168 +++++++++++---
 Makefile.decl                                      |   60 -----
 configure.ac                                       |   44 +----
 daemon/Makefile.am                                 |   99 +++-----
 daemon/control/Makefile.am                         |   70 ++----
 daemon/control/frob-control-change.c               |    2 +-
 daemon/control/frob-control-init.c                 |    2 +-
 daemon/control/frob-control-quit.c                 |    2 +-
 daemon/control/frob-control-unlock.c               |    2 +-
 daemon/control/gkd-control-server.c                |    6 +-
 daemon/dbus/Makefile.am                            |  130 ++++++-----
 daemon/dbus/gkd-dbus-environment.c                 |    4 +-
 daemon/dbus/gkd-dbus-session.c                     |    3 +-
 daemon/dbus/gkd-dbus.c                             |    2 +-
 daemon/dbus/gkd-secret-unlock.c                    |    2 +-
 .../{test-secret-items.c => test-dbus-items.c}     |    2 -
 .../dbus/{test-secret-lock.c => test-dbus-lock.c}  |    0
 .../{test-secret-search.c => test-dbus-search.c}   |    2 -
 .../{test-secret-signals.c => test-dbus-signals.c} |    0
 .../dbus/{test-secret-util.c => test-dbus-util.c}  |    0
 daemon/dbus/test-service.c                         |    8 +-
 daemon/gnome-keyring-gpg.desktop.in.in             |    2 +-
 daemon/gnome-keyring-pkcs11.desktop.in.in          |    2 +-
 daemon/gnome-keyring-secrets.desktop.in.in         |    2 +-
 daemon/gnome-keyring-ssh.desktop.in.in             |    2 +-
 daemon/gpg-agent/Makefile.am                       |   29 +--
 daemon/login/Makefile.am                           |   23 +--
 daemon/org.freedesktop.secrets.service.in          |    2 +-
 daemon/org.gnome.keyring.service.in                |    2 +-
 daemon/ssh-agent/Makefile.am                       |   31 +--
 egg/Makefile.am                                    |  163 +++++++------
 egg/egg-mkdtemp.c                                  |    1 +
 egg/egg-mkdtemp.h                                  |    1 +
 egg/egg-timegm.c                                   |    1 +
 egg/egg-timegm.h                                   |    1 +
 egg/test-asn1.c                                    |    2 +-
 egg/test-asn1x.c                                   |   14 +-
 egg/test-dn.c                                      |    2 +-
 egg/test-openssl.c                                 |    2 +-
 egg/test-spawn.c                                   |   10 +-
 pam/Makefile.am                                    |   25 +--
 pkcs11/Makefile.am                                 |   19 +-
 pkcs11/gkm/Makefile.am                             |  251 ++++++++++++--------
 pkcs11/gkm/mock-module.c                           |    2 +-
 pkcs11/gkm/test-certificate.c                      |    2 +-
 pkcs11/gkm/test-data-asn1.c                        |    2 +-
 pkcs11/gkm/test-data-der.c                         |   12 +-
 pkcs11/gkm/test-object.c                           |    2 +-
 pkcs11/gnome2-store/Makefile.am                    |  115 ++++-----
 pkcs11/gnome2-store/gkm-gnome2-file.c              |    3 +-
 pkcs11/gnome2-store/test-gnome2-file.c             |    4 +-
 pkcs11/gnome2-store/test-gnome2-private-key.c      |    2 +-
 pkcs11/gnome2-store/test-gnome2-storage.c          |    6 +-
 pkcs11/gnome2-store/test-import.c                  |    4 +-
 pkcs11/rpc-layer/Makefile.am                       |   57 ++---
 pkcs11/secret-store/Makefile.am                    |  117 ++++++----
 pkcs11/secret-store/mock-secret-module.c           |    4 +-
 pkcs11/secret-store/test-secret-binary.c           |   16 +-
 pkcs11/secret-store/test-secret-collection.c       |   12 +-
 pkcs11/secret-store/test-secret-schema.c           |    2 +-
 pkcs11/secret-store/test-secret-textual.c          |   10 +-
 pkcs11/ssh-store/Makefile.am                       |   96 +++-----
 pkcs11/ssh-store/test-private-key.c                |    8 +-
 pkcs11/ssh-store/test-ssh-openssh.c                |   12 +-
 pkcs11/wrap-layer/Makefile.am                      |   72 ++++--
 pkcs11/xdg-store/Makefile.am                       |  101 ++++-----
 pkcs11/xdg-store/mock-xdg-module.c                 |    4 +-
 pkcs11/xdg-store/test-xdg-module.c                 |    2 +-
 pkcs11/xdg-store/test-xdg-trust.c                  |    2 +-
 po/POTFILES.skip                                   |    9 +-
 schema/Makefile.am                                 |   16 +-
 tool/Makefile.am                                   |   34 +--
 72 files changed, 943 insertions(+), 980 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index fec35da..e81bcd3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,20 +1,7 @@
 NULL =
 
-if WITH_PAM
-PAM_DIR = pam
-else
-PAM_DIR = 
-endif
-
 SUBDIRS = \
        . \
-       egg \
-       pkcs11 \
-       schema \
-       daemon \
-       tool \
-       testing \
-       $(PAM_DIR) \
        po
 
 ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
@@ -49,7 +36,7 @@ dist-hook:
                echo Creating ChangeLog && \
                ( cd "$(top_srcdir)" && \
                  echo '# Generate automatically. Do not edit.'; echo; \
-                 $(top_srcdir)/missing --run git log $(CHANGELOG_START).. --stat --date=short ) > 
ChangeLog.tmp \
+                 git log $(CHANGELOG_START).. --stat --date=short ) > ChangeLog.tmp \
                && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
                || ( rm -f ChangeLog.tmp ; \
                     echo Failed to generate ChangeLog >&2 ); \
@@ -60,22 +47,8 @@ dist-hook:
 install-pam:
        @echo "WARNING: install-pam is no longer used, use the --with-pam-dir configure option instead"
 
-if WITH_COVERAGE
-coverage:
-       mkdir -p testing/coverage
-       $(LCOV) --directory docs/ --zerocounters
-       $(LCOV) --directory . --capture --output-file testing/coverage.info
-       $(GENHTML) --output-directory testing/coverage testing/coverage.info
-       $(LCOV) --directory . --zerocounters
-       @echo "file://$(abs_top_builddir)/testing/coverage/index.html"
-
-clear-coverage:
-       $(LCOV) --directory . --zerocounters
-
-endif
-
 if ENABLE_DOC
-SUBDIRS += docs
+# include docs/Makefile.am
 
 distcheck-hook:
        @true
@@ -89,3 +62,140 @@ endif
 upload-release: $(DIST_ARCHIVES)
        scp $(DIST_ARCHIVES) master.gnome.org:
        ssh master.gnome.org ftpadmin install $(DIST_ARCHIVES)
+
+asn1-reparse:
+       for a in $(ASN1_FILES); do \
+               asn1Parser -o $$a.h $a \
+               sed -i 's|#include.*|/* \0 */|' $$a.h \
+       done
+
+test: $(TEST_PROGS)
+       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+
+check-local: test
+
+all-local: $(check_PROGRAMS)
+
+TEST_ARGS =
+
+TEST_SUPPRESSIONS = $(top_builddir)/build/valgrind-suppressions
+
+perform-memcheck: $(TEST_PROGS)
+       make -C $(top_builddir)/build all
+       @for test in $(TEST_PROGS); do \
+               G_SLICE=always-malloc libtool --mode=execute \
+                       valgrind --trace-children=no --gen-suppressions=all \
+                       --suppressions=$(TEST_SUPPRESSIONS) \
+                       --leak-check=full --show-reachable=yes --num-callers=16 \
+                       --quiet --error-exitcode=3 \
+                       $(builddir)/$$test $(TEST_ARGS) || exit 3; \
+       done
+
+coverage:
+       mkdir -p $(top_builddir)/build/coverage
+       $(LCOV) --directory . --capture --output-file $(top_builddir)/build/coverage.info
+       $(GENHTML) --output-directory $(top_builddir)/build/coverage $(top_builddir)/build/coverage.info
+       $(LCOV) --directory . --zerocounters
+       @echo "file://$(abs_top_builddir)/build/coverage/index.html"
+
+clear-coverage:
+       $(LCOV) --directory . --zerocounters
+
+# Set the relevant capabilities on the daemon
+if WITH_CAPS
+install-caps:
+       setcap cap_ipc_lock=ep $(DESTDIR)$(bindir)/gnome-keyring-daemon || true
+else
+install-caps:
+       @true
+endif
+
+# Install a link from gnome-keyring > gnome-keyring- GKR_MAJOR@ to maintain compatibility
+install-exec-hook: install-caps
+       @test -e "$(DESTDIR)$(bindir)/gnome-keyring" || (cd $(DESTDIR)$(bindir) && $(LN_S) gnome-keyring- 
GKR_MAJOR@ gnome-keyring)
+
+V_SED = $(V_SED_$(V))
+V_SED_ = $(V_SED_$(AM_DEFAULT_VERBOSITY))
+V_SED_0 = @echo "  SED   " $@;
+
+SED_SUBST = sed \
+       -e 's,[ ]datadir[@],$(datadir),g' \
+       -e 's,[ ]libexecdir[@],$(libexecdir),g' \
+       -e 's,[ ]libdir[@],$(libdir),g' \
+       -e 's,[ ]includedir[@],$(includedir),g' \
+       -e 's,[ ]datarootdir[@],$(datarootdir),g' \
+       -e 's,[ ]sysconfdir[@],$(sysconfdir),g' \
+       -e 's,[ ]bindir[@],$(bindir),g' \
+       -e 's,[ ]exec_prefix[@],$(exec_prefix),g' \
+       -e 's,[ ]prefix[@],$(prefix),g' \
+       -e 's,[ ]abs_srcdir[@],$(abs_srcdir),g' \
+       -e 's,[ ]srcdir[@],$(srcdir),g' \
+       -e 's,[ ]PACKAGE[@],$(PACKAGE),g' \
+       -e 's,[ ]VERSION[@],$(VERSION),g' \
+       $(NULL)
+
+SUFFIXES = .desktop.in .desktop.in.in .service .service.in
+
+.service.in.service:
+       $(V_SED) ( $(SED_SUBST) $< > $  tmp ) && mv $  tmp $@
+
+.desktop.in.in.desktop.in:
+       $(V_SED) ( $(SED_SUBST) $< > $  tmp ) && mv $  tmp $@
+
+ INTLTOOL_DESKTOP_RULE@
+
+prep-builddir:
+       $(MKDIR_P) $(builddir)/daemon
+       $(MKDIR_P) $(builddir)/schema
+
+AM_CPPFLAGS = \
+       -DPREFIX=\""$(prefix)"\" \
+       -DBINDIR=\""$(bindir)"\" \
+       -DLIBEXECDIR=\""$(libexecdir)"\" \
+       -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+       -DSRCDIR="\"@abs_srcdir \"" \
+       -DBUILDDIR="\"@abs_builddir \"" \
+       -I$(top_srcdir) \
+       -I$(top_builddir) \
+       -I$(top_srcdir)/pkcs11 \
+       $(GLIB_CFLAGS)
+
+bin_PROGRAMS =
+check_PROGRAMS = $(TEST_PROGS)
+noinst_DATA =
+noinst_LIBRARIES =
+noinst_LTLIBRARIES =
+noinst_PROGRAMS =
+
+ASN1_FILES =
+BUILT_SOURCES = prep-builddir
+CLEANFILES = $(BUILT_SOURCES)
+TEST_PROGS =
+
+moduledir = $(pkcs11standalonedir)
+module_LTLIBRARIES =
+
+EXTRA_DIST += \
+       $(ASN1_FILES)
+
+include egg/Makefile.am
+include daemon/Makefile.am
+include daemon/control/Makefile.am
+include daemon/dbus/Makefile.am
+include daemon/gpg-agent/Makefile.am
+include daemon/login/Makefile.am
+include daemon/ssh-agent/Makefile.am
+include pkcs11/Makefile.am
+include pkcs11/gkm/Makefile.am
+include pkcs11/gnome2-store/Makefile.am
+include pkcs11/rpc-layer/Makefile.am
+include pkcs11/secret-store/Makefile.am
+include pkcs11/ssh-store/Makefile.am
+include pkcs11/wrap-layer/Makefile.am
+include pkcs11/xdg-store/Makefile.am
+include schema/Makefile.am
+include tool/Makefile.am
+
+#ifdef WITH_PAM
+include pam/Makefile.am
+#endif
diff --git a/configure.ac b/configure.ac
index 6c24e73..1f914c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,6 +222,9 @@ AC_SUBST(GCK_LIBS)
 AC_SUBST(GCR_LIBS)
 AC_SUBST(GCR_BASE_LIBS)
 
+AC_DEFINE(GCK_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
+AC_DEFINE(GCR_API_SUBJECT_TO_CHANGE, 1, [Nod nod])
+
 # --------------------------------------------------------------------
 # DBus Checks
 #
@@ -617,27 +620,6 @@ valgrind_status="yes"
 
 AM_CONDITIONAL(WITH_VALGRIND, test "$enable_valgrind" = "run")
 
-# Run gnome-keyring-daemon under valgrind as default
-if test "$enable_valgrind" = "run"; then
-       AC_PATH_PROG(VALGRIND, valgrind, no)
-       if test "$VALGRIND" = "no" ; then
-               AC_MSG_ERROR(valgrind tool is not installed)
-       fi
-
-       VALGRIND_ARG="--log-file=/tmp/gkr-valgrind.log.%p"
-       VALGRIND_RUN="$VALGRIND $VALGRIND_ARG "
-
-       AC_DEFINE_UNQUOTED(VALGRIND, "$VALGRIND", [Path to valgrind executable])
-       AC_DEFINE_UNQUOTED(VALGRIND_ARG, "$VALGRIND_ARG", [Valgrind arguments])
-
-       enable_valgrind="yes"
-       valgrind_status="run"
-fi
-
-AC_SUBST(VALGRIND)
-AC_SUBST(VALGRIND_ARG)
-AC_SUBST(VALGRIND_RUN)
-
 # Build valgrind support into code
 if test "$enable_valgrind" = "yes"; then
        AC_CHECK_HEADER([valgrind/valgrind.h], have_valgrind=yes, have_valgrind=no)
@@ -666,28 +648,8 @@ AC_SUBST(P11_TESTS_LIBS)
 
 AC_OUTPUT([
 Makefile
-daemon/Makefile
-daemon/control/Makefile
-daemon/dbus/Makefile
-daemon/gpg-agent/Makefile
-daemon/login/Makefile
-daemon/ssh-agent/Makefile
-docs/Makefile
-egg/Makefile
-pam/Makefile
-pkcs11/Makefile
-pkcs11/gkm/Makefile
-pkcs11/gnome2-store/Makefile
-pkcs11/rpc-layer/Makefile
 pkcs11/rpc-layer/gnome-keyring.module
-pkcs11/secret-store/Makefile
-pkcs11/ssh-store/Makefile
-pkcs11/wrap-layer/Makefile
-pkcs11/xdg-store/Makefile
 po/Makefile.in
-schema/Makefile
-testing/Makefile
-tool/Makefile
 ])
 
 # ------------------------------------------------------------------------------
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 1d631a5..6802315 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -1,79 +1,54 @@
-include $(top_srcdir)/Makefile.decl
 
-SUBDIRS = \
-       login \
-       control \
-       ssh-agent \
-       gpg-agent \
-       dbus
-
-bin_PROGRAMS= \
+bin_PROGRAMS += \
        gnome-keyring-daemon
 
-INCLUDES=      \
-       -DPREFIX=\""$(prefix)"\"                        \
-       -DBINDIR=\""$(bindir)"\"                        \
-       -DLIBEXECDIR=\""$(libexecdir)"\"                \
-       -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
-       -I$(top_srcdir)                                 \
-       -I$(top_srcdir)/daemon                          \
-       -I$(top_builddir)                               \
-       $(DAEMON_CFLAGS)                                \
-       -DGCK_API_SUBJECT_TO_CHANGE
-
 gnome_keyring_daemon_SOURCES = \
-       gkd-glue.c gkd-glue.h \
-       gkd-main.c gkd-main.h \
-       gkd-capability.c gkd-capability.h \
-       gkd-pkcs11.c gkd-pkcs11.h \
-       gkd-util.c gkd-util.h
-
+       daemon/gkd-glue.c \
+       daemon/gkd-glue.h \
+       daemon/gkd-main.c \
+       daemon/gkd-main.h \
+       daemon/gkd-capability.c \
+       daemon/gkd-capability.h \
+       daemon/gkd-pkcs11.c \
+       daemon/gkd-pkcs11.h \
+       daemon/gkd-util.c \
+       daemon/gkd-util.h \
+       $(NULL)
 gnome_keyring_daemon_LDADD = \
-       $(top_builddir)/daemon/dbus/libgkd-dbus.la \
-       $(top_builddir)/daemon/login/libgkd-login.la \
-       $(top_builddir)/daemon/control/libgkd-control.la \
-       $(top_builddir)/daemon/ssh-agent/libgkd-ssh-agent.la \
-       $(top_builddir)/daemon/gpg-agent/libgkd-gpg-agent.la \
-       $(top_builddir)/pkcs11/wrap-layer/libgkm-wrap-layer.la \
-       $(top_builddir)/pkcs11/rpc-layer/libgkm-rpc-layer.la \
-       $(top_builddir)/pkcs11/secret-store/libgkm-secret-store.la \
-       $(top_builddir)/pkcs11/ssh-store/libgkm-ssh-store.la \
-       $(top_builddir)/pkcs11/gnome2-store/libgkm-gnome2-store.la \
-       $(top_builddir)/pkcs11/xdg-store/libgkm-xdg-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg-dbus.la \
+       libgkd-dbus.la \
+       libgkd-login.la \
+       libgkd-control.la \
+       libgkd-ssh-agent.la \
+       libgkd-gpg-agent.la \
+       libgkm-wrap-layer.la \
+       libgkm-rpc-layer.la \
+       libgkm-secret-store.la \
+       libgkm-ssh-store.la \
+       libgkm-gnome2-store.la \
+       libgkm-xdg-store.la \
+       libgkm.la \
+       libegg-dbus.la \
        $(DAEMON_LIBS)
 
 service_in_files = \
-       org.gnome.keyring.service.in \
-       org.freedesktop.secrets.service.in
-
-servicedir       = $(DBUS_SERVICES_DIR)
-service_DATA     = $(service_in_files:.service.in=.service)
-service_PATH     = $(VALGRIND_RUN)$(bindir)
+       daemon/org.gnome.keyring.service.in \
+       daemon/org.freedesktop.secrets.service.in
+servicedir = $(DBUS_SERVICES_DIR)
+service_DATA = $(service_in_files:.service.in=.service)
 
+desktopdir = $(sysconfdir)/xdg/autostart
 desktop_in_in_files = \
-       gnome-keyring-pkcs11.desktop.in.in \
-       gnome-keyring-secrets.desktop.in.in \
-       gnome-keyring-ssh.desktop.in.in \
-       gnome-keyring-gpg.desktop.in.in
+       daemon/gnome-keyring-pkcs11.desktop.in.in \
+       daemon/gnome-keyring-secrets.desktop.in.in \
+       daemon/gnome-keyring-ssh.desktop.in.in \
+       daemon/gnome-keyring-gpg.desktop.in.in
 desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
-desktopdir       = $(sysconfdir)/xdg/autostart
-desktop_DATA     = $(desktop_in_files:.desktop.in=.desktop)
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
-EXTRA_DIST = \
+EXTRA_DIST += \
        $(service_in_files) \
        $(desktop_in_in_files)
 
-CLEANFILES = \
-       $(desktop_in_files) \
+CLEANFILES += \
        $(service_DATA) \
        $(desktop_DATA)
-
-if WITH_CAPS
-
-# Set the relevant capabilities on the daemon
-install-exec-hook:
-       setcap cap_ipc_lock=ep $(DESTDIR)$(bindir)/gnome-keyring-daemon || true
-
-endif
diff --git a/daemon/control/Makefile.am b/daemon/control/Makefile.am
index 4df8cfd..0840e78 100644
--- a/daemon/control/Makefile.am
+++ b/daemon/control/Makefile.am
@@ -1,74 +1,50 @@
 
-INCLUDES= \
-       -DPREFIX=\""$(prefix)"\" \
-       -DBINDIR=\""$(bindir)"\" \
-       -DLIBEXECDIR=\""$(libexecdir)"\" \
-       -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/daemon \
-       -I$(top_builddir) \
-       $(GLIB_CFLAGS)
-
-LIBS = \
-       $(GLIB_LIBS) \
-       $(GTHREAD_LIBS) \
-       $(P11_TESTS_LIBS)
 
 # ------------------------------------------------------------------
 # DAEMON CODE
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkd-control.la \
        libgkd-control-client.la
 
 libgkd_control_la_SOURCES = \
-       gkd-control-server.c gkd-control-client.c \
-       gkd-control.h gkd-control-codes.h
+       daemon/control/gkd-control-server.c \
+       daemon/control/gkd-control-client.c \
+       daemon/control/gkd-control.h \
+       daemon/control/gkd-control-codes.h
 
 libgkd_control_client_la_SOURCES = \
-       gkd-control-client.c gkd-control.h
+       daemon/control/gkd-control-client.c \
+       daemon/control/gkd-control.h
 
 # -------------------------------------------------------------------
 # TESTS
 
-noinst_PROGRAMS= \
+noinst_PROGRAMS += \
        frob-control-change \
        frob-control-init \
        frob-control-unlock \
        frob-control-quit
 
-frob_control_change_SOURCES = \
-       frob-control-change.c
+control_LIBS = \
+       libgkd-control-client.la \
+       libegg-buffer.la \
+       libegg-creds.la \
+       libegg-secure.la \
+       $(GLIB_LIBS)
 
-frob_control_change_LDADD = \
-       $(top_builddir)/daemon/control/libgkd-control-client.la \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
-       $(top_builddir)/egg/libegg-secure.la
+frob_control_change_SOURCES = \
+       daemon/control/frob-control-change.c
+frob_control_change_LDADD = $(control_LIBS)
 
 frob_control_init_SOURCES = \
-       frob-control-init.c
-
-frob_control_init_LDADD = \
-       $(top_builddir)/daemon/control/libgkd-control-client.la \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
-       $(top_builddir)/egg/libegg-secure.la
+       daemon/control/frob-control-init.c
+frob_control_init_LDADD =  $(control_LIBS)
 
 frob_control_quit_SOURCES = \
-       frob-control-quit.c
-
-frob_control_quit_LDADD = \
-       $(top_builddir)/daemon/control/libgkd-control-client.la \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
-       $(top_builddir)/egg/libegg-secure.la
+       daemon/control/frob-control-quit.c
+frob_control_quit_LDADD =  $(control_LIBS)
 
 frob_control_unlock_SOURCES = \
-       frob-control-unlock.c
-
-frob_control_unlock_LDADD = \
-       $(top_builddir)/daemon/control/libgkd-control-client.la \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
-       $(top_builddir)/egg/libegg-secure.la
\ No newline at end of file
+       daemon/control/frob-control-unlock.c
+frob_control_unlock_LDADD =  $(control_LIBS)
diff --git a/daemon/control/frob-control-change.c b/daemon/control/frob-control-change.c
index 2fa6b4c..2826936 100644
--- a/daemon/control/frob-control-change.c
+++ b/daemon/control/frob-control-change.c
@@ -1,5 +1,5 @@
 
-#include "control/gkd-control.h"
+#include "gkd-control.h"
 
 #include "egg/egg-secure-memory.h"
 
diff --git a/daemon/control/frob-control-init.c b/daemon/control/frob-control-init.c
index 88149be..34f5a56 100644
--- a/daemon/control/frob-control-init.c
+++ b/daemon/control/frob-control-init.c
@@ -1,5 +1,5 @@
 
-#include "control/gkd-control.h"
+#include "gkd-control.h"
 
 #include "egg/egg-secure-memory.h"
 
diff --git a/daemon/control/frob-control-quit.c b/daemon/control/frob-control-quit.c
index a2ade3a..5b32de4 100644
--- a/daemon/control/frob-control-quit.c
+++ b/daemon/control/frob-control-quit.c
@@ -1,5 +1,5 @@
 
-#include "control/gkd-control.h"
+#include "gkd-control.h"
 
 #include "egg/egg-secure-memory.h"
 
diff --git a/daemon/control/frob-control-unlock.c b/daemon/control/frob-control-unlock.c
index 6a44801..b93f341 100644
--- a/daemon/control/frob-control-unlock.c
+++ b/daemon/control/frob-control-unlock.c
@@ -1,5 +1,5 @@
 
-#include "control/gkd-control.h"
+#include "gkd-control.h"
 
 #include "egg/egg-secure-memory.h"
 
diff --git a/daemon/control/gkd-control-server.c b/daemon/control/gkd-control-server.c
index 0779517..9966e97 100644
--- a/daemon/control/gkd-control-server.c
+++ b/daemon/control/gkd-control-server.c
@@ -23,15 +23,15 @@
 #include "gkd-control.h"
 #include "gkd-control-codes.h"
 
-#include "gkd-main.h"
-#include "gkd-util.h"
+#include "daemon/gkd-main.h"
+#include "daemon/gkd-util.h"
 
 #include "egg/egg-buffer.h"
 #include "egg/egg-cleanup.h"
 #include "egg/egg-secure-memory.h"
 #include "egg/egg-unix-credentials.h"
 
-#include "login/gkd-login.h"
+#include "daemon/login/gkd-login.h"
 
 #include <errno.h>
 #include <fcntl.h>
diff --git a/daemon/dbus/Makefile.am b/daemon/dbus/Makefile.am
index 9cf6175..bc33ffa 100644
--- a/daemon/dbus/Makefile.am
+++ b/daemon/dbus/Makefile.am
@@ -1,80 +1,100 @@
 
-INCLUDES = \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/daemon \
-       -I$(top_srcdir)/daemon/dbus \
-       -I$(top_builddir) \
-       $(DAEMON_CFLAGS) \
-       $(GCR_BASE_CFLAGS) \
-       $(GOBJECT_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       -DGCK_API_SUBJECT_TO_CHANGE \
-       -DGCR_API_SUBJECT_TO_CHANGE \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       -DTOP_SRCDIR="\"@abs_top_srcdir \"" \
-       -DTOP_BUILDDIR="\"@abs_top_builddir \""
-
-noinst_LTLIBRARIES = libgkd-dbus.la
+noinst_LTLIBRARIES += libgkd-dbus.la
 
 libgkd_dbus_la_SOURCES = \
-       gkd-dbus.c gkd-dbus.h \
-       gkd-dbus-environment.c \
-       gkd-dbus-private.h \
-       gkd-dbus-secrets.c \
-       gkd-dbus-session.c \
-       gkd-dbus-util.c gkd-dbus-util.h \
-       gkd-secret-change.c gkd-secret-change.h \
-       gkd-secret-create.c gkd-secret-create.h \
-       gkd-secret-dispatch.c gkd-secret-dispatch.h \
-       gkd-secret-error.c gkd-secret-error.h \
-       gkd-secret-exchange.c gkd-secret-exchange.h \
-       gkd-secret-introspect.c gkd-secret-introspect.h \
-       gkd-secret-lock.c gkd-secret-lock.h \
-       gkd-secret-objects.c gkd-secret-objects.h \
-       gkd-secret-property.c gkd-secret-property.h \
-       gkd-secret-prompt.c gkd-secret-prompt.h \
-       gkd-secret-secret.c gkd-secret-secret.h \
-       gkd-secret-service.c gkd-secret-service.h \
-       gkd-secret-session.c gkd-secret-session.h \
-       gkd-secret-types.h \
-       gkd-secret-unlock.c gkd-secret-unlock.h \
-       gkd-secret-util.c gkd-secret-util.h
+       daemon/dbus/gkd-dbus.c \
+       daemon/dbus/gkd-dbus.h \
+       daemon/dbus/gkd-dbus-environment.c \
+       daemon/dbus/gkd-dbus-private.h \
+       daemon/dbus/gkd-dbus-secrets.c \
+       daemon/dbus/gkd-dbus-session.c \
+       daemon/dbus/gkd-dbus-util.c \
+       daemon/dbus/gkd-dbus-util.h \
+       daemon/dbus/gkd-secret-change.c \
+       daemon/dbus/gkd-secret-change.h \
+       daemon/dbus/gkd-secret-create.c \
+       daemon/dbus/gkd-secret-create.h \
+       daemon/dbus/gkd-secret-dispatch.c \
+       daemon/dbus/gkd-secret-dispatch.h \
+       daemon/dbus/gkd-secret-error.c \
+       daemon/dbus/gkd-secret-error.h \
+       daemon/dbus/gkd-secret-exchange.c \
+       daemon/dbus/gkd-secret-exchange.h \
+       daemon/dbus/gkd-secret-introspect.c \
+       daemon/dbus/gkd-secret-introspect.h \
+       daemon/dbus/gkd-secret-lock.c \
+       daemon/dbus/gkd-secret-lock.h \
+       daemon/dbus/gkd-secret-objects.c \
+       daemon/dbus/gkd-secret-objects.h \
+       daemon/dbus/gkd-secret-property.c \
+       daemon/dbus/gkd-secret-property.h \
+       daemon/dbus/gkd-secret-prompt.c \
+       daemon/dbus/gkd-secret-prompt.h \
+       daemon/dbus/gkd-secret-secret.c \
+       daemon/dbus/gkd-secret-secret.h \
+       daemon/dbus/gkd-secret-service.c \
+       daemon/dbus/gkd-secret-service.h \
+       daemon/dbus/gkd-secret-session.c \
+       daemon/dbus/gkd-secret-session.h \
+       daemon/dbus/gkd-secret-types.h \
+       daemon/dbus/gkd-secret-unlock.c \
+       daemon/dbus/gkd-secret-unlock.h \
+       daemon/dbus/gkd-secret-util.c \
+       daemon/dbus/gkd-secret-util.h \
+       $(NULL)
 
 libgkd_dbus_la_LIBADD = \
        $(GLIB_LIBS) \
        $(GOBJECT_LIBS)
 
+libgkd_dbus_la_CFLAGS = \
+       $(DAEMON_CFLAGS) \
+       $(GCR_BASE_CFLAGS) \
+       $(GOBJECT_CFLAGS)
+
 # -------------------------------------------------------------------
 # TESTS
 
+EXTRA_DIST += daemon/dbus/fixtures
+
 noinst_LTLIBRARIES += \
        libtestservice.la
 
 libtestservice_la_SOURCES = \
-       test-service.c test-service.h
+       daemon/dbus/test-service.c daemon/dbus/test-service.h
+
+daemon_dbus_CFLAGS = \
+       $(DBUS_CFLAGS) \
+       $(GCR_CFLAGS)
 
-LDADD =  \
-       $(builddir)/libtestservice.la \
-       $(top_builddir)/daemon/dbus/libgkd-dbus.la \
-       $(top_builddir)/egg/libegg-test.la \
+daemon_dbus_LIBS = \
+       libtestservice.la \
+       libgkd-dbus.la \
+       libegg-test.la \
        $(GCR_BASE_LIBS) \
        $(GIO_LIBS) \
        $(GLIB_LIBS)
 
-TEST_PROGS = \
-       test-secret-util \
-       test-secret-search \
-       test-secret-items \
-       test-secret-signals \
-       test-secret-lock
+TEST_PROGS += \
+       test-dbus-util \
+       test-dbus-search \
+       test-dbus-items \
+       test-dbus-signals \
+       test-dbus-lock
 
-check_PROGRAMS = $(TEST_PROGS)
+test_dbus_util_SOURCES = daemon/dbus/test-dbus-util.c
+test_dbus_util_LDADD = $(daemon_dbus_LIBS)
+test_dbus_util_CFLAGS = $(daemon_dbus_CFLAGS)
 
-EXTRA_DIST = fixtures
+test_dbus_search_SOURCES = daemon/dbus/test-dbus-search.c
+test_dbus_search_LDADD = $(daemon_dbus_LIBS)
 
-test: $(TEST_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+test_dbus_items_SOURCES = daemon/dbus/test-dbus-items.c
+test_dbus_items_LDADD = $(daemon_dbus_LIBS)
 
-check-local: test
+test_dbus_signals_SOURCES = daemon/dbus/test-dbus-signals.c
+test_dbus_signals_LDADD = $(daemon_dbus_LIBS)
+test_dbus_signals_CFLAGS = $(daemon_dbus_CFLAGS)
 
-all-local: $(check_PROGRAMS)
+test_dbus_lock_SOURCES = daemon/dbus/test-dbus-lock.c
+test_dbus_lock_LDADD = $(daemon_dbus_LIBS)
diff --git a/daemon/dbus/gkd-dbus-environment.c b/daemon/dbus/gkd-dbus-environment.c
index 3f77a22..2047226 100644
--- a/daemon/dbus/gkd-dbus-environment.c
+++ b/daemon/dbus/gkd-dbus-environment.c
@@ -22,9 +22,9 @@
 
 #include "config.h"
 
-
 #include "gkd-dbus-private.h"
-#include "gkd-util.h"
+
+#include "daemon/gkd-util.h"
 
 #include <dbus/dbus.h>
 
diff --git a/daemon/dbus/gkd-dbus-session.c b/daemon/dbus/gkd-dbus-session.c
index a447c40..5f09772 100644
--- a/daemon/dbus/gkd-dbus-session.c
+++ b/daemon/dbus/gkd-dbus-session.c
@@ -23,7 +23,8 @@
 #include "config.h"
 
 #include "gkd-dbus-private.h"
-#include "gkd-main.h"
+
+#include "daemon/gkd-main.h"
 
 #include <dbus/dbus.h>
 
diff --git a/daemon/dbus/gkd-dbus.c b/daemon/dbus/gkd-dbus.c
index 591aa34..b66af10 100644
--- a/daemon/dbus/gkd-dbus.c
+++ b/daemon/dbus/gkd-dbus.c
@@ -25,7 +25,7 @@
 #include "gkd-dbus.h"
 #include "gkd-dbus-private.h"
 
-#include "gkd-util.h"
+#include "daemon/gkd-util.h"
 
 #include "egg/egg-cleanup.h"
 #include "egg/egg-dbus.h"
diff --git a/daemon/dbus/gkd-secret-unlock.c b/daemon/dbus/gkd-secret-unlock.c
index 932ea93..1335cdb 100644
--- a/daemon/dbus/gkd-secret-unlock.c
+++ b/daemon/dbus/gkd-secret-unlock.c
@@ -34,7 +34,7 @@
 #include "egg/egg-error.h"
 #include "egg/egg-secure-memory.h"
 
-#include "login/gkd-login.h"
+#include "daemon/login/gkd-login.h"
 
 #include "pkcs11/pkcs11i.h"
 
diff --git a/daemon/dbus/test-secret-items.c b/daemon/dbus/test-dbus-items.c
similarity index 99%
rename from daemon/dbus/test-secret-items.c
rename to daemon/dbus/test-dbus-items.c
index 4843317..43a65cd 100644
--- a/daemon/dbus/test-secret-items.c
+++ b/daemon/dbus/test-dbus-items.c
@@ -28,8 +28,6 @@
 
 #include "egg/egg-testing.h"
 
-#include <gcr/gcr-base.h>
-
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
diff --git a/daemon/dbus/test-secret-lock.c b/daemon/dbus/test-dbus-lock.c
similarity index 100%
rename from daemon/dbus/test-secret-lock.c
rename to daemon/dbus/test-dbus-lock.c
diff --git a/daemon/dbus/test-secret-search.c b/daemon/dbus/test-dbus-search.c
similarity index 99%
rename from daemon/dbus/test-secret-search.c
rename to daemon/dbus/test-dbus-search.c
index 6108a0d..bb311e8 100644
--- a/daemon/dbus/test-secret-search.c
+++ b/daemon/dbus/test-dbus-search.c
@@ -28,8 +28,6 @@
 
 #include "egg/egg-testing.h"
 
-#include <gcr/gcr-base.h>
-
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
diff --git a/daemon/dbus/test-secret-signals.c b/daemon/dbus/test-dbus-signals.c
similarity index 100%
rename from daemon/dbus/test-secret-signals.c
rename to daemon/dbus/test-dbus-signals.c
diff --git a/daemon/dbus/test-secret-util.c b/daemon/dbus/test-dbus-util.c
similarity index 100%
rename from daemon/dbus/test-secret-util.c
rename to daemon/dbus/test-dbus-util.c
diff --git a/daemon/dbus/test-service.c b/daemon/dbus/test-service.c
index 8882d5c..83a1a0f 100644
--- a/daemon/dbus/test-service.c
+++ b/daemon/dbus/test-service.c
@@ -28,8 +28,6 @@
 
 #include "egg/egg-testing.h"
 
-#include <gcr/gcr-base.h>
-
 #include <glib/gstdio.h>
 
 #include <fcntl.h>
@@ -78,7 +76,7 @@ test_service_setup (TestService *test)
        gchar **env;
 
        gchar *args[] = {
-               TOP_BUILDDIR "/daemon/gnome-keyring-daemon",
+               BUILDDIR "/gnome-keyring-daemon",
                "--foreground",
                "--control-directory",
                "/tmp/keyring-test",
@@ -96,12 +94,12 @@ test_service_setup (TestService *test)
                                           test, NULL);
 
        test->directory = egg_tests_create_scratch_directory (
-               SRCDIR "/fixtures/test.keyring",
+               SRCDIR "/daemon/dbus/fixtures/test.keyring",
                NULL);
 
        /* The schema directory */
        env = g_get_environ ();
-       env = g_environ_setenv (env, "GSETTINGS_SCHEMA_DIR", TOP_BUILDDIR "/schema", TRUE);
+       env = g_environ_setenv (env, "GSETTINGS_SCHEMA_DIR", BUILDDIR "/schema", TRUE);
        env = g_environ_setenv (env, "GNOME_KEYRING_TEST_PATH", test->directory, TRUE);
        env = g_environ_setenv (env, "GNOME_KEYRING_TEST_SERVICE", test->bus_name, TRUE);
        if (test->mock_prompter)
diff --git a/daemon/gnome-keyring-gpg.desktop.in.in b/daemon/gnome-keyring-gpg.desktop.in.in
index 09fc515..b82ecde 100644
--- a/daemon/gnome-keyring-gpg.desktop.in.in
+++ b/daemon/gnome-keyring-gpg.desktop.in.in
@@ -2,7 +2,7 @@
 Type=Application
 _Name=GPG Password Agent
 _Comment=GNOME Keyring: GPG Agent
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --components=gpg
+Exec= bindir@/gnome-keyring-daemon --start --components=gpg
 OnlyShowIn=GNOME;Unity;MATE;
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-AutoRestart=false
diff --git a/daemon/gnome-keyring-pkcs11.desktop.in.in b/daemon/gnome-keyring-pkcs11.desktop.in.in
index f5f0616..1b8b2c6 100644
--- a/daemon/gnome-keyring-pkcs11.desktop.in.in
+++ b/daemon/gnome-keyring-pkcs11.desktop.in.in
@@ -2,7 +2,7 @@
 Type=Application
 _Name=Certificate and Key Storage
 _Comment=GNOME Keyring: PKCS#11 Component
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --components=pkcs11
+Exec= bindir@/gnome-keyring-daemon --start --components=pkcs11
 OnlyShowIn=GNOME;Unity;MATE;
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-AutoRestart=false
diff --git a/daemon/gnome-keyring-secrets.desktop.in.in b/daemon/gnome-keyring-secrets.desktop.in.in
index b612a47..a9e6a18 100644
--- a/daemon/gnome-keyring-secrets.desktop.in.in
+++ b/daemon/gnome-keyring-secrets.desktop.in.in
@@ -2,7 +2,7 @@
 Type=Application
 _Name=Secret Storage Service
 _Comment=GNOME Keyring: Secret Service
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --components=secrets
+Exec= bindir@/gnome-keyring-daemon --start --components=secrets
 OnlyShowIn=GNOME;Unity;MATE;
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-AutoRestart=false
diff --git a/daemon/gnome-keyring-ssh.desktop.in.in b/daemon/gnome-keyring-ssh.desktop.in.in
index 347d2d3..88a727f 100644
--- a/daemon/gnome-keyring-ssh.desktop.in.in
+++ b/daemon/gnome-keyring-ssh.desktop.in.in
@@ -2,7 +2,7 @@
 Type=Application
 _Name=SSH Key Agent
 _Comment=GNOME Keyring: SSH Agent
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --components=ssh
+Exec= bindir@/gnome-keyring-daemon --start --components=ssh
 OnlyShowIn=GNOME;Unity;MATE;
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-AutoRestart=false
diff --git a/daemon/gpg-agent/Makefile.am b/daemon/gpg-agent/Makefile.am
index e167037..ad7c059 100644
--- a/daemon/gpg-agent/Makefile.am
+++ b/daemon/gpg-agent/Makefile.am
@@ -1,33 +1,30 @@
 
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DGCK_API_SUBJECT_TO_CHANGE \
-       -DGCR_API_SUBJECT_TO_CHANGE \
-       $(DAEMON_CFLAGS)
-
 # ------------------------------------------------------------------------------
 # The ssh-agent component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkd-gpg-agent.la
 
 libgkd_gpg_agent_la_SOURCES = \
-       gkd-gpg-agent.c gkd-gpg-agent.h \
-       gkd-gpg-agent-private.h \
-       gkd-gpg-agent-ops.c
+       daemon/gpg-agent/gkd-gpg-agent.c \
+       daemon/gpg-agent/gkd-gpg-agent.h \
+       daemon/gpg-agent/gkd-gpg-agent-private.h \
+       daemon/gpg-agent/gkd-gpg-agent-ops.c
+libgkd_gpg_agent_la_CFLAGS = \
+       $(GCK_CFLAGS) \
+       $(GCR_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # Standalone binary
 
-noinst_PROGRAMS = \
+noinst_PROGRAMS += \
        gkd-gpg-agent-standalone
 
 gkd_gpg_agent_standalone_SOURCES = \
-       gkd-gpg-agent-standalone.c
-
+       daemon/gpg-agent/gkd-gpg-agent-standalone.c
+gkd_gpg_agent_standalone_CFLAGS = \
+       $(GCK_CFLAGS)
 gkd_gpg_agent_standalone_LDADD = \
        libgkd-gpg-agent.la \
-       $(top_builddir)/egg/libegg.la \
+       libegg.la \
        $(DAEMON_LIBS)
diff --git a/daemon/login/Makefile.am b/daemon/login/Makefile.am
index 7d5fd67..609be5b 100644
--- a/daemon/login/Makefile.am
+++ b/daemon/login/Makefile.am
@@ -1,25 +1,16 @@
 
-INCLUDES= \
-       -DPREFIX=\""$(prefix)"\" \
-       -DBINDIR=\""$(bindir)"\" \
-       -DLIBEXECDIR=\""$(libexecdir)"\" \
-       -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/daemon \
-       -I$(top_builddir) \
-       $(GCK_CFLAGS) \
-       $(GOBJECT_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       -DGCK_API_SUBJECT_TO_CHANGE
-
 # ------------------------------------------------------------------
 # DAEMON CODE
 
-noinst_LTLIBRARIES = libgkd-login.la
+noinst_LTLIBRARIES += libgkd-login.la
 
 libgkd_login_la_SOURCES = \
-       gkd-login.c gkd-login.h
-
+       daemon/login/gkd-login.c \
+       daemon/login/gkd-login.h \
+       $(NULL)
+libgkd_login_la_CFLAGS = \
+       $(GCK_CFLAGS) \
+       $(GOBJECT_CFLAGS)
 libgkd_login_la_LIBADD = \
        $(GCK_LIBS) \
        $(GOBJECT_LIBS) \
diff --git a/daemon/org.freedesktop.secrets.service.in b/daemon/org.freedesktop.secrets.service.in
index eb4b4dd..523675b 100644
--- a/daemon/org.freedesktop.secrets.service.in
+++ b/daemon/org.freedesktop.secrets.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
 Name=org.freedesktop.secrets
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --foreground --components=secrets
+Exec= bindir@/gnome-keyring-daemon --start --foreground --components=secrets
diff --git a/daemon/org.gnome.keyring.service.in b/daemon/org.gnome.keyring.service.in
index 0066101..b782399 100644
--- a/daemon/org.gnome.keyring.service.in
+++ b/daemon/org.gnome.keyring.service.in
@@ -1,3 +1,3 @@
 [D-BUS Service]
 Name=org.gnome.keyring
-Exec= VALGRIND_RUN@@bindir@/gnome-keyring-daemon --start --foreground --components=secrets
+Exec= bindir@/gnome-keyring-daemon --start --foreground --components=secrets
diff --git a/daemon/ssh-agent/Makefile.am b/daemon/ssh-agent/Makefile.am
index 9bef7c9..01d0907 100644
--- a/daemon/ssh-agent/Makefile.am
+++ b/daemon/ssh-agent/Makefile.am
@@ -1,34 +1,31 @@
 
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       $(DAEMON_CFLAGS) \
-       -DGCK_API_SUBJECT_TO_CHANGE
-
 # ------------------------------------------------------------------------------
 # The ssh-agent component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkd-ssh-agent.la
 
 libgkd_ssh_agent_la_SOURCES = \
-       gkd-ssh-agent.c gkd-ssh-agent.h \
-       gkd-ssh-agent-private.h \
-       gkd-ssh-agent-ops.c \
-       gkd-ssh-agent-proto.c
+       daemon/ssh-agent/gkd-ssh-agent.c \
+       daemon/ssh-agent/gkd-ssh-agent.h \
+       daemon/ssh-agent/gkd-ssh-agent-private.h \
+       daemon/ssh-agent/gkd-ssh-agent-ops.c \
+       daemon/ssh-agent/gkd-ssh-agent-proto.c
+libgkd_ssh_agent_la_CFLAGS = \
+       $(DAEMON_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # Standalone binary
 
-noinst_PROGRAMS = \
+noinst_PROGRAMS += \
        gkd-ssh-agent-standalone
 
 gkd_ssh_agent_standalone_SOURCES = \
-       gkd-ssh-agent-standalone.c
-
+       daemon/ssh-agent/gkd-ssh-agent-standalone.c
+gkd_ssh_agent_standalone_CFLAGS = \
+       $(DAEMON_CFLAGS)
 gkd_ssh_agent_standalone_LDADD = \
        libgkd-ssh-agent.la \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-secure.la \
+       libegg-buffer.la \
+       libegg-secure.la \
        $(DAEMON_LIBS)
diff --git a/egg/Makefile.am b/egg/Makefile.am
index 6b50242..0257037 100644
--- a/egg/Makefile.am
+++ b/egg/Makefile.am
@@ -1,6 +1,5 @@
-include $(top_srcdir)/Makefile.decl
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libegg.la \
        libegg-asn1x.la \
        libegg-buffer.la \
@@ -11,72 +10,65 @@ noinst_LTLIBRARIES = \
        libegg-hex.la \
        libegg-test.la
 
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GLIB_CFLAGS)
-
 libegg_la_CFLAGS = \
        $(LIBTASN1_CFLAGS) \
        $(GLIB_CFLAGS)
 
 libegg_la_SOURCES = \
-       dotlock.c dotlock.h \
-       egg-armor.c egg-armor.h \
-       egg-asn1x.c egg-asn1x.h \
-       egg-asn1-defs.c egg-asn1-defs.h \
-       egg-buffer.c egg-buffer.h \
-       egg-byte-array.c egg-byte-array.h \
-       egg-cleanup.c egg-cleanup.h \
-       egg-dh.c egg-dh.h \
-       egg-dn.c egg-dn.h \
-       egg-error.h \
-       egg-hex.c egg-hex.h \
-       egg-hkdf.c egg-hkdf.h \
-       egg-libgcrypt.c egg-libgcrypt.h \
-       egg-mkdtemp.c egg-mkdtemp.h \
-       egg-oid.c egg-oid.h \
-       egg-padding.c egg-padding.h \
-       egg-openssl.c egg-openssl.h \
-       egg-unix-credentials.c egg-unix-credentials.h \
-       egg-secure-memory.c egg-secure-memory.h \
-       egg-spawn.c egg-spawn.h \
-       egg-symkey.c egg-symkey.h \
-       egg-testing.c egg-testing.h \
-       egg-timegm.c egg-timegm.h \
-       egg-asn1-defs.h \
-       pk.asn.h pkix.asn.h \
+       egg/dotlock.c egg/dotlock.h \
+       egg/egg-armor.c egg/egg-armor.h \
+       egg/egg-asn1x.c egg/egg-asn1x.h \
+       egg/egg-asn1-defs.c egg/egg-asn1-defs.h \
+       egg/egg-buffer.c egg/egg-buffer.h \
+       egg/egg-byte-array.c egg/egg-byte-array.h \
+       egg/egg-cleanup.c egg/egg-cleanup.h \
+       egg/egg-dh.c egg/egg-dh.h \
+       egg/egg-dn.c egg/egg-dn.h \
+       egg/egg-error.h \
+       egg/egg-hex.c egg/egg-hex.h \
+       egg/egg-hkdf.c egg/egg-hkdf.h \
+       egg/egg-libgcrypt.c egg/egg-libgcrypt.h \
+       egg/egg-mkdtemp.c egg/egg-mkdtemp.h \
+       egg/egg-oid.c egg/egg-oid.h \
+       egg/egg-padding.c egg/egg-padding.h \
+       egg/egg-openssl.c egg/egg-openssl.h \
+       egg/egg-unix-credentials.c egg/egg-unix-credentials.h \
+       egg/egg-secure-memory.c egg/egg-secure-memory.h \
+       egg/egg-spawn.c egg/egg-spawn.h \
+       egg/egg-symkey.c egg/egg-symkey.h \
+       egg/egg-testing.c egg/egg-testing.h \
+       egg/egg-timegm.c egg/egg-timegm.h \
+       egg/egg-asn1-defs.h \
+       egg/pk.asn.h egg/pkix.asn.h \
        $(NULL)
 
-EXTRA_DIST = \
-       pk.asn \
-       pkix.asn \
+ASN1_FILES += \
+       egg/pk.asn \
+       egg/pkix.asn \
        $(NULL)
        
 # --------------------------------------------------------------------
 # COMMON STUFF COMPILED INTO SMALLER COMPONENTS
 
 libegg_asn1x_la_SOURCES = \
-       egg-asn1x.c egg-asn1x.h \
-       egg-asn1-defs.c egg-asn1-defs.h \
-       $(BUILT_SOURCES)
+       egg/egg-asn1x.c egg/egg-asn1x.h \
+       egg/egg-asn1-defs.c egg/egg-asn1-defs.h
 
 libegg_asn1x_la_CFLAGS = \
        $(LIBTASN1_CFLAGS) \
        $(GLIB_CFLAGS)
 
 libegg_secure_la_SOURCES = \
-       egg-secure-memory.c egg-secure-memory.h
+       egg/egg-secure-memory.c egg/egg-secure-memory.h
 
 libegg_buffer_la_SOURCES = \
-       egg-buffer.c egg-buffer.h 
+       egg/egg-buffer.c egg/egg-buffer.h
 
 libegg_creds_la_SOURCES = \
-       egg-unix-credentials.c egg-unix-credentials.h   
+       egg/egg-unix-credentials.c egg/egg-unix-credentials.h
 
 libegg_dbus_la_SOURCES = \
-       egg-dbus.c egg-dbus.h
+       egg/egg-dbus.c egg/egg-dbus.h
 
 libegg_dbus_la_CFLAGS = \
        $(DBUS_CFLAGS) \
@@ -87,12 +79,12 @@ libegg_dbus_la_LIBADD = \
        $(GLIB_LIBS)
 
 libegg_prompt_la_SOURCES = \
-       egg-dh.c egg-dh.h \
-       egg-hex.c egg-hex.h \
-       egg-hkdf.c egg-hkdf.h \
-       egg-libgcrypt.c egg-libgcrypt.h \
-       egg-padding.c egg-padding.h \
-       egg-secure-memory.c egg-secure-memory.h
+       egg/egg-dh.c egg/egg-dh.h \
+       egg/egg-hex.c egg/egg-hex.h \
+       egg/egg-hkdf.c egg/egg-hkdf.h \
+       egg/egg-libgcrypt.c egg/egg-libgcrypt.h \
+       egg/egg-padding.c egg/egg-padding.h \
+       egg/egg-secure-memory.c egg/egg-secure-memory.h
 
 libegg_prompt_la_CFLAGS = \
        -DEGG_DH_NO_ASN1=1 \
@@ -104,7 +96,7 @@ libegg_prompt_la_LIBS = \
        $(GLIB_LIBS)
 
 libegg_hex_la_SOURCES = \
-       egg-hex.c egg-hex.h
+       egg/egg-hex.c egg/egg-hex.h
 
 libegg_hex_la_CFLAGS = \
        $(GLIB_CFLAGS)
@@ -113,8 +105,8 @@ libegg_hex_la_LIBS = \
        $(GLIB_LIBS)
 
 libegg_test_la_SOURCES = \
-       egg-mkdtemp.c egg-mkdtemp.h \
-       egg-testing.c egg-testing.h
+       egg/egg-mkdtemp.c egg/egg-mkdtemp.h \
+       egg/egg-testing.c egg/egg-testing.h
 
 libegg_test_la_CFLAGS = \
        $(GLIB_CFLAGS)
@@ -122,23 +114,23 @@ libegg_test_la_CFLAGS = \
 libegg_test_la_LIBS = \
        $(GLIB_LIBS)
 
-asn:
-       asn1Parser -o pk.asn.h pk.asn
-       asn1Parser -o pkix.asn.h pkix.asn
-       sed -i 's|#include.*|/* \0 */|' pk.asn.h pkix.asn.h
-       asn1Parser -o test.asn.h test.asn
-       sed -i 's|#include.*|/* \0 */|' test.asn.h
+ASN1_FILES += \
+       egg/pk.asn \
+       egg/pkix.asn \
+       egg/test.asn
 
 # -------------------------------------------------------------------
 # TESTS
 
-LDADD =  \
-       $(top_builddir)/egg/libegg.la \
+EXTRA_DIST += egg/fixtures
+
+egg_LIBS =  \
+       libegg.la \
        $(LIBGCRYPT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS)
 
-TEST_PROGS = \
+TEST_PROGS += \
        test-asn1 \
        test-asn1x \
        test-dn \
@@ -154,23 +146,44 @@ TEST_PROGS = \
        test-dh \
        test-spawn
 
-test_asn1_SOURCES = \
-       test-asn1.c \
-       test.asn.h
+test_asn1_SOURCES = egg/test-asn1.c egg/test.asn.h
+test_asn1_LDADD = $(egg_LIBS)
+
+test_asn1x_SOURCES = egg/test-asn1x.c
+test_asn1x_LDADD = libegg-asn1x.la $(egg_LIBS)
+
+test_dn_SOURCES = egg/test-dn.c
+test_dn_LDADD = $(egg_LIBS)
+
+test_cleanup_SOURCES = egg/test-cleanup.c
+test_cleanup_LDADD = $(egg_LIBS)
+
+test_hex_SOURCES = egg/test-hex.c
+test_hex_LDADD = $(egg_LIBS)
+
+test_hkdf_SOURCES = egg/test-hkdf.c
+test_hkdf_LDADD = $(egg_LIBS)
+
+test_oid_SOURCES = egg/test-oid.c
+test_oid_LDADD = $(egg_LIBS)
+
+test_secmem_SOURCES = egg/test-secmem.c
+test_secmem_LDADD = $(egg_LIBS)
 
-test_asn1x_LDADD = \
-       $(top_builddir)/egg/libegg-asn1x.la \
-       $(LDADD)
+test_padding_SOURCES = egg/test-padding.c
+test_padding_LDADD = $(egg_LIBS)
 
-check_PROGRAMS = $(TEST_PROGS)
+test_symkey_SOURCES = egg/test-symkey.c
+test_symkey_LDADD = $(egg_LIBS)
 
-test: $(TEST_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+test_armor_SOURCES = egg/test-armor.c
+test_armor_LDADD = $(egg_LIBS)
 
-check-local: test
+test_openssl_SOURCES = egg/test-openssl.c
+test_openssl_LDADD = $(egg_LIBS)
 
-all-local: $(check_PROGRAMS)
+test_dh_SOURCES = egg/test-dh.c
+test_dh_LDADD = $(egg_LIBS)
 
-EXTRA_DIST += \
-       test.asn \
-       fixtures
+test_spawn_SOURCES = egg/test-spawn.c
+test_spawn_LDADD = $(egg_LIBS)
diff --git a/egg/egg-mkdtemp.c b/egg/egg-mkdtemp.c
index c452c33..3aad248 100644
--- a/egg/egg-mkdtemp.c
+++ b/egg/egg-mkdtemp.c
@@ -14,6 +14,7 @@
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    <http://www.gnu.org/licenses/>.
+*/
 
 /* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c.  */
 
diff --git a/egg/egg-mkdtemp.h b/egg/egg-mkdtemp.h
index dde7e02..b143838 100644
--- a/egg/egg-mkdtemp.h
+++ b/egg/egg-mkdtemp.h
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    <http://www.gnu.org/licenses/>.
+*/
 
 /* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c.  */
 
diff --git a/egg/egg-timegm.c b/egg/egg-timegm.c
index 7964816..c3effdf 100644
--- a/egg/egg-timegm.c
+++ b/egg/egg-timegm.c
@@ -14,6 +14,7 @@
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    <http://www.gnu.org/licenses/>.
+*/
 
 /* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c.  */
 
diff --git a/egg/egg-timegm.h b/egg/egg-timegm.h
index ae32a1e..b24c14c 100644
--- a/egg/egg-timegm.h
+++ b/egg/egg-timegm.h
@@ -15,6 +15,7 @@
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    <http://www.gnu.org/licenses/>.
+*/
 
 /* Extracted from misc/mkdtemp.c and sysdeps/posix/tempname.c.  */
 
diff --git a/egg/test-asn1.c b/egg/test-asn1.c
index 598d26a..7e03549 100644
--- a/egg/test-asn1.c
+++ b/egg/test-asn1.c
@@ -1747,7 +1747,7 @@ setup (Test *test, gconstpointer unused)
 {
        GBytes *bytes;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der",
+       if (!g_file_get_contents (SRCDIR "/egg/fixtures/test-certificate-1.der",
                                  (gchar**)&test->data, &test->n_data, NULL))
                g_assert_not_reached ();
 
diff --git a/egg/test-asn1x.c b/egg/test-asn1x.c
index 879def2..fd347e2 100644
--- a/egg/test-asn1x.c
+++ b/egg/test-asn1x.c
@@ -74,11 +74,11 @@ typedef struct {
 } Fixture;
 
 static const Fixture parse_test_fixtures[] = {
-       { pkix_asn1_tab, SRCDIR "/fixtures/test-certificate-1.der", "Certificate" },
-       { pkix_asn1_tab, SRCDIR "/fixtures/test-pkcs8-1.der", "pkcs-8-PrivateKeyInfo" },
-       { pk_asn1_tab, SRCDIR "/fixtures/test-rsakey-1.der", "RSAPrivateKey" },
-       { pkix_asn1_tab, SRCDIR "/fixtures/test-pkcs7-1.der", "pkcs-7-ContentInfo" },
-       { pkix_asn1_tab, SRCDIR "/fixtures/test-pkcs7-2.der", "pkcs-7-ContentInfo" },
+       { pkix_asn1_tab, SRCDIR "/egg/fixtures/test-certificate-1.der", "Certificate" },
+       { pkix_asn1_tab, SRCDIR "/egg/fixtures/test-pkcs8-1.der", "pkcs-8-PrivateKeyInfo" },
+       { pk_asn1_tab, SRCDIR "/egg/fixtures/test-rsakey-1.der", "RSAPrivateKey" },
+       { pkix_asn1_tab, SRCDIR "/egg/fixtures/test-pkcs7-1.der", "pkcs-7-ContentInfo" },
+       { pkix_asn1_tab, SRCDIR "/egg/fixtures/test-pkcs7-2.der", "pkcs-7-ContentInfo" },
 };
 
 static void
@@ -191,9 +191,9 @@ main (int argc, char **argv)
                g_free (name);
        }
 
-       g_test_add ("/asn1x/pkcs12-decode/1", Test, SRCDIR "/fixtures/test-pkcs12-1.der",
+       g_test_add ("/asn1x/pkcs12-decode/1", Test, SRCDIR "/egg/fixtures/test-pkcs12-1.der",
                    setup, test_pkcs12_decode, teardown);
-       g_test_add ("/asn1x/pkcs5-personal-name/invalid", Test, SRCDIR 
"/fixtures/test-personalname-invalid.der",
+       g_test_add ("/asn1x/pkcs5-personal-name/invalid", Test, SRCDIR 
"/egg/fixtures/test-personalname-invalid.der",
                    setup, test_personal_name_invalid, teardown);
 
        return g_test_run ();
diff --git a/egg/test-dn.c b/egg/test-dn.c
index 347a5cd..d080079 100644
--- a/egg/test-dn.c
+++ b/egg/test-dn.c
@@ -46,7 +46,7 @@ setup (Test *test, gconstpointer unused)
 {
        GBytes *bytes;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der",
+       if (!g_file_get_contents (SRCDIR "/egg/fixtures/test-certificate-1.der",
                                  (gchar**)&test->data, &test->n_data, NULL))
                g_assert_not_reached ();
 
diff --git a/egg/test-openssl.c b/egg/test-openssl.c
index 4f51126..4e41767 100644
--- a/egg/test-openssl.c
+++ b/egg/test-openssl.c
@@ -53,7 +53,7 @@ setup (Test *test, gconstpointer unused)
        gchar *contents;
        gsize length;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/pem-rsa-enc.key", &contents, &length, NULL))
+       if (!g_file_get_contents (SRCDIR "/egg/fixtures/pem-rsa-enc.key", &contents, &length, NULL))
                g_assert_not_reached ();
 
        test->input = g_bytes_new_take (contents, length);
diff --git a/egg/test-spawn.c b/egg/test-spawn.c
index 347f9ba..ee63b29 100644
--- a/egg/test-spawn.c
+++ b/egg/test-spawn.c
@@ -175,7 +175,7 @@ test_sync (void)
        data.parent_pid = getpid();
        data.index = 80;
 
-       ret = egg_spawn_sync_with_callbacks (SRCDIR "/fixtures",
+       ret = egg_spawn_sync_with_callbacks (SRCDIR "/egg/fixtures",
                                             echo_argv, NULL, 0, &pid,
                                             &echo_callbacks, &data,
                                             &exit_status, &error);
@@ -196,7 +196,7 @@ test_sync_error (void)
        GError *error = NULL;
        gboolean ret;
 
-       ret = egg_spawn_sync_with_callbacks (SRCDIR "/fixtures",
+       ret = egg_spawn_sync_with_callbacks (SRCDIR "/egg/fixtures",
                                             error_argv, NULL, 0, NULL,
                                             NULL, NULL,
                                             NULL, &error);
@@ -219,7 +219,7 @@ test_async (void)
        data.index = 80;
        data.is_async = TRUE;
 
-       ret = egg_spawn_async_with_callbacks (SRCDIR "/fixtures",
+       ret = egg_spawn_async_with_callbacks (SRCDIR "/egg/fixtures",
                                             echo_argv, NULL, 0, &pid,
                                             &echo_callbacks, &data,
                                             NULL, &error);
@@ -246,7 +246,7 @@ test_async_none (void)
        data.parent_pid = getpid();
        data.is_async = TRUE;
 
-       ret = egg_spawn_async_with_callbacks (SRCDIR "/fixtures",
+       ret = egg_spawn_async_with_callbacks (SRCDIR "/egg/fixtures",
                                             echo_argv, NULL, 0, NULL,
                                             &null_callbacks, &data,
                                             NULL, &error);
@@ -267,7 +267,7 @@ test_async_error (void)
        GError *error = NULL;
        guint ret;
 
-       ret = egg_spawn_async_with_callbacks (SRCDIR "/fixtures",
+       ret = egg_spawn_async_with_callbacks (SRCDIR "/egg/fixtures",
                                             error_argv, NULL, 0, NULL,
                                             NULL, NULL,
                                             NULL, &error);
diff --git a/pam/Makefile.am b/pam/Makefile.am
index 2e6362d..8707ab6 100644
--- a/pam/Makefile.am
+++ b/pam/Makefile.am
@@ -1,27 +1,20 @@
 
-INCLUDES = \
-       -I$(top_srcdir) \
-       -DGNOME_KEYRING_DAEMON=\""$(bindir)/gnome-keyring-daemon"\" 
-
 pamlibdir = $(PAM_DEST_DIR)
 pamlib_LTLIBRARIES = pam_gnome_keyring.la
 
 pam_gnome_keyring_la_SOURCES = \
-       gkr-pam.h \
-       gkr-pam-client.c \
-       gkr-pam-module.c \
-       gkr-pam-stubs.c
-
+       pam/gkr-pam.h \
+       pam/gkr-pam-client.c \
+       pam/gkr-pam-module.c \
+       pam/gkr-pam-stubs.c
+pam_gnome_keyring_la_CFLAGS = \
+       -DGNOME_KEYRING_DAEMON=\""$(bindir)/gnome-keyring-daemon"\"
 pam_gnome_keyring_la_LIBADD = \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
-       $(top_builddir)/egg/libegg-secure.la \
+       libegg-buffer.la \
+       libegg-creds.la \
+       libegg-secure.la \
        $(LIBSELINUX) \
        -lpam
-       
 pam_gnome_keyring_la_LDFLAGS = \
        -module -avoid-version \
        -export-symbols-regex 'pam_sm_'
-
-install-pam: install
-       @echo "WARNING: install-pam is no longer used, use the --with-pam-dir configure option instead"
diff --git a/pkcs11/Makefile.am b/pkcs11/Makefile.am
index ab4427b..c2654c6 100644
--- a/pkcs11/Makefile.am
+++ b/pkcs11/Makefile.am
@@ -1,15 +1,6 @@
 
-EXTRA_DIST = \
-       pkcs11i.h \
-       pkcs11.h \
-       pkcs11n.h \
-       pkcs11x.h
-
-SUBDIRS = . \
-       gkm \
-       wrap-layer \
-       rpc-layer \
-       secret-store \
-       ssh-store \
-       xdg-store \
-       gnome2-store
+EXTRA_DIST += \
+       pkcs11/pkcs11i.h \
+       pkcs11/pkcs11.h \
+       pkcs11/pkcs11n.h \
+       pkcs11/pkcs11x.h
diff --git a/pkcs11/gkm/Makefile.am b/pkcs11/gkm/Makefile.am
index 45f61b0..20c7d91 100644
--- a/pkcs11/gkm/Makefile.am
+++ b/pkcs11/gkm/Makefile.am
@@ -1,111 +1,152 @@
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GOBJECT_CFLAGS) \
-       $(LIBGCRYPT_CFLAGS) \
-       $(GLIB_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # The GKM library
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm.la
 
-BUILT_SOURCES = \
+gkm_BUILT = \
        gkm-marshal.c gkm-marshal.h
 
-libgkm_la_SOURCES = \
-       gkm-aes-key.c gkm-aes-key.h \
-       gkm-aes-mechanism.c gkm-aes-mechanism.h \
-       gkm-assertion.c gkm-assertion.h \
-       gkm-attributes.c gkm-attributes.h \
-       gkm-certificate.c gkm-certificate.h \
-       gkm-certificate-key.c gkm-certificate-key.h \
-       gkm-credential.c gkm-credential.h \
-       gkm-crypto.c gkm-crypto.h \
-       gkm-data-asn1.c gkm-data-asn1.h \
-       gkm-data-der.c gkm-data-der.h \
-       gkm-data-types.h \
-       gkm-debug.c gkm-debug.h \
-       gkm-dh-key.c gkm-dh-key.h \
-       gkm-dh-mechanism.c gkm-dh-mechanism.h \
-       gkm-dh-private-key.c gkm-dh-private-key.h \
-       gkm-dh-public-key.c gkm-dh-public-key.h \
-       gkm-dsa-mechanism.c gkm-dsa-mechanism.h \
-       gkm-factory.c gkm-factory.h \
-       gkm-file-tracker.c gkm-file-tracker.h \
-       gkm-generic-key.c gkm-generic-key.h \
-       gkm-hkdf-mechanism.c gkm-hkdf-mechanism.h \
-       gkm-log.c gkm-log.h \
-       gkm-manager.c gkm-manager.h \
-       gkm-memory-store.c gkm-memory-store.h \
-       gkm-mock.c gkm-mock.h \
-       gkm-module.c gkm-module.h gkm-module-ep.h \
-       gkm-null-key.c gkm-null-key.h \
-       gkm-null-mechanism.c gkm-null-mechanism.h \
-       gkm-object.c gkm-object.h \
-       gkm-oids.h \
-       gkm-private-xsa-key.c gkm-private-xsa-key.h \
-       gkm-public-xsa-key.c gkm-public-xsa-key.h \
-       gkm-rsa-mechanism.c gkm-rsa-mechanism.h \
-       gkm-secret.c gkm-secret.h \
-       gkm-secret-key.c gkm-secret-key.h \
-       gkm-serializable.c gkm-serializable.h \
-       gkm-session.c gkm-session.h \
-       gkm-sexp.c gkm-sexp.h \
-       gkm-sexp-key.c gkm-sexp-key.h \
-       gkm-store.c gkm-store.h \
-       gkm-test.c gkm-test.h \
-       gkm-timer.c gkm-timer.h \
-       gkm-transaction.c gkm-transaction.h \
-       gkm-trust.c gkm-trust.h \
-       gkm-types.h \
-       gkm-util.c gkm-util.h \
-       $(BUILT_SOURCES)
+BUILT_SOURCES += $(gkm_BUILT)
 
+libgkm_la_SOURCES = \
+       pkcs11/gkm/gkm-aes-key.c \
+       pkcs11/gkm/gkm-aes-key.h \
+       pkcs11/gkm/gkm-aes-mechanism.c \
+       pkcs11/gkm/gkm-aes-mechanism.h \
+       pkcs11/gkm/gkm-assertion.c \
+       pkcs11/gkm/gkm-assertion.h \
+       pkcs11/gkm/gkm-attributes.c \
+       pkcs11/gkm/gkm-attributes.h \
+       pkcs11/gkm/gkm-certificate.c \
+       pkcs11/gkm/gkm-certificate.h \
+       pkcs11/gkm/gkm-certificate-key.c \
+       pkcs11/gkm/gkm-certificate-key.h \
+       pkcs11/gkm/gkm-credential.c \
+       pkcs11/gkm/gkm-credential.h \
+       pkcs11/gkm/gkm-crypto.c \
+       pkcs11/gkm/gkm-crypto.h \
+       pkcs11/gkm/gkm-data-asn1.c \
+       pkcs11/gkm/gkm-data-asn1.h \
+       pkcs11/gkm/gkm-data-der.c \
+       pkcs11/gkm/gkm-data-der.h \
+       pkcs11/gkm/gkm-data-types.h \
+       pkcs11/gkm/gkm-debug.c \
+       pkcs11/gkm/gkm-debug.h \
+       pkcs11/gkm/gkm-dh-key.c \
+       pkcs11/gkm/gkm-dh-key.h \
+       pkcs11/gkm/gkm-dh-mechanism.c \
+       pkcs11/gkm/gkm-dh-mechanism.h \
+       pkcs11/gkm/gkm-dh-private-key.c \
+       pkcs11/gkm/gkm-dh-private-key.h \
+       pkcs11/gkm/gkm-dh-public-key.c \
+       pkcs11/gkm/gkm-dh-public-key.h \
+       pkcs11/gkm/gkm-dsa-mechanism.c \
+       pkcs11/gkm/gkm-dsa-mechanism.h \
+       pkcs11/gkm/gkm-factory.c \
+       pkcs11/gkm/gkm-factory.h \
+       pkcs11/gkm/gkm-file-tracker.c \
+       pkcs11/gkm/gkm-file-tracker.h \
+       pkcs11/gkm/gkm-generic-key.c \
+       pkcs11/gkm/gkm-generic-key.h \
+       pkcs11/gkm/gkm-hkdf-mechanism.c \
+       pkcs11/gkm/gkm-hkdf-mechanism.h \
+       pkcs11/gkm/gkm-log.c \
+       pkcs11/gkm/gkm-log.h \
+       pkcs11/gkm/gkm-manager.c \
+       pkcs11/gkm/gkm-manager.h \
+       pkcs11/gkm/gkm-memory-store.c \
+       pkcs11/gkm/gkm-memory-store.h \
+       pkcs11/gkm/gkm-mock.c \
+       pkcs11/gkm/gkm-mock.h \
+       pkcs11/gkm/gkm-module.c \
+       pkcs11/gkm/gkm-module.h \
+       pkcs11/gkm/gkm-module-ep.h \
+       pkcs11/gkm/gkm-null-key.c \
+       pkcs11/gkm/gkm-null-key.h \
+       pkcs11/gkm/gkm-null-mechanism.c \
+       pkcs11/gkm/gkm-null-mechanism.h \
+       pkcs11/gkm/gkm-object.c \
+       pkcs11/gkm/gkm-object.h \
+       pkcs11/gkm/gkm-oids.h \
+       pkcs11/gkm/gkm-private-xsa-key.c \
+       pkcs11/gkm/gkm-private-xsa-key.h \
+       pkcs11/gkm/gkm-public-xsa-key.c \
+       pkcs11/gkm/gkm-public-xsa-key.h \
+       pkcs11/gkm/gkm-rsa-mechanism.c \
+       pkcs11/gkm/gkm-rsa-mechanism.h \
+       pkcs11/gkm/gkm-secret.c \
+       pkcs11/gkm/gkm-secret.h \
+       pkcs11/gkm/gkm-secret-key.c \
+       pkcs11/gkm/gkm-secret-key.h \
+       pkcs11/gkm/gkm-serializable.c \
+       pkcs11/gkm/gkm-serializable.h \
+       pkcs11/gkm/gkm-session.c \
+       pkcs11/gkm/gkm-session.h \
+       pkcs11/gkm/gkm-sexp.c \
+       pkcs11/gkm/gkm-sexp.h \
+       pkcs11/gkm/gkm-sexp-key.c \
+       pkcs11/gkm/gkm-sexp-key.h \
+       pkcs11/gkm/gkm-store.c \
+       pkcs11/gkm/gkm-store.h \
+       pkcs11/gkm/gkm-test.c \
+       pkcs11/gkm/gkm-test.h \
+       pkcs11/gkm/gkm-timer.c \
+       pkcs11/gkm/gkm-timer.h \
+       pkcs11/gkm/gkm-transaction.c \
+       pkcs11/gkm/gkm-transaction.h \
+       pkcs11/gkm/gkm-trust.c \
+       pkcs11/gkm/gkm-trust.h \
+       pkcs11/gkm/gkm-types.h \
+       pkcs11/gkm/gkm-util.c \
+       pkcs11/gkm/gkm-util.h \
+       $(gkm_BUILT)
 libgkm_la_CFLAGS = \
+       -I$(srcdir)/pkcs11 \
        -DG_LOG_DOMAIN=\"Gkm\" \
        $(GOBJECT_CFLAGS) \
        $(LIBGCRYPT_CFLAGS) \
        $(LIBTASN1_CFLAGS) \
        $(GLIB_CFLAGS)
-
 libgkm_la_LIBADD = \
-       $(top_builddir)/egg/libegg.la \
+       libegg.la \
        $(GOBJECT_LIBS) \
        $(LIBGCRYPT_LIBS) \
        $(GLIB_LIBS)
 
-gkm-marshal.h: gkm-marshal.list $(GLIB_GENMARSHAL)
+gkm-marshal.h: pkcs11/gkm/gkm-marshal.list $(GLIB_GENMARSHAL)
        $(GLIB_GENMARSHAL) $< --header --prefix=gkm_marshal > $@
-
-gkm-marshal.c: gkm-marshal.list $(GLIB_GENMARSHAL)
+gkm-marshal.c: pkcs11/gkm/gkm-marshal.list $(GLIB_GENMARSHAL)
        echo "#include \"gkm-marshal.h\"" > $@ && \
        $(GLIB_GENMARSHAL) $< --body --prefix=gkm_marshal >> $@
 
-EXTRA_DIST = \
-       gkm-marshal.list
+EXTRA_DIST += \
+       pkcs11/gkm/gkm-marshal.list
 
 # -------------------------------------------------------------------------------
 # TESTS
 
-LDADD = \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
-       $(GLIB_LIBS) \
-       $(GTHREAD_LIBS) \
-       $(LIBGCRYPT_LIBS)
+EXTRA_DIST += pkcs11/gkm/fixtures
 
-noinst_LIBRARIES = libgkm-mock.a
+noinst_LIBRARIES += libgkm-mock.a
 
 libgkm_mock_a_SOURCES = \
-       mock-module.c mock-module.h \
-       mock-locked-object.c mock-locked-object.h \
-       test.asn.h
+       pkcs11/gkm/mock-module.c \
+       pkcs11/gkm/mock-module.h \
+       pkcs11/gkm/mock-locked-object.c \
+       pkcs11/gkm/mock-locked-object.h \
+       pkcs11/gkm/test.asn.h
 
-TEST_PROGS = \
+gkm_LIBS = \
+       libgkm-mock.a \
+       libgkm.la \
+       libegg.la \
+       $(GLIB_LIBS) \
+       $(GTHREAD_LIBS) \
+       $(LIBGCRYPT_LIBS)
+
+TEST_PROGS += \
        test-attributes \
        test-credential \
        test-data-asn1 \
@@ -120,43 +161,43 @@ TEST_PROGS = \
        test-timer \
        test-transaction
 
-test_credential_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_attributes_SOURCES = pkcs11/gkm/test-attributes.c
+test_attributes_LDADD = $(gkm_LIBS)
 
-test_memory_store_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_credential_SOURCES = pkcs11/gkm/test-credential.c
+test_credential_LDADD = $(gkm_LIBS)
 
-test_object_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_data_asn1_SOURCES = pkcs11/gkm/test-data-asn1.c
+test_data_asn1_LDADD = $(gkm_LIBS)
 
-test_certificate_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_data_der_SOURCES = pkcs11/gkm/test-data-der.c
+test_data_der_LDADD = $(gkm_LIBS)
 
-test_store_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_file_tracker_SOURCES = pkcs11/gkm/test-file-tracker.c
+test_file_tracker_LDADD = $(gkm_LIBS)
 
-test_timer_LDADD = \
-       libgkm-mock.a \
-       $(LDADD)
+test_memory_store_SOURCES = pkcs11/gkm/test-memory-store.c
+test_memory_store_LDADD = $(gkm_LIBS)
 
-check_PROGRAMS = $(TEST_PROGS)
+test_object_SOURCES = pkcs11/gkm/test-object.c
+test_object_LDADD = $(gkm_LIBS)
 
-test: $(TEST_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+test_certificate_SOURCES = pkcs11/gkm/test-certificate.c
+test_certificate_LDADD = $(gkm_LIBS)
 
-check-local: test
+test_secret_SOURCES = pkcs11/gkm/test-secret.c
+test_secret_LDADD = $(gkm_LIBS)
 
-all-local: $(check_PROGRAMS)
+test_sexp_SOURCES = pkcs11/gkm/test-sexp.c
+test_sexp_LDADD = $(gkm_LIBS)
 
-EXTRA_DIST += \
-       test.asn \
-       fixtures
+test_store_SOURCES = pkcs11/gkm/test-store.c
+test_store_LDADD = $(gkm_LIBS)
+
+test_timer_SOURCES = pkcs11/gkm/test-timer.c
+test_timer_LDADD = $(gkm_LIBS)
+
+test_transaction_SOURCES = pkcs11/gkm/test-transaction.c
+test_transaction_LDADD = $(gkm_LIBS)
 
-asn:
-       asn1Parser -o test.asn.h test.asn
-       sed -i 's|#include.*|/* \0 */|' test.asn.h
+ASN1_FILES += pkcs11/gkm/test.asn
diff --git a/pkcs11/gkm/mock-module.c b/pkcs11/gkm/mock-module.c
index 5676026..4b4fb55 100644
--- a/pkcs11/gkm/mock-module.c
+++ b/pkcs11/gkm/mock-module.c
@@ -109,7 +109,7 @@ mock_module_object_new (GkmSession *session)
                { CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
        };
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &data, &n_data, NULL))
                g_assert_not_reached ();
 
        attrs[0].pValue = data;
diff --git a/pkcs11/gkm/test-certificate.c b/pkcs11/gkm/test-certificate.c
index 9356ad2..a74577c 100644
--- a/pkcs11/gkm/test-certificate.c
+++ b/pkcs11/gkm/test-certificate.c
@@ -53,7 +53,7 @@ setup_basic (Test* test,
        test->module = mock_module_initialize_and_enter ();
        test->session = mock_module_open_session (TRUE);
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &data, &length, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &data, &length, NULL))
                g_assert_not_reached ();
 
        test->certificate_data = g_bytes_new_take (data, length);
diff --git a/pkcs11/gkm/test-data-asn1.c b/pkcs11/gkm/test-data-asn1.c
index 7978652..5b20bb2 100644
--- a/pkcs11/gkm/test-data-asn1.c
+++ b/pkcs11/gkm/test-data-asn1.c
@@ -50,7 +50,7 @@ setup (Test *test, gconstpointer unused)
        gchar *contents;
        gsize length;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &contents, &length, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", &contents, &length, 
NULL))
                g_assert_not_reached ();
 
        data = g_bytes_new_take (contents, length);
diff --git a/pkcs11/gkm/test-data-der.c b/pkcs11/gkm/test-data-der.c
index 592ed9b..70253ec 100644
--- a/pkcs11/gkm/test-data-der.c
+++ b/pkcs11/gkm/test-data-der.c
@@ -119,7 +119,7 @@ setup (Test *test, gconstpointer unused)
 {
        GBytes *data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &test->certificate_data, 
&test->n_certificate_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", 
&test->certificate_data, &test->n_certificate_data, NULL))
                g_assert_not_reached ();
 
        data = g_bytes_new (test->certificate_data, test->n_certificate_data);
@@ -127,7 +127,7 @@ setup (Test *test, gconstpointer unused)
        g_assert (test->certificate != NULL);
        g_bytes_unref (data);
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-2.der", &test->certificate2_data, 
&test->n_certificate2_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-2.der", 
&test->certificate2_data, &test->n_certificate2_data, NULL))
                g_assert_not_reached ();
        data = g_bytes_new (test->certificate2_data, test->n_certificate2_data);
        test->certificate2 = egg_asn1x_create_and_decode (pkix_asn1_tab, "Certificate", data);
@@ -342,7 +342,7 @@ test_read_ca_certificates_public_key_info (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/ca-certificates.crt", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/ca-certificates.crt", &data, &n_data, NULL))
                g_assert_not_reached ();
 
        bytes = g_bytes_new_take (data, n_data);
@@ -448,7 +448,7 @@ test_read_all_pkcs8 (Test *test, gconstpointer unused)
        gsize n_data;
        gchar *path;
 
-       dir = g_dir_open (SRCDIR "/fixtures", 0, NULL);
+       dir = g_dir_open (SRCDIR "/pkcs11/gkm/fixtures", 0, NULL);
        g_assert (dir);
 
        for(;;) {
@@ -459,7 +459,7 @@ test_read_all_pkcs8 (Test *test, gconstpointer unused)
                if (!g_pattern_match_simple ("der-key-*", name))
                        continue;
 
-               path = g_build_filename (SRCDIR "/fixtures", name, NULL);
+               path = g_build_filename (SRCDIR "/pkcs11/gkm/fixtures", name, NULL);
                if (!g_file_get_contents (path, &data, &n_data, NULL))
                        g_assert_not_reached ();
                g_free (path);
@@ -485,7 +485,7 @@ test_read_pkcs8_bad_password (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/der-key-encrypted-pkcs5.p8", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/der-key-encrypted-pkcs5.p8", &data, &n_data, 
NULL))
                g_assert_not_reached ();
 
        bytes = g_bytes_new_take (data, n_data);
diff --git a/pkcs11/gkm/test-object.c b/pkcs11/gkm/test-object.c
index 53c2e9b..d9b4adc 100644
--- a/pkcs11/gkm/test-object.c
+++ b/pkcs11/gkm/test-object.c
@@ -47,7 +47,7 @@ setup (Test* test, gconstpointer unused)
        test->module = mock_module_initialize_and_enter ();
        test->session = mock_module_open_session (TRUE);
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-1.der", &test->certificate_data, 
&test->n_certificate_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gkm/fixtures/test-certificate-1.der", 
&test->certificate_data, &test->n_certificate_data, NULL))
                g_assert_not_reached ();
 }
 
diff --git a/pkcs11/gnome2-store/Makefile.am b/pkcs11/gnome2-store/Makefile.am
index cca0a7f..1f7d8e4 100644
--- a/pkcs11/gnome2-store/Makefile.am
+++ b/pkcs11/gnome2-store/Makefile.am
@@ -1,109 +1,92 @@
-include $(top_srcdir)/Makefile.decl
-
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_builddir)/pkcs11 \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GOBJECT_CFLAGS) \
-       $(LIBGCRYPT_CFLAGS) \
-       $(GLIB_CFLAGS)
-
 
 # ------------------------------------------------------------------------------
 # The gnome2-store component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-gnome2-store.la
 
 libgkm_gnome2_store_la_SOURCES = \
-       gkm-gnome2-store.h \
-       gkm-gnome2-file.c gkm-gnome2-file.h \
-       gkm-gnome2-module.c gkm-gnome2-module.h \
-       gkm-gnome2-private-key.c gkm-gnome2-private-key.h \
-       gkm-gnome2-public-key.c gkm-gnome2-public-key.h \
-       gkm-gnome2-storage.c gkm-gnome2-storage.h
+       pkcs11/gnome2-store/gkm-gnome2-store.h \
+       pkcs11/gnome2-store/gkm-gnome2-file.c \
+       pkcs11/gnome2-store/gkm-gnome2-file.h \
+       pkcs11/gnome2-store/gkm-gnome2-module.c \
+       pkcs11/gnome2-store/gkm-gnome2-module.h \
+       pkcs11/gnome2-store/gkm-gnome2-private-key.c \
+       pkcs11/gnome2-store/gkm-gnome2-private-key.h \
+       pkcs11/gnome2-store/gkm-gnome2-public-key.c \
+       pkcs11/gnome2-store/gkm-gnome2-public-key.h \
+       pkcs11/gnome2-store/gkm-gnome2-storage.c \
+       pkcs11/gnome2-store/gkm-gnome2-storage.h \
+       $(NULL)
 
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(pkcs11standalonedir)
-
-module_LTLIBRARIES = \
+module_LTLIBRARIES += \
        gkm-gnome2-store-standalone.la
 
 gkm_gnome2_store_standalone_la_LDFLAGS = \
        -module -avoid-version \
        -no-undefined -export-symbols-regex 'C_GetFunctionList'
-
 gkm_gnome2_store_standalone_la_SOURCES = \
-       gkm-gnome2-standalone.c
-
+       pkcs11/gnome2-store/gkm-gnome2-standalone.c
 gkm_gnome2_store_standalone_la_LIBADD = \
        libgkm-gnome2-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
+       libgkm.la \
        $(GOBJECT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-
 # -------------------------------------------------------------------------------
+# TESTS
 
-LDADD = \
-       $(top_builddir)/pkcs11/gnome2-store/libgkm-gnome2-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
+gnome2_store_LIBS = \
+       libgkm-gnome2-store.la \
+       libgkm.la \
+       libegg.la \
        $(GLIB_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-if WITH_P11_TESTS
-CHECK_PROGS = check-gnome2-module
-else
-CHECK_PROGS =
-endif
+# if WITH_P11_TESTS
+# CHECK_PROGS = check-gnome2-module
+# CHECK_FILES = \
+#      p11-tests.conf
+# check_gnome2_module_CFLAGS = $(P11_TESTS_CFLAGS)
+# check_gnome2_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
+# endif
 
-CHECK_FILES = \
-       p11-tests.conf
-
-TEST_PROGS = \
+TEST_PROGS += \
        test-gnome2-file \
        test-gnome2-storage \
        test-gnome2-private-key \
        test-import
 
+test_gnome2_file_SOURCES = pkcs11/gnome2-store/test-gnome2-file.c
+test_gnome2_file_LDADD = $(gnome2_store_LIBS)
+
 test_gnome2_storage_SOURCES = \
-       test-gnome2-storage.c \
-       mock-gnome2-module.c mock-gnome2-module.h
+       pkcs11/gnome2-store/test-gnome2-storage.c \
+       pkcs11/gnome2-store/mock-gnome2-module.c \
+       pkcs11/gnome2-store/mock-gnome2-module.h
+test_gnome2_storage_LDADD = $(gnome2_store_LIBS)
 
 test_gnome2_private_key_SOURCES = \
-       test-gnome2-private-key.c \
-       mock-gnome2-module.c mock-gnome2-module.h
+       pkcs11/gnome2-store/test-gnome2-private-key.c \
+       pkcs11/gnome2-store/mock-gnome2-module.c \
+       pkcs11/gnome2-store/mock-gnome2-module.h
+test_gnome2_private_key_LDADD = $(gnome2_store_LIBS)
 
+test_import_SOURCES = pkcs11/gnome2-store/test-import.c
 test_import_CFLAGS = $(GCR_BASE_CFLAGS) $(GCK_CFLAGS)
-test_import_LDADD = $(GCR_BASE_LIBS) $(GCK_LIBS) $(LDADD)
-
-check_PROGRAMS = $(TEST_PROGS)
-
-test: $(TEST_PROGS) $(CHECK_PROGS) $(CHECK_FILES)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
-       @for prog in $(CHECK_PROGS); do SRCDIR='.' ./$$prog || exit 1; done
-
-check-local: test
-
-all-local: $(check_PROGRAMS)
-
-noinst_PROGRAMS = \
-       frob-gnome2-file \
-       $(CHECK_PROGS)
+test_import_LDADD = $(GCR_BASE_LIBS) $(GCK_LIBS) $(gnome2_store_LIBS)
 
-check_gnome2_module_CFLAGS = $(P11_TESTS_CFLAGS)
-check_gnome2_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
+noinst_PROGRAMS += \
+       frob-gnome2-file
 
-EXTRA_DIST = \
-       p11-tests.conf.in \
-       fixtures
+frob_gnome2_file_SOURCES = pkcs11/gnome2-store/frob-gnome2-file.c
+frob_gnome2_file_LDADD = $(gnome2_store_LIBS)
 
-CLEANFILES = \
-       $(CHECK_FILES)
+EXTRA_DIST += \
+       pkcs11/gnome2-store/p11-tests.conf.in \
+       pkcs11/gnome2-store/fixtures
diff --git a/pkcs11/gnome2-store/gkm-gnome2-file.c b/pkcs11/gnome2-store/gkm-gnome2-file.c
index ba0d5c6..53ad76d 100644
--- a/pkcs11/gnome2-store/gkm-gnome2-file.c
+++ b/pkcs11/gnome2-store/gkm-gnome2-file.c
@@ -25,9 +25,10 @@
 #include "gkm/gkm-attributes.h"
 #include "gkm/gkm-crypto.h"
 #include "gkm/gkm-data-types.h"
-#include "gkm/gkm-marshal.h"
 #include "gkm/gkm-util.h"
 
+#include "gkm-marshal.h"
+
 #include "egg/egg-buffer.h"
 #include "egg/egg-hex.h"
 #include "egg/egg-secure-memory.h"
diff --git a/pkcs11/gnome2-store/test-gnome2-file.c b/pkcs11/gnome2-store/test-gnome2-file.c
index 28e9d53..ace5272 100644
--- a/pkcs11/gnome2-store/test-gnome2-file.c
+++ b/pkcs11/gnome2-store/test-gnome2-file.c
@@ -52,8 +52,8 @@ EGG_SECURE_DEFINE_GLIB_GLOBALS ();
 static void
 setup (Test *test, gconstpointer unused)
 {
-       test->public_filename = g_build_filename (SRCDIR "/fixtures", "data-file-public.store", NULL);
-       test->private_filename = g_build_filename (SRCDIR "/fixtures", "data-file-private.store", NULL);
+       test->public_filename = g_build_filename (SRCDIR "/pkcs11/gnome2-store/fixtures", 
"data-file-public.store", NULL);
+       test->private_filename = g_build_filename (SRCDIR "/pkcs11/gnome2-store/fixtures", 
"data-file-private.store", NULL);
        test->write_filename = g_build_filename ("/tmp", "unit-test-file.store", NULL);
 
        test->data_file = gkm_gnome2_file_new ();
diff --git a/pkcs11/gnome2-store/test-gnome2-private-key.c b/pkcs11/gnome2-store/test-gnome2-private-key.c
index de6d18d..38c899f 100644
--- a/pkcs11/gnome2-store/test-gnome2-private-key.c
+++ b/pkcs11/gnome2-store/test-gnome2-private-key.c
@@ -58,7 +58,7 @@ setup_basic (Test* test,
        test->module = mock_gnome2_module_initialize_and_enter ();
        test->session = mock_gnome2_module_open_session (TRUE);
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/der-key-v2-des3.p8", &data, &length, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/gnome2-store/fixtures/der-key-v2-des3.p8", &data, &length, 
NULL))
                g_assert_not_reached ();
 
        test->key_data = g_bytes_new_take (data, length);
diff --git a/pkcs11/gnome2-store/test-gnome2-storage.c b/pkcs11/gnome2-store/test-gnome2-storage.c
index d0fd4d8..0c61884 100644
--- a/pkcs11/gnome2-store/test-gnome2-storage.c
+++ b/pkcs11/gnome2-store/test-gnome2-storage.c
@@ -59,8 +59,8 @@ setup_directory (Test *test,
                  gconstpointer unused)
 {
        test->directory = egg_tests_create_scratch_directory (
-               SRCDIR "/fixtures/Thawte_Personal_Premium_CA.cer",
-               SRCDIR "/fixtures/user.keystore",
+               SRCDIR "/pkcs11/gnome2-store/fixtures/Thawte_Personal_Premium_CA.cer",
+               SRCDIR "/pkcs11/gnome2-store/fixtures/user.keystore",
                NULL);
 }
 
@@ -102,7 +102,7 @@ setup_module (Test *test,
                                         "module", test->module,
                                         "manager", manager,
                                         NULL);
-       g_file_get_contents (SRCDIR "/fixtures/test-certificate.cer", &contents, &length, &error);
+       g_file_get_contents (SRCDIR "/pkcs11/gnome2-store/fixtures/test-certificate.cer", &contents, &length, 
&error);
        g_assert_no_error (error);
 
        bytes = g_bytes_new_take (contents, length);
diff --git a/pkcs11/gnome2-store/test-import.c b/pkcs11/gnome2-store/test-import.c
index 4547df7..7c24cae 100644
--- a/pkcs11/gnome2-store/test-import.c
+++ b/pkcs11/gnome2-store/test-import.c
@@ -29,8 +29,6 @@
 
 #include "gnome2-store/gkm-gnome2-store.h"
 
-#define GCR_API_SUBJECT_TO_CHANGE
-#define GCK_API_SUBJECT_TO_CHANGE
 #include <gck/gck.h>
 #include <gcr/gcr-base.h>
 
@@ -133,7 +131,7 @@ test_pkcs12_import (Test *test,
        gsize length;
        GList *l;
 
-       g_file_get_contents (SRCDIR "/fixtures/personal.p12", &contents, &length, &error);
+       g_file_get_contents (SRCDIR "/pkcs11/gnome2-store/fixtures/personal.p12", &contents, &length, &error);
        g_assert_no_error (error);
 
        /* Parse the pkcs12 file */
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index df8ae12..3591d7c 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -1,31 +1,25 @@
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-rpc-layer.la
 
-noinst_PROGRAMS = \
+noinst_PROGRAMS += \
        gkm-rpc-daemon-standalone
 
-INCLUDES = -I. \
-       -I$(top_srcdir) \
-       -I$(top_builddir)
-
 # ------------------------------------------------------------------------------
 # The dispatch code
 
 libgkm_rpc_layer_la_SOURCES = \
-       gkm-rpc-dispatch.c \
-       gkm-rpc-layer.h \
-       gkm-rpc-message.c \
-       gkm-rpc-private.h \
-       gkm-rpc-util.c
-
+       pkcs11/rpc-layer/gkm-rpc-dispatch.c \
+       pkcs11/rpc-layer/gkm-rpc-layer.h \
+       pkcs11/rpc-layer/gkm-rpc-message.c \
+       pkcs11/rpc-layer/gkm-rpc-private.h \
+       pkcs11/rpc-layer/gkm-rpc-util.c
 libgkm_rpc_layer_la_LIBADD = \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la \
+       libegg-buffer.la \
+       libegg-creds.la \
        $(GOBJECT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS)
-
 libgkm_rpc_layer_la_CFLAGS = \
        $(GOBJECT_CFLAGS) \
        $(GTHREAD_CFLAGS) \
@@ -35,40 +29,35 @@ libgkm_rpc_layer_la_CFLAGS = \
 # The module code, built as the public gnome-keyring module
 
 # This is the location that some older software looks for modules
-moduledir = $(P11_MODULE_PATH)
-
-module_LTLIBRARIES = \
+pkcs11moduledir = $(P11_MODULE_PATH)
+pkcs11module_LTLIBRARIES = \
        gnome-keyring-pkcs11.la
 
 gnome_keyring_pkcs11_la_SOURCES = \
-       gkm-rpc-private.h \
-       gkm-rpc-module.c \
-       gkm-rpc-message.c \
-       gkm-rpc-util.c
-
+       pkcs11/rpc-layer/gkm-rpc-private.h \
+       pkcs11/rpc-layer/gkm-rpc-module.c \
+       pkcs11/rpc-layer/gkm-rpc-message.c \
+       pkcs11/rpc-layer/gkm-rpc-util.c
 gnome_keyring_pkcs11_la_LIBADD = \
-       $(top_builddir)/egg/libegg-buffer.la \
-       $(top_builddir)/egg/libegg-creds.la
-
+       libegg-buffer.la \
+       libegg-creds.la
 gnome_keyring_pkcs11_la_LDFLAGS = \
        -module -avoid-version \
        -no-undefined -export-symbols-regex 'C_GetFunctionList'
 
 # This is the configuration file that p11-kit uses to load the module
-configdir = $(P11_SYSTEM_CONFIG_MODULES)
-
-config_DATA = \
-       gnome-keyring.module
+pkcs11configdir = $(P11_SYSTEM_CONFIG_MODULES)
+pkcs11config_DATA = \
+       pkcs11/rpc-layer/gnome-keyring.module
 
 # -----------------------------------------------------------------------------
 # The test daemon
 
 gkm_rpc_daemon_standalone_SOURCES = \
-       gkm-rpc-daemon-standalone.c
-
+       pkcs11/rpc-layer/gkm-rpc-daemon-standalone.c
 gkm_rpc_daemon_standalone_LDADD = \
-       $(DL_LIBS) libgkm-rpc-layer.la \
+       $(DL_LIBS) \
+       libgkm-rpc-layer.la \
        $(GLIB_LIBS)
-
 gkm_rpc_daemon_standalone_CFLAGS = \
        $(GLIB_CFLAGS)
diff --git a/pkcs11/secret-store/Makefile.am b/pkcs11/secret-store/Makefile.am
index d7cc8bf..9bdfe71 100644
--- a/pkcs11/secret-store/Makefile.am
+++ b/pkcs11/secret-store/Makefile.am
@@ -1,51 +1,51 @@
 
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GOBJECT_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       $(GMODULE_CFLAGS)
-
 # ------------------------------------------------------------------------------
 # The secret store component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-secret-store.la
 
 libgkm_secret_store_la_SOURCES = \
-       gkm-secret-binary.c gkm-secret-binary.h \
-       gkm-secret-collection.h gkm-secret-collection.c \
-       gkm-secret-compat.h gkm-secret-compat.c \
-       gkm-secret-data.h gkm-secret-data.c \
-       gkm-secret-fields.h gkm-secret-fields.c \
-       gkm-secret-item.h gkm-secret-item.c \
-       gkm-secret-module.h gkm-secret-module.c \
-       gkm-secret-object.h gkm-secret-object.c \
-       gkm-secret-search.h gkm-secret-search.c \
-       gkm-secret-store.h \
-       gkm-secret-types.h \
-       gkm-secret-textual.c gkm-secret-textual.h
+       pkcs11/secret-store/gkm-secret-binary.c \
+       pkcs11/secret-store/gkm-secret-binary.h \
+       pkcs11/secret-store/gkm-secret-collection.h \
+       pkcs11/secret-store/gkm-secret-collection.c \
+       pkcs11/secret-store/gkm-secret-compat.h \
+       pkcs11/secret-store/gkm-secret-compat.c \
+       pkcs11/secret-store/gkm-secret-data.h \
+       pkcs11/secret-store/gkm-secret-data.c \
+       pkcs11/secret-store/gkm-secret-fields.h \
+       pkcs11/secret-store/gkm-secret-fields.c \
+       pkcs11/secret-store/gkm-secret-item.h \
+       pkcs11/secret-store/gkm-secret-item.c \
+       pkcs11/secret-store/gkm-secret-module.h \
+       pkcs11/secret-store/gkm-secret-module.c \
+       pkcs11/secret-store/gkm-secret-object.h \
+       pkcs11/secret-store/gkm-secret-object.c \
+       pkcs11/secret-store/gkm-secret-search.h \
+       pkcs11/secret-store/gkm-secret-search.c \
+       pkcs11/secret-store/gkm-secret-store.h \
+       pkcs11/secret-store/gkm-secret-types.h \
+       pkcs11/secret-store/gkm-secret-textual.c \
+       pkcs11/secret-store/gkm-secret-textual.h
+libgkm_secret_store_la_CFLAGS = \
+       $(GOBJECT_CFLAGS) \
+       $(GMODULE_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(pkcs11standalonedir)
-
-module_LTLIBRARIES = \
+module_LTLIBRARIES += \
        gkm-secret-store-standalone.la
 
 gkm_secret_store_standalone_la_LDFLAGS = \
        -module -avoid-version \
        -no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
-
 gkm_secret_store_standalone_la_SOURCES = \
-       gkm-secret-standalone.c
-
+       pkcs11/secret-store/gkm-secret-standalone.c
 gkm_secret_store_standalone_la_LIBADD = \
        libgkm-secret-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
+       libgkm.la \
        $(GOBJECT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS) \
@@ -55,22 +55,28 @@ gkm_secret_store_standalone_la_LIBADD = \
 # -------------------------------------------------------------------------------
 # TESTS
 
-LDADD = \
+secret_store_LIBS = \
        libgkm-mock-secret-module.a \
-       $(top_builddir)/pkcs11/secret-store/libgkm-secret-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
+       libgkm-secret-store.la \
+       libgkm.la \
+       libegg.la \
        $(GLIB_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-noinst_LIBRARIES = libgkm-mock-secret-module.a
+noinst_LIBRARIES += libgkm-mock-secret-module.a
 
 libgkm_mock_secret_module_a_SOURCES = \
-       mock-secret-module.c mock-secret-module.h
+       pkcs11/secret-store/mock-secret-module.c \
+       pkcs11/secret-store/mock-secret-module.h
 
-noinst_PROGRAMS = dump-keyring0-format
+noinst_PROGRAMS += \
+       dump-keyring0-format
 
-TEST_PROGS = \
+dump_keyring0_format_SOURCES = \
+       pkcs11/secret-store/dump-keyring0-format.c
+dump_keyring0_format_LDADD = $(secret_store_LIBS)
+
+TEST_PROGS += \
        test-secret-compat \
        test-secret-fields \
        test-secret-data \
@@ -80,17 +86,36 @@ TEST_PROGS = \
        test-secret-schema \
        test-secret-search \
        test-secret-textual \
-       test-secret-binary \
-       test-secret-schema
+       test-secret-binary
+
+test_secret_compat_SOURCES = pkcs11/secret-store/test-secret-compat.c
+test_secret_compat_LDADD = $(secret_store_LIBS)
+
+test_secret_fields_SOURCES = pkcs11/secret-store/test-secret-fields.c
+test_secret_fields_LDADD = $(secret_store_LIBS)
+
+test_secret_data_SOURCES = pkcs11/secret-store/test-secret-data.c
+test_secret_data_LDADD = $(secret_store_LIBS)
+
+test_secret_object_SOURCES = pkcs11/secret-store/test-secret-object.c
+test_secret_object_LDADD = $(secret_store_LIBS)
+
+test_secret_collection_SOURCES = pkcs11/secret-store/test-secret-collection.c
+test_secret_collection_LDADD = $(secret_store_LIBS)
+
+test_secret_item_SOURCES = pkcs11/secret-store/test-secret-item.c
+test_secret_item_LDADD = $(secret_store_LIBS)
 
-check_PROGRAMS = $(TEST_PROGS)
+test_secret_schema_SOURCES = pkcs11/secret-store/test-secret-schema.c
+test_secret_schema_LDADD = $(secret_store_LIBS)
 
-test: $(TEST_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+test_secret_search_SOURCES = pkcs11/secret-store/test-secret-search.c
+test_secret_search_LDADD = $(secret_store_LIBS)
 
-check-local: test
+test_secret_textual_SOURCES = pkcs11/secret-store/test-secret-textual.c
+test_secret_textual_LDADD = $(secret_store_LIBS)
 
-all-local: $(check_PROGRAMS)
+test_secret_binary_SOURCES = pkcs11/secret-store/test-secret-binary.c
+test_secret_binary_LDADD = $(secret_store_LIBS)
 
-EXTRA_DIST = \
-       fixtures
+EXTRA_DIST += pkcs11/secret-store/fixtures
diff --git a/pkcs11/secret-store/mock-secret-module.c b/pkcs11/secret-store/mock-secret-module.c
index bf6bc96..d601259 100644
--- a/pkcs11/secret-store/mock-secret-module.c
+++ b/pkcs11/secret-store/mock-secret-module.c
@@ -59,8 +59,8 @@ test_secret_module_initialize_and_enter (void)
        CK_RV rv;
 
        directory = egg_tests_create_scratch_directory (
-               SRCDIR "/fixtures/encrypted.keyring",
-               SRCDIR "/fixtures/plain.keyring",
+               SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring",
+               SRCDIR "/pkcs11/secret-store/fixtures/plain.keyring",
                NULL);
 
        /* Setup test directory to work in */
diff --git a/pkcs11/secret-store/test-secret-binary.c b/pkcs11/secret-store/test-secret-binary.c
index 2900cb4..e06c256 100644
--- a/pkcs11/secret-store/test-secret-binary.c
+++ b/pkcs11/secret-store/test-secret-binary.c
@@ -99,7 +99,7 @@ test_read_encrypted (Test *test, gconstpointer unused)
 {
        GkmDataResult res;
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/encrypted.keyring");
+       res = check_read_keyring_file (test, SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring");
        g_assert (res == GKM_DATA_SUCCESS);
 
        test_secret_collection_validate (test->collection, test->sdata);
@@ -110,7 +110,7 @@ test_read_wrong_format (Test *test, gconstpointer unused)
 {
        GkmDataResult res;
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/plain.keyring");
+       res = check_read_keyring_file (test, SRCDIR "/pkcs11/secret-store/fixtures/plain.keyring");
        g_assert (res == GKM_DATA_UNRECOGNIZED);
 }
 
@@ -124,7 +124,7 @@ test_read_wrong_master (Test *test, gconstpointer unused)
        gkm_secret_data_set_master (test->sdata, master);
        g_object_unref (master);
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/encrypted.keyring");
+       res = check_read_keyring_file (test, SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring");
        g_assert (res == GKM_DATA_LOCKED);
 }
 
@@ -135,7 +135,7 @@ test_read_sdata_but_no_master (Test *test, gconstpointer unused)
 
        gkm_secret_data_set_master (test->sdata, NULL);
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/encrypted.keyring");
+       res = check_read_keyring_file (test, SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring");
        g_assert (res == GKM_DATA_LOCKED);
 }
 
@@ -166,7 +166,7 @@ test_remove_unavailable (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/encrypted.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring", &data, &n_data, 
NULL))
                g_assert_not_reached ();
        res = gkm_secret_binary_read (test->collection, test->sdata, data, n_data);
        g_assert (res == GKM_DATA_SUCCESS);
@@ -206,7 +206,7 @@ test_read_created_on_solaris_opencsw (Test *test, gconstpointer unused)
        gkm_secret_data_set_master (test->sdata, master);
        g_object_unref (master);
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/created-on-solaris-opencsw.keyring");
+       res = check_read_keyring_file (test, SRCDIR 
"/pkcs11/secret-store/fixtures/created-on-solaris-opencsw.keyring");
        g_assert_cmpint (res, ==, GKM_DATA_SUCCESS);
 }
 
@@ -220,7 +220,7 @@ test_read_created_on_rhel (Test *test, gconstpointer unused)
        gkm_secret_data_set_master (test->sdata, master);
        g_object_unref (master);
 
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/created-on-rhel.keyring");
+       res = check_read_keyring_file (test, SRCDIR "/pkcs11/secret-store/fixtures/created-on-rhel.keyring");
        g_assert_cmpint (res, ==, GKM_DATA_SUCCESS);
 }
 
@@ -235,7 +235,7 @@ test_read_with_schema (Test *test,
        master = gkm_secret_new_from_password ("test");
        gkm_secret_data_set_master (test->sdata, master);
        g_object_unref (master);
-       res = check_read_keyring_file (test, SRCDIR "/fixtures/encrypted-with-schema.keyring");
+       res = check_read_keyring_file (test, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted-with-schema.keyring");
        g_assert_cmpint (res, ==, GKM_DATA_SUCCESS);
 
        item = gkm_secret_collection_get_item (test->collection, "1");
diff --git a/pkcs11/secret-store/test-secret-collection.c b/pkcs11/secret-store/test-secret-collection.c
index f9e0394..bdc585b 100644
--- a/pkcs11/secret-store/test-secret-collection.c
+++ b/pkcs11/secret-store/test-secret-collection.c
@@ -171,7 +171,7 @@ test_load_unlock_plain (Test *test, gconstpointer unused)
        GkmDataResult res;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/plain.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/plain.keyring");
 
        /* Load the data in the file */
        res = gkm_secret_collection_load (test->collection);
@@ -197,7 +197,7 @@ test_load_unlock_encrypted (Test *test, gconstpointer unused)
        GkmDataResult res;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/encrypted.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted.keyring");
 
        /* Load the data in the file */
        res = gkm_secret_collection_load (test->collection);
@@ -223,7 +223,7 @@ test_load_unlock_bad_password (Test *test, gconstpointer unused)
        GkmDataResult res;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/encrypted.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted.keyring");
 
        /* Load the data in the file */
        res = gkm_secret_collection_load (test->collection);
@@ -242,7 +242,7 @@ test_unlock_without_load (Test *test, gconstpointer unused)
        GkmSecretData *sdata;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/encrypted.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted.keyring");
 
        /* Unlock the keyring, which should load it */
        rv = gkm_credential_create (test->module, gkm_session_get_manager (test->session), GKM_OBJECT 
(test->collection),
@@ -264,7 +264,7 @@ test_twice_unlock (Test *test, gconstpointer unused)
        GkmSecretData *sdata;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/encrypted.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted.keyring");
 
        /* Unlock the keyring, which should load */
        rv = gkm_credential_create (test->module, gkm_session_get_manager (test->session), GKM_OBJECT 
(test->collection),
@@ -293,7 +293,7 @@ test_twice_unlock_bad_password (Test *test, gconstpointer unused)
        GkmSecretData *sdata;
        CK_RV rv;
 
-       gkm_secret_collection_set_filename (test->collection, SRCDIR "/fixtures/encrypted.keyring");
+       gkm_secret_collection_set_filename (test->collection, SRCDIR 
"/pkcs11/secret-store/fixtures/encrypted.keyring");
 
        /* Unlock the keyring, which should load */
        rv = gkm_credential_create (test->module, gkm_session_get_manager (test->session), GKM_OBJECT 
(test->collection),
diff --git a/pkcs11/secret-store/test-secret-schema.c b/pkcs11/secret-store/test-secret-schema.c
index 82fafdd..5b94197 100644
--- a/pkcs11/secret-store/test-secret-schema.c
+++ b/pkcs11/secret-store/test-secret-schema.c
@@ -72,7 +72,7 @@ setup (Test *test,
         */
 
        gkm_secret_collection_set_filename (test->collection,
-                                           SRCDIR "/fixtures/schema1.keyring");
+                                           SRCDIR "/pkcs11/secret-store/fixtures/schema1.keyring");
 
        /* Load the collection */
        res = gkm_secret_collection_load (test->collection);
diff --git a/pkcs11/secret-store/test-secret-textual.c b/pkcs11/secret-store/test-secret-textual.c
index 0752712..497804f 100644
--- a/pkcs11/secret-store/test-secret-textual.c
+++ b/pkcs11/secret-store/test-secret-textual.c
@@ -81,7 +81,7 @@ test_read (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/plain.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/plain.keyring", &data, &n_data, NULL))
                g_assert_not_reached ();
        res = gkm_secret_textual_read (test->collection, test->sdata, data, n_data);
        g_free (data);
@@ -98,7 +98,7 @@ test_read_wrong_format (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/encrypted.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/encrypted.keyring", &data, &n_data, 
NULL))
                g_assert_not_reached ();
 
        res = gkm_secret_textual_read (test->collection, test->sdata, data, n_data);
@@ -116,7 +116,7 @@ test_read_bad_number (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/plain-bad-number.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/plain-bad-number.keyring", &data, 
&n_data, NULL))
                g_assert_not_reached ();
        res = gkm_secret_textual_read (test->collection, test->sdata, data, n_data);
        g_free (data);
@@ -158,7 +158,7 @@ test_remove_unavailable (Test *test, gconstpointer unused)
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/plain.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/plain.keyring", &data, &n_data, NULL))
                g_assert_not_reached ();
        res = gkm_secret_textual_read (test->collection, test->sdata, data, n_data);
        g_assert (res == GKM_DATA_SUCCESS);
@@ -197,7 +197,7 @@ test_read_with_schema (Test *test,
        gchar *data;
        gsize n_data;
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/plain-with-schema.keyring", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/secret-store/fixtures/plain-with-schema.keyring", &data, 
&n_data, NULL))
                g_assert_not_reached ();
        res = gkm_secret_textual_read (test->collection, test->sdata, data, n_data);
        g_assert (res == GKM_DATA_SUCCESS);
diff --git a/pkcs11/ssh-store/Makefile.am b/pkcs11/ssh-store/Makefile.am
index d9e6aab..6300dbe 100644
--- a/pkcs11/ssh-store/Makefile.am
+++ b/pkcs11/ssh-store/Makefile.am
@@ -1,102 +1,74 @@
-include $(top_srcdir)/Makefile.decl
-
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GOBJECT_CFLAGS) \
-       $(LIBGCRYPT_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       $(GMODULE_CFLAGS)
-
 
 # ------------------------------------------------------------------------------
 # The ssh-store component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-ssh-store.la
 
 libgkm_ssh_store_la_SOURCES = \
-       gkm-ssh-store.h \
-       gkm-ssh-module.c gkm-ssh-module.h \
-       gkm-ssh-openssh.c gkm-ssh-openssh.h \
-       gkm-ssh-private-key.c gkm-ssh-private-key.h \
-       gkm-ssh-public-key.c gkm-ssh-public-key.h
+       pkcs11/ssh-store/gkm-ssh-store.h \
+       pkcs11/ssh-store/gkm-ssh-module.c pkcs11/ssh-store/gkm-ssh-module.h \
+       pkcs11/ssh-store/gkm-ssh-openssh.c pkcs11/ssh-store/gkm-ssh-openssh.h \
+       pkcs11/ssh-store/gkm-ssh-private-key.c pkcs11/ssh-store/gkm-ssh-private-key.h \
+       pkcs11/ssh-store/gkm-ssh-public-key.c pkcs11/ssh-store/gkm-ssh-public-key.h
 
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(pkcs11standalonedir)
-
-module_LTLIBRARIES = \
+module_LTLIBRARIES += \
        gkm-ssh-store-standalone.la
 
 gkm_ssh_store_standalone_la_LDFLAGS = \
        -module -avoid-version \
        -no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
-
 gkm_ssh_store_standalone_la_SOURCES = \
-       gkm-ssh-standalone.c
-
+       pkcs11/ssh-store/gkm-ssh-standalone.c
 gkm_ssh_store_standalone_la_LIBADD = \
        libgkm-ssh-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
+       libgkm.la \
        $(GOBJECT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS) \
        $(GMODULE_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-
 # -------------------------------------------------------------------------------
 # TESTS
 
-LDADD = \
+ssh_store_LIBS = \
        libgkm-mock-ssh-module.a \
-       $(top_builddir)/pkcs11/ssh-store/libgkm-ssh-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
+       libgkm-ssh-store.la \
+       libgkm.la \
+       libegg.la \
        $(GLIB_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-if WITH_P11_TESTS
-CHECK_PROGS = check-ssh-module
-else
-CHECK_PROGS =
-endif
-
-CHECK_FILES = \
-       p11-tests.conf
-
-TEST_PROGS = \
+# if WITH_P11_TESTS
+# CHECK_PROGS = check-ssh-module
+# else
+# CHECK_PROGS =
+# endif
+# CHECK_FILES = \
+#      p11-tests.conf
+# check_ssh_module_CFLAGS = $(P11_TESTS_CFLAGS)
+# check_ssh_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
+# p11-tests.conf.in
+
+TEST_PROGS += \
        test-ssh-openssh \
        test-private-key
 
-check_PROGRAMS = $(TEST_PROGS)
-
-test: $(TEST_PROGS) $(CHECK_PROGS) $(CHECK_FILES)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
-       @for prog in $(CHECK_PROGS); do SRCDIR='.' ./$$prog || exit 1; done
-
-check-local: test
+test_ssh_openssh_SOURCES = pkcs11/ssh-store/test-ssh-openssh.c
+test_ssh_openssh_LDADD = $(ssh_store_LIBS)
 
-all-local: $(check_PROGRAMS)
+test_private_key_SOURCES = pkcs11/ssh-store/test-private-key.c
+test_private_key_LDADD = $(ssh_store_LIBS)
 
-noinst_PROGRAMS = \
-       $(CHECK_PROGS)
-
-check_ssh_module_CFLAGS = $(P11_TESTS_CFLAGS)
-check_ssh_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
-
-noinst_LIBRARIES = libgkm-mock-ssh-module.a
+noinst_LIBRARIES += libgkm-mock-ssh-module.a
 
 libgkm_mock_ssh_module_a_SOURCES = \
-       mock-ssh-module.c mock-ssh-module.h
-
-EXTRA_DIST = \
-       p11-tests.conf.in \
-       fixtures
+       pkcs11/ssh-store/mock-ssh-module.c \
+       pkcs11/ssh-store/mock-ssh-module.h
 
-CLEANFILES = \
-       $(CHECK_FILES)
+EXTRA_DIST += \
+       pkcs11/ssh-store/fixtures
diff --git a/pkcs11/ssh-store/test-private-key.c b/pkcs11/ssh-store/test-private-key.c
index 50aa58c..ba9ebd6 100644
--- a/pkcs11/ssh-store/test-private-key.c
+++ b/pkcs11/ssh-store/test-private-key.c
@@ -66,8 +66,8 @@ setup (Test *test,
        test->key = gkm_ssh_private_key_new (test->module, "my-unique");
        g_assert (GKM_IS_SSH_PRIVATE_KEY (test->key));
 
-       ret = gkm_ssh_private_key_parse (test->key, SRCDIR "/fixtures/id_dsa_encrypted.pub",
-                                        SRCDIR "/fixtures/id_dsa_encrypted", NULL);
+       ret = gkm_ssh_private_key_parse (test->key, SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_encrypted.pub",
+                                        SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_encrypted", NULL);
        g_assert (ret == TRUE);
 }
 
@@ -88,8 +88,8 @@ test_parse_plain (Test *test, gconstpointer unused)
        key = gkm_ssh_private_key_new (test->module, "my-unique");
        g_assert (GKM_IS_SSH_PRIVATE_KEY (key));
 
-       ret = gkm_ssh_private_key_parse (key, SRCDIR "/fixtures/id_dsa_plain.pub",
-                                        SRCDIR "/fixtures/id_dsa_plain", NULL);
+       ret = gkm_ssh_private_key_parse (key, SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_plain.pub",
+                                        SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_plain", NULL);
        g_assert (ret == TRUE);
 
        g_object_unref (key);
diff --git a/pkcs11/ssh-store/test-ssh-openssh.c b/pkcs11/ssh-store/test-ssh-openssh.c
index 3be9f73..e1c4fb7 100644
--- a/pkcs11/ssh-store/test-ssh-openssh.c
+++ b/pkcs11/ssh-store/test-ssh-openssh.c
@@ -36,15 +36,15 @@
 EGG_SECURE_DEFINE_GLIB_GLOBALS ();
 
 static const gchar *PRIVATE_FILES[] = {
-       SRCDIR "/fixtures/id_rsa_encrypted",
-       SRCDIR "/fixtures/id_rsa_plain",
-       SRCDIR "/fixtures/id_dsa_encrypted",
-       SRCDIR "/fixtures/id_dsa_plain"
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_rsa_encrypted",
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_rsa_plain",
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_encrypted",
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_plain"
 };
 
 static const gchar *PUBLIC_FILES[] = {
-       SRCDIR "/fixtures/id_rsa_test.pub",
-       SRCDIR "/fixtures/id_dsa_test.pub"
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_rsa_test.pub",
+       SRCDIR "/pkcs11/ssh-store/fixtures/id_dsa_test.pub"
 };
 
 #define COMMENT "A public key comment"
diff --git a/pkcs11/wrap-layer/Makefile.am b/pkcs11/wrap-layer/Makefile.am
index 97a6707..7692e46 100644
--- a/pkcs11/wrap-layer/Makefile.am
+++ b/pkcs11/wrap-layer/Makefile.am
@@ -1,30 +1,24 @@
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-wrap-layer.la
 
-INCLUDES = -I. \
-       -I$(top_srcdir) \
-       -I$(top_builddir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GCR_BASE_CFLAGS) \
-       -DGCR_API_SUBJECT_TO_CHANGE
-
 # ------------------------------------------------------------------------------
 # The code
 
 libgkm_wrap_layer_la_SOURCES = \
-       gkm-wrap-layer.c gkm-wrap-layer.h \
-       gkm-wrap-login.c gkm-wrap-login.h \
-       gkm-wrap-prompt.c gkm-wrap-prompt.h
-
+       pkcs11/wrap-layer/gkm-wrap-layer.c \
+       pkcs11/wrap-layer/gkm-wrap-layer.h \
+       pkcs11/wrap-layer/gkm-wrap-login.c \
+       pkcs11/wrap-layer/gkm-wrap-login.h \
+       pkcs11/wrap-layer/gkm-wrap-prompt.c \
+       pkcs11/wrap-layer/gkm-wrap-prompt.h
 libgkm_wrap_layer_la_LIBADD = \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
+       libgkm.la \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS) \
        $(GIO_LIBS)
-
 libgkm_wrap_layer_la_CFLAGS = \
+       $(GCR_BASE_CFLAGS) \
        $(GTHREAD_CFLAGS) \
        $(GLIB_CFLAGS) \
        $(GIO_CFLAGS)
@@ -32,15 +26,18 @@ libgkm_wrap_layer_la_CFLAGS = \
 # ------------------------------------------------------------------------------
 # TESTS
 
-LDADD = \
-       $(top_builddir)/pkcs11/wrap-layer/libgkm-wrap-layer.la \
+wrap_layer_CFLAGS = \
+       $(GCR_BASE_CFLAGS)
+
+wrap_layer_LIBS = \
+       libgkm-wrap-layer.la \
        libgkm-mock-secret-store.a \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
+       libgkm.la \
+       libegg.la \
        $(GCR_BASE_LIBS) \
        $(GLIB_LIBS)
 
-TEST_PROGS = \
+TEST_PROGS += \
        test-create-credential \
        test-init-pin \
        test-login-auto \
@@ -50,16 +47,37 @@ TEST_PROGS = \
        test-login-user \
        test-set-pin
 
-check_PROGRAMS = $(TEST_PROGS)
+test_create_credential_SOURCES = pkcs11/wrap-layer/test-create-credential.c
+test_create_credential_LDADD = $(wrap_layer_LIBS)
+test_create_credential_CFLAGS = $(wrap_layer_CFLAGS)
+
+test_init_pin_SOURCES = pkcs11/wrap-layer/test-init-pin.c
+test_init_pin_LDADD = $(wrap_layer_LIBS)
+test_init_pin_CFLAGS = $(wrap_layer_CFLAGS)
+
+test_login_auto_SOURCES = pkcs11/wrap-layer/test-login-auto.c
+test_login_auto_LDADD = $(wrap_layer_LIBS)
+test_login_auto_CFLAGS = $(wrap_layer_CFLAGS)
+
+test_login_hints_SOURCES = pkcs11/wrap-layer/test-login-hints.c
+test_login_hints_LDADD = $(wrap_layer_LIBS)
+
+test_login_keyring_SOURCES = pkcs11/wrap-layer/test-login-keyring.c
+test_login_keyring_LDADD = $(wrap_layer_LIBS)
 
-test: $(TEST_PROGS) $(CHECK_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
+test_login_specific_SOURCES = pkcs11/wrap-layer/test-login-specific.c
+test_login_specific_LDADD = $(wrap_layer_LIBS)
+test_login_specific_CFLAGS = $(wrap_layer_CFLAGS)
 
-check-local: test
+test_login_user_SOURCES = pkcs11/wrap-layer/test-login-user.c
+test_login_user_LDADD = $(wrap_layer_LIBS)
+test_login_user_CFLAGS = $(wrap_layer_CFLAGS)
 
-all-local: $(check_PROGRAMS)
+test_set_pin_SOURCES = pkcs11/wrap-layer/test-set-pin.c
+test_set_pin_LDADD = $(wrap_layer_LIBS)
+test_set_pin_CFLAGS = $(wrap_layer_CFLAGS)
 
-noinst_LIBRARIES = libgkm-mock-secret-store.a
+noinst_LIBRARIES += libgkm-mock-secret-store.a
 
 libgkm_mock_secret_store_a_SOURCES = \
-       mock-secret-store.c
\ No newline at end of file
+       pkcs11/wrap-layer/mock-secret-store.c
\ No newline at end of file
diff --git a/pkcs11/xdg-store/Makefile.am b/pkcs11/xdg-store/Makefile.am
index 680f662..4b6b890 100644
--- a/pkcs11/xdg-store/Makefile.am
+++ b/pkcs11/xdg-store/Makefile.am
@@ -1,107 +1,92 @@
-include $(top_srcdir)/Makefile.decl
-
-INCLUDES = \
-       -I$(top_builddir) \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/pkcs11 \
-       -DSRCDIR="\"@abs_srcdir \"" \
-       $(GOBJECT_CFLAGS) \
-       $(LIBGCRYPT_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       $(GMODULE_CFLAGS)
 
 # ------------------------------------------------------------------------------
 # The xdg-store component code
 
-noinst_LTLIBRARIES = \
+noinst_LTLIBRARIES += \
        libgkm-xdg-store.la
 
 libgkm_xdg_store_la_SOURCES = \
-       gkm-xdg-store.h \
-       gkm-xdg-asn1-defs.c gkm-xdg-asn1-defs.h \
-       gkm-xdg-assertion.c gkm-xdg-assertion.h \
-       gkm-xdg-module.c gkm-xdg-module.h \
-       gkm-xdg-trust.c gkm-xdg-trust.h \
-       xdg.asn.h \
+       pkcs11/xdg-store/gkm-xdg-store.h \
+       pkcs11/xdg-store/gkm-xdg-asn1-defs.c \
+       pkcs11/xdg-store/gkm-xdg-asn1-defs.h \
+       pkcs11/xdg-store/gkm-xdg-assertion.c \
+       pkcs11/xdg-store/gkm-xdg-assertion.h \
+       pkcs11/xdg-store/gkm-xdg-module.c \
+       pkcs11/xdg-store/gkm-xdg-module.h \
+       pkcs11/xdg-store/gkm-xdg-trust.c \
+       pkcs11/xdg-store/gkm-xdg-trust.h \
+       pkcs11/xdg-store/xdg.asn.h \
        $(NULL)
 
-EXTRA_DIST = \
-       xdg.asn \
+ASN1_FILES += \
+       pkcs11/xdg-store/xdg.asn \
        $(NULL)
 
 # ------------------------------------------------------------------------------
 # The standalone module
 
-moduledir = $(pkcs11standalonedir)
-
-module_LTLIBRARIES = \
+module_LTLIBRARIES += \
        gkm-xdg-store-standalone.la
 
 gkm_xdg_store_standalone_la_LDFLAGS = \
        -module -avoid-version \
        -no-undefined -export-symbols-regex 'C_GetFunctionList|g_module_check_init'
-
 gkm_xdg_store_standalone_la_SOURCES = \
-       gkm-xdg-standalone.c
-
+       pkcs11/xdg-store/gkm-xdg-standalone.c
 gkm_xdg_store_standalone_la_LIBADD = \
        libgkm-xdg-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
+       libgkm.la \
        $(GOBJECT_LIBS) \
        $(GTHREAD_LIBS) \
        $(GLIB_LIBS) \
        $(GMODULE_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-asn:
-       asn1Parser -o xdg.asn.h xdg.asn
-       sed -i 's|#include.*|/* \0 */|' xdg.asn.h
-
 # -------------------------------------------------------------------------------
 # TESTS
 
-LDADD = \
+xdg_store_LIBS = \
        libgkm-mock-xdg-module.a \
-       $(top_builddir)/pkcs11/xdg-store/libgkm-xdg-store.la \
-       $(top_builddir)/pkcs11/gkm/libgkm.la \
-       $(top_builddir)/egg/libegg.la \
+       libgkm-xdg-store.la \
+       libgkm.la \
+       libegg.la \
        $(GLIB_LIBS) \
        $(GTHREAD_LIBS) \
        $(LIBGCRYPT_LIBS)
 
-if WITH_P11_TESTS
-CHECK_PROGS = check-xdg-module
-else
-CHECK_PROGS =
-endif
+# if WITH_P11_TESTS
+# CHECK_PROGS = check-xdg-module
+# else
+# CHECK_PROGS =
+# endif
+# check_xdg_module_CFLAGS = $(P11_TESTS_CFLAGS)
+# check_xdg_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
 
-TEST_PROGS = \
+TEST_PROGS += \
        test-xdg-module \
        test-xdg-trust
 
-check_PROGRAMS = $(TEST_PROGS)
-
-test: $(TEST_PROGS) $(CHECK_PROGS)
-       gtester --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
-       @for prog in $(CHECK_PROGS); do SRCDIR='.' ./$$prog || exit 1; done
+test_xdg_module_SOURCES = pkcs11/xdg-store/test-xdg-module.c
+test_xdg_module_LDADD = $(xdg_store_LIBS)
 
-check-local: test
-
-all-local: $(check_PROGRAMS)
+test_xdg_trust_SOURCES = pkcs11/xdg-store/test-xdg-trust.c
+test_xdg_trust_LDADD = $(xdg_store_LIBS)
 
 EXTRA_DIST += \
-       p11-tests.conf \
-       fixtures
+       pkcs11/xdg-store/fixtures
 
-noinst_PROGRAMS = \
+noinst_PROGRAMS += \
        frob-trust-file \
-       dump-trust-file \
-       $(CHECK_PROGS)
+       dump-trust-file
+
+frob_trust_file_SOURCES = pkcs11/xdg-store/frob-trust-file.c
+frob_trust_file_LDADD = $(xdg_store_LIBS)
 
-check_xdg_module_CFLAGS = $(P11_TESTS_CFLAGS)
-check_xdg_module_LDADD = $(P11_TESTS_LIBS) $(LDADD)
+dump_trust_file_SOURCES = pkcs11/xdg-store/dump-trust-file.c
+dump_trust_file_LDADD = $(xdg_store_LIBS)
 
-noinst_LIBRARIES = libgkm-mock-xdg-module.a
+noinst_LIBRARIES += libgkm-mock-xdg-module.a
 
 libgkm_mock_xdg_module_a_SOURCES = \
-       mock-xdg-module.c mock-xdg-module.h
+       pkcs11/xdg-store/mock-xdg-module.c \
+       pkcs11/xdg-store/mock-xdg-module.h
diff --git a/pkcs11/xdg-store/mock-xdg-module.c b/pkcs11/xdg-store/mock-xdg-module.c
index cdc886b..acfc85f 100644
--- a/pkcs11/xdg-store/mock-xdg-module.c
+++ b/pkcs11/xdg-store/mock-xdg-module.c
@@ -109,8 +109,8 @@ mock_xdg_module_initialize_and_enter (void)
        CK_RV rv;
 
        directory = egg_tests_create_scratch_directory (
-               SRCDIR "/fixtures/test-refer-1.trust",
-               SRCDIR "/fixtures/test-certificate-1.cer",
+               SRCDIR "/pkcs11/xdg-store/fixtures/test-refer-1.trust",
+               SRCDIR "/pkcs11/xdg-store/fixtures/test-certificate-1.cer",
                NULL);
 
        /* Setup test directory to work in */
diff --git a/pkcs11/xdg-store/test-xdg-module.c b/pkcs11/xdg-store/test-xdg-module.c
index fb0d72d..fc0a1eb 100644
--- a/pkcs11/xdg-store/test-xdg-module.c
+++ b/pkcs11/xdg-store/test-xdg-module.c
@@ -181,7 +181,7 @@ test_create_and_add_object (Test *test, gconstpointer unused)
                { CKA_CERTIFICATE_TYPE, &ctype, sizeof (ctype) }
        };
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-2.cer", &data, &n_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/xdg-store/fixtures/test-certificate-2.cer", &data, &n_data, 
NULL))
                g_assert_not_reached ();
 
        attrs[0].pValue = data;
diff --git a/pkcs11/xdg-store/test-xdg-trust.c b/pkcs11/xdg-store/test-xdg-trust.c
index cdddd99..347c00e 100644
--- a/pkcs11/xdg-store/test-xdg-trust.c
+++ b/pkcs11/xdg-store/test-xdg-trust.c
@@ -128,7 +128,7 @@ setup (Test *test, gconstpointer unused)
        rv = gkm_module_C_Login (test->module, gkm_session_get_handle (test->session), CKU_USER, NULL, 0);
        g_assert (rv == CKR_OK);
 
-       if (!g_file_get_contents (SRCDIR "/fixtures/test-certificate-2.cer", &test->cert_data, 
&test->n_cert_data, NULL))
+       if (!g_file_get_contents (SRCDIR "/pkcs11/xdg-store/fixtures/test-certificate-2.cer", 
&test->cert_data, &test->n_cert_data, NULL))
                g_assert_not_reached ();
 }
 
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 4a6ef38..9de11d3 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,9 +1,10 @@
-daemon/gnome-keyring-pkcs11.desktop.in
 daemon/gnome-keyring-secrets.desktop.in
 daemon/gnome-keyring-ssh.desktop.in
 daemon/gnome-keyring-gpg.desktop.in
+daemon/gnome-keyring-pkcs11.desktop.in
 daemon/org.freedesktop.secrets.service.in
 daemon/org.gnome.keyring.service.in
-gcr/gcr-import-dialog.ui
-gcr/gcr-certificate-basics-widget.ui
-ui/gnome-keyring-prompt.desktop.in
+
+# POTFILES.skip insists on finding files $builddir :S
+x86_64/
+_build/
\ No newline at end of file
diff --git a/schema/Makefile.am b/schema/Makefile.am
index 1f614e5..e5d894c 100644
--- a/schema/Makefile.am
+++ b/schema/Makefile.am
@@ -1,23 +1,21 @@
 
 gsettings_SCHEMAS = \
-       org.gnome.crypto.cache.gschema.xml
+       schema/org.gnome.crypto.cache.gschema.xml
 
 @GSETTINGS_RULES@
 
+convertdir = $(datarootdir)/GConf/gsettings
 convert_DATA = \
-       org.gnome.crypto.cache.convert
+       schema/org.gnome.crypto.cache.convert
 
-convertdir = \
-       $(datarootdir)/GConf/gsettings
-
-all-local: gschemas.compiled
+noinst_DATA += gschemas.compiled
 
 gschemas.compiled: $(gsettings_SCHEMAS)
-       glib-compile-schemas --strict .
+       $(AM_V_GEN) glib-compile-schemas --strict .
 
-DISTCLEAN = \
+CLEANFILES += \
        gschemas.compiled
 
-EXTRA_DIST = \
+EXTRA_DIST += \
        $(convert_DATA) \
        $(gsettings_SCHEMAS)
\ No newline at end of file
diff --git a/tool/Makefile.am b/tool/Makefile.am
index 9f51d35..3c2bbb5 100644
--- a/tool/Makefile.am
+++ b/tool/Makefile.am
@@ -1,34 +1,22 @@
-bin_PROGRAMS= \
+bin_PROGRAMS += \
        gnome-keyring- GKR_MAJOR@
 
-INCLUDES=      \
-       -I$(top_srcdir) \
-       -I$(top_builddir) \
+gnome_keyring_ GKR_MAJOR@_SOURCES = \
+       tool/gkr-tool.c \
+       tool/gkr-tool.h \
+       tool/gkr-tool-import.c \
+       tool/gkr-tool-trust.c \
+       tool/gkr-tool-version.c
+gnome_keyring_ GKR_MAJOR@_CFLAGS = \
        $(GTK_CFLAGS) \
        $(GOBJECT_CFLAGS) \
-       $(GLIB_CFLAGS) \
        $(GCK_CFLAGS) \
-       $(GCR_CFLAGS) \
-       -DGCK_API_SUBJECT_TO_CHANGE
-
-gnome_keyring_ GKR_MAJOR@_SOURCES = \
-       gkr-tool.c gkr-tool.h \
-       gkr-tool-import.c \
-       gkr-tool-trust.c \
-       gkr-tool-version.c
-
-gnome_keyring_ GKR_MAJOR@_CFLAGS = \
-       -DGCR_API_SUBJECT_TO_CHANGE \
-       -DGNOMELOCALEDIR=\""$(datadir)/locale"\"
-
+       $(GCR_CFLAGS)
 gnome_keyring_ GKR_MAJOR@_LDADD = \
-       $(top_builddir)/egg/libegg.la \
+       libegg.la \
        $(GCK_LIBS) \
        $(GCR_LIBS) \
+       $(GTK_LIBS) \
        $(GTHREAD_LIBS) \
        $(GCRYPT_LIBS) \
        $(DAEMON_LIBS)
-
-# Install a link from gnome-keyring > gnome-keyring- GKR_MAJOR@ to maintain compatibility
-install-exec-hook:
-       @test -e "$(DESTDIR)$(bindir)/gnome-keyring" || (cd $(DESTDIR)$(bindir) && $(LN_S) gnome-keyring- 
GKR_MAJOR@ gnome-keyring)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]