[dconf/wip/reorg: 520/523] massive Makefile reorganisation



commit d56a9ce678101d6dc66e0d322d5f33e04bbc98fc
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Jul 8 21:47:23 2012 -0400

    massive Makefile reorganisation
    
    Clean up the Makefiles and make them as similar as possible.
    
    Move CFLAGS to a common point of definition and stop using -I so much.
    
    Replace the 'dbus stub' with libdconf-mock.a in tests/.  Fill in some
    stubs for future mock code for shm and gvdb (just to get things
    compiling for now).

 bin/Makefile.am                                |   19 +++-
 bin/gvdb.vapi                                  |    2 +-
 client/Makefile.am                             |   20 ++--
 client/dconf-client.c                          |    2 +-
 client/dconf-client.h                          |    2 +-
 client/dconf.h                                 |    1 +
 common/Makefile.am                             |    5 +-
 configure.ac                                   |    5 +
 editor/Makefile.am                             |   32 +++++--
 engine/.gitignore                              |    1 +
 engine/Makefile.am                             |   10 +-
 engine/dconf-changeset-list.h                  |    2 +-
 engine/dconf-engine-source-user.c              |    2 +-
 engine/dconf-engine-source.h                   |    2 +-
 engine/dconf-engine.c                          |    2 +-
 gdbus/.gitignore                               |    5 +-
 gdbus/Makefile.am                              |   23 ++++-
 gdbus/dconf-gdbus-filter.c                     |    2 +-
 gdbus/dconf-gdbus-thread.c                     |    2 +-
 gsettings/Makefile.am                          |   14 ++-
 gsettings/dconfsettingsbackend.c               |    2 +-
 gvdb/.gitignore                                |    2 +
 gvdb/Makefile.am                               |   14 ++-
 service/Makefile.am                            |   12 ++-
 service/dconf-rebuilder.c                      |    4 +-
 service/dconf-writer.c                         |    2 +-
 service/dconf-writer.h                         |    2 +-
 service/service.c                              |    2 +-
 shm/Makefile.am                                |    5 +-
 tests/.gitignore                               |    2 +-
 tests/Makefile.am                              |  130 +++++++++++++-----------
 tests/changeset.c                              |    2 +-
 tests/client.c                                 |    4 +-
 tests/dbus.c                                   |    2 +-
 tests/dbus1.c                                  |    2 +-
 tests/{dconf-dbus-stub.c => dconf-mock-dbus.c} |    2 +-
 tests/dconf-mock-gvdb.c                        |   49 +++++++++
 tests/dconf-mock-shm.c                         |   13 +++
 tests/engine.c                                 |    4 +-
 tests/gvdb.c                                   |    2 +-
 tests/paths.c                                  |    2 +-
 tests/shm.c                                    |    4 +-
 tests/tmpdir.c                                 |    2 +-
 43 files changed, 279 insertions(+), 139 deletions(-)
---
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 5d5de60..b500f7a 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,14 +1,23 @@
 include $(top_srcdir)/Makefile.gtester
 
-AM_CFLAGS = -Wall -Wmissing-prototypes -Wwrite-strings
-CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
-INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client -I$(top_srcdir)/gvdb $(gio_CFLAGS)
+INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/client
 
 bin_PROGRAMS = dconf
 
 dconf_VALAFLAGS = --vapidir ../client --pkg=gio-2.0 --pkg=posix --pkg=dconf
-dconf_LDADD = $(gio_LIBS) ../client/libdconf.so.0
-dconf_SOURCES = dconf.vala dconf-update.vala dconf-dump.vala ../gvdb/gvdb-builder.c gvdb.vapi
+
+dconf_CFLAGS = $(gio_CFLAGS)
+
+dconf_LDADD = \
+	../client/libdconf.so.0		\
+	$(gio_LIBS)
+
+dconf_SOURCES = \
+	../gvdb/gvdb-builder.c	\
+	gvdb.vapi		\
+	dconf-update.vala	\
+	dconf-dump.vala		\
+	dconf.vala
 
 completiondir = $(sysconfdir)/bash_completion.d
 completion_DATA = dconf-bash-completion.sh
diff --git a/bin/gvdb.vapi b/bin/gvdb.vapi
index 1848c1d..1f3e92a 100644
--- a/bin/gvdb.vapi
+++ b/bin/gvdb.vapi
@@ -1,4 +1,4 @@
-[CCode (cheader_filename = "gvdb-builder.h")]
+[CCode (cheader_filename = "../gvdb/gvdb-builder.h")]
 namespace Gvdb {
 	[Compact]
 	[CCode (cname = "GHashTable")]
diff --git a/client/Makefile.am b/client/Makefile.am
index 73bdccc..0b139ed 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -1,9 +1,5 @@
 include $(top_srcdir)/Makefile.gtester
 
-AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
-CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
-INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(gio_CFLAGS)
-
 shlibdir=$(libdir)
 shlib_PROGRAMS = libdconf.so.0.0.0
 nodist_noinst_DATA = libdconf.so.0 libdconf.so
@@ -24,12 +20,20 @@ dconfinclude_HEADERS = \
 	dconf-client.h	\
 	dconf.h
 
-libdconf_so_0_0_0_LDADD = ../common/libdconf-common-shared.a ../engine/libdconf-engine.a ../gdbus/libdconf-gdbus.a ../shm/libdconf-shm-shared.a $(gio_LIBS)
-libdconf_so_0_0_0_LDFLAGS = -shared -Wl,-soname=libdconf.so.0
-libdconf_so_0_0_0_SOURCES = \
+libdconf_client_a_CFLAGS = $(gio_CFLAGS)
+libdconf_client_a_SOURCES = \
 	dconf-client.c
 
-libdconf_client_a_SOURCES = dconf-client.c
+libdconf_so_0_0_0_CFLAGS = $(libdconf_client_a_CFLAGS) -fPIC -DPIC
+libdconf_so_0_0_0_LDADD = \
+	../engine/libdconf-engine-shared.a		\
+	../common/libdconf-common-shared.a		\
+	../gdbus/libdconf-gdbus-thread-shared.a		\
+	../gvdb/libgvdb-shared.a			\
+	../shm/libdconf-shm-shared.a			\
+	$(gio_LIBS)
+libdconf_so_0_0_0_LDFLAGS = -shared -Wl,-soname=libdconf.so.0
+libdconf_so_0_0_0_SOURCES = $(libdconf_client_a_SOURCES)
 
 EXTRA_DIST = dconf.vapi dconf.deps
 
diff --git a/client/dconf-client.c b/client/dconf-client.c
index 1e3efc0..eced4f1 100644
--- a/client/dconf-client.c
+++ b/client/dconf-client.c
@@ -22,7 +22,7 @@
 
 #include "dconf-client.h"
 
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
 #include <glib-object.h>
 
 struct _DConfClient
diff --git a/client/dconf-client.h b/client/dconf-client.h
index 969e2ff..d09fdbd 100644
--- a/client/dconf-client.h
+++ b/client/dconf-client.h
@@ -23,7 +23,7 @@
 #define __dconf_client_h__
 
 #include <gio/gio.h>
-#include "dconf-changeset.h"
+#include "../common/dconf-changeset.h"
 
 G_BEGIN_DECLS
 
diff --git a/client/dconf.h b/client/dconf.h
index 77f1154..21b8f70 100644
--- a/client/dconf.h
+++ b/client/dconf.h
@@ -23,6 +23,7 @@
 #define __dconf_h__
 
 #include <dconf-paths.h>
+#include <dconf-changeset.h>
 #include <dconf-client.h>
 
 #endif /* __dconf_h__ */
diff --git a/common/Makefile.am b/common/Makefile.am
index 324f0fe..10856f2 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -4,13 +4,12 @@ dconfinclude_HEADERS = \
 	dconf-paths.h
 
 noinst_LIBRARIES = libdconf-common.a libdconf-common-shared.a
-libdconf_common_a_CFLAGS = -Wall
-INCLUDES = $(glib_CFLAGS)
 
+libdconf_common_a_CFLAGS = $(glib_CFLAGS)
 libdconf_common_a_SOURCES = \
 	dconf-changeset.h	\
 	dconf-changeset.c	\
 	dconf-paths.c
 
-libdconf_common_shared_a_CFLAGS = -fPIC -DPIC $(libdconf_common_a_CFLAGS)
+libdconf_common_shared_a_CFLAGS = $(libdconf_common_a_CFLAGS) -fPIC -DPIC
 libdconf_common_shared_a_SOURCES = $(libdconf_common_a_SOURCES)
diff --git a/configure.ac b/configure.ac
index 72c35d8..56bd4d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,11 @@ AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([1.11 -Wno-portability no-dist-gzip dist-xz])
 AM_SILENT_RULES([yes])
 
+# Set default CFLAGS before AC_PROG_CC does
+if test "${CFLAGS+yes}" != "yes"; then
+  CFLAGS='-O2 -g -Wall -Wwrite-strings -Wmissing-prototypes -fno-common'
+fi
+
 # Check for programs
 AC_PROG_CC
 AC_PROG_RANLIB
diff --git a/editor/Makefile.am b/editor/Makefile.am
index 8928acc..1a593c3 100644
--- a/editor/Makefile.am
+++ b/editor/Makefile.am
@@ -1,12 +1,30 @@
 include $(top_srcdir)/Makefile.gtester
 
+INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/client
+
 bin_PROGRAMS = dconf-editor
 
-AM_CFLAGS = $(gtk_CFLAGS) $(gmodule_CFLAGS) $(libxml_CFLAGS) -I$(top_srcdir)/common -I$(top_srcdir)/client -DPKGDATADIR=\"@datadir@/dconf-editor\"
-AM_VALAFLAGS = --vapidir ../client --pkg gtk+-3.0 --pkg gmodule-2.0 --pkg libxml-2.0 --pkg dconf
-CFLAGS += -Wno-error -Wno-unused-but-set-variable -Wno-unused-variable
-dconf_editor_LDADD = ../client/libdconf.so.0 $(gtk_LIBS) $(gmodule_LIBS) $(gee_LIBS) $(libxml_LIBS)
-dconf_editor_SOURCES = config.vapi dconf-editor.vala dconf-model.vala dconf-schema.vala dconf-view.vala
+dconf_editor_VALAFLAGS = --vapidir ../client --pkg gtk+-3.0 --pkg gmodule-2.0 --pkg libxml-2.0 --pkg dconf
+
+dconf_editor_LDADD = \
+	../client/libdconf.so.0		\
+	$(gtk_LIBS)			\
+	$(gee_LIBS)			\
+	$(gmodule_LIBS)			\
+	$(libxml_LIBS)
+
+dconf_editor_CFLAGS = \
+	$(gtk_CFLAGS)			\
+	$(gee_CFLAGS)			\
+	$(libxml_CFLAGS)		\
+	-DPKGDATADIR=\"$(pkgdatadir)\"
+
+dconf_editor_SOURCES = \
+	config.vapi		\
+	dconf-editor.vala	\
+	dconf-model.vala	\
+	dconf-schema.vala	\
+	dconf-view.vala
 
 desktopdir = $(datadir)/applications
 desktop_in_files = dconf-editor.desktop.in.in
@@ -30,7 +48,7 @@ update-icon-cache:
 		gtk-update-icon-cache -f -t $(datadir)/icons/hicolor; \
 	fi
 
-uidir = $(datadir)/dconf-editor
-dist_ui_DATA = dconf-editor.ui
+pkgdatadir = $(datadir)/dconf-editor
+dist_pkgdata_DATA = dconf-editor.ui
 
 EXTRA_DIST = $(gsettings_SCHEMAS) $(icons)
diff --git a/engine/.gitignore b/engine/.gitignore
index d0ac5ba..013c7e7 100644
--- a/engine/.gitignore
+++ b/engine/.gitignore
@@ -1 +1,2 @@
 libdconf-engine.a
+libdconf-engine-shared.a
diff --git a/engine/Makefile.am b/engine/Makefile.am
index 2bab9fa..8f0f8f2 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -1,12 +1,9 @@
 include $(top_srcdir)/Makefile.gtester
 
-noinst_LIBRARIES = libdconf-engine.a
-
-libdconf_engine_a_CFLAGS = -fPIC -DPIC -Wall
-INCLUDES = $(glib_CFLAGS) -I$(top_srcdir)/gvdb -I$(top_srcdir)/common -I$(top_srcdir)/shm
+noinst_LIBRARIES = libdconf-engine.a libdconf-engine-shared.a
 
+libdconf_engine_a_CFLAGS = $(glib_CFLAGS)
 libdconf_engine_a_SOURCES = \
-	../gvdb/gvdb-reader.c		\
 	dconf-changeset-list.h		\
 	dconf-engine-profile.h		\
 	dconf-engine-profile.c		\
@@ -17,3 +14,6 @@ libdconf_engine_a_SOURCES = \
 	dconf-engine-source.c		\
 	dconf-engine.h			\
 	dconf-engine.c
+
+libdconf_engine_shared_a_CFLAGS = $(libdconf_engine_a_CFLAGS) -fPIC -DPIC
+libdconf_engine_shared_a_SOURCES = $(libdconf_engine_a_SOURCES)
diff --git a/engine/dconf-changeset-list.h b/engine/dconf-changeset-list.h
index 01bd0ff..68963b0 100644
--- a/engine/dconf-changeset-list.h
+++ b/engine/dconf-changeset-list.h
@@ -22,7 +22,7 @@
 #ifndef __dconf_changeset_list_h__
 #define __dconf_changeset_list_h__
 
-#include "dconf-changeset.h"
+#include "../common/dconf-changeset.h"
 
 typedef struct _DConfChangesetList                          DConfChangesetList;
 
diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c
index 3a2ddba..5034eec 100644
--- a/engine/dconf-engine-source-user.c
+++ b/engine/dconf-engine-source-user.c
@@ -22,7 +22,7 @@
 
 #include "dconf-engine-source-private.h"
 
-#include "dconf-shm.h"
+#include "../shm/dconf-shm.h"
 #include <sys/mman.h>
 #include <fcntl.h>
 #include <errno.h>
diff --git a/engine/dconf-engine-source.h b/engine/dconf-engine-source.h
index cb8e9c2..75e0e06 100644
--- a/engine/dconf-engine-source.h
+++ b/engine/dconf-engine-source.h
@@ -23,7 +23,7 @@
 #ifndef __dconf_engine_source_h__
 #define __dconf_engine_source_h__
 
-#include <gvdb-reader.h>
+#include "../gvdb/gvdb-reader.h"
 #include <gio/gio.h>
 
 typedef struct _DConfEngineSourceVTable DConfEngineSourceVTable;
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index 1e9aa64..24610ec 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -22,7 +22,7 @@
 #define _XOPEN_SOURCE 600
 #include "dconf-engine.h"
 
-#include <gvdb-reader.h>
+#include "../gvdb/gvdb-reader.h"
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
diff --git a/gdbus/.gitignore b/gdbus/.gitignore
index 9bc55b6..0269bef 100644
--- a/gdbus/.gitignore
+++ b/gdbus/.gitignore
@@ -1 +1,4 @@
-libdconf-gdbus.a
+libdconf-gdbus-filter.a
+libdconf-gdbus-filter-shared.a
+libdconf-gdbus-thread.a
+libdconf-gdbus-thread-shared.a
diff --git a/gdbus/Makefile.am b/gdbus/Makefile.am
index 2486e90..cee235c 100644
--- a/gdbus/Makefile.am
+++ b/gdbus/Makefile.am
@@ -1,6 +1,21 @@
 include $(top_srcdir)/Makefile.gtester
 
-noinst_LIBRARIES = libdconf-gdbus.a
-INCLUDES = $(glib_CFLAGS) -I$(top_srcdir)/engine -I$(top_srcdir)/common
-libdconf_gdbus_a_CFLAGS = -Wall -fPIC -DPIC
-libdconf_gdbus_a_SOURCES = dconf-gdbus-thread.c
+noinst_LIBRARIES = \
+	libdconf-gdbus-thread.a			\
+	libdconf-gdbus-thread-shared.a		\
+	libdconf-gdbus-filter.a			\
+	libdconf-gdbus-filter-shared.a
+
+libdconf_gdbus_thread_a_CFLAGS = $(gio_CFLAGS)
+libdconf_gdbus_thread_a_SOURCES = \
+	dconf-gdbus-thread.c
+
+libdconf_gdbus_thread_shared_a_CFLAGS = $(libdconf_gdbus_thread_a_CFLAGS) -fPIC -DPIC
+libdconf_gdbus_thread_shared_a_SOURCES = $(libdconf_gdbus_thread_a_SOURCES)
+
+libdconf_gdbus_filter_a_CFLAGS = $(gio_CFLAGS)
+libdconf_gdbus_filter_a_SOURCES = \
+	dconf-gdbus-filter.c
+
+libdconf_gdbus_filter_shared_a_CFLAGS = $(libdconf_gdbus_filter_a_CFLAGS) -fPIC -DPIC
+libdconf_gdbus_filter_shared_a_SOURCES = $(libdconf_gdbus_filter_a_SOURCES)
diff --git a/gdbus/dconf-gdbus-filter.c b/gdbus/dconf-gdbus-filter.c
index 2515a33..e074bce 100644
--- a/gdbus/dconf-gdbus-filter.c
+++ b/gdbus/dconf-gdbus-filter.c
@@ -1,4 +1,4 @@
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
 
 
 
diff --git a/gdbus/dconf-gdbus-thread.c b/gdbus/dconf-gdbus-thread.c
index 3c868b5..47bc6cb 100644
--- a/gdbus/dconf-gdbus-thread.c
+++ b/gdbus/dconf-gdbus-thread.c
@@ -20,7 +20,7 @@
  * Author: Ryan Lortie <desrt desrt ca>
  */
 
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
 
 /* We interact with GDBus using a worker thread just for dconf.
  *
diff --git a/gsettings/Makefile.am b/gsettings/Makefile.am
index d218f7e..45fe320 100644
--- a/gsettings/Makefile.am
+++ b/gsettings/Makefile.am
@@ -1,14 +1,18 @@
 include $(top_srcdir)/Makefile.gtester
 
-AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -fPIC -DPIC
-INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/gvdb -I$(top_srcdir)/engine $(gio_CFLAGS)
-
 giomodules_PROGRAMS = libdconfsettings.so
 
-libdconfsettings_so_LDADD = $(gio_LIBS) ../engine/libdconf-engine.a ../gdbus/libdconf-gdbus.a ../common/libdconf-common-shared.a ../shm/libdconf-shm-shared.a
+libdconfsettings_so_LDADD = \
+	../engine/libdconf-engine-shared.a		\
+	../gvdb/libgvdb-shared.a			\
+	../gdbus/libdconf-gdbus-thread-shared.a		\
+	../common/libdconf-common-shared.a		\
+	../shm/libdconf-shm-shared.a			\
+	$(gio_LIBS)
+
+libdconfsettings_so_CFLAGS = $(gio_CFLAGS) -fPIC -DPIC
 libdconfsettings_so_LDFLAGS = -shared
 libdconfsettings_so_SOURCES = \
-	../gvdb/gvdb-reader.c		\
 	dconfcontext.h			\
 	dconfcontext.c			\
 	dconfsettingsbackend.c
diff --git a/gsettings/dconfsettingsbackend.c b/gsettings/dconfsettingsbackend.c
index 53a982c..60458bd 100644
--- a/gsettings/dconfsettingsbackend.c
+++ b/gsettings/dconfsettingsbackend.c
@@ -21,7 +21,7 @@
 
 #define G_SETTINGS_ENABLE_BACKEND
 #include <gio/gsettingsbackend.h>
-#include <dconf-engine.h>
+#include "../engine/dconf-engine.h"
 #include <gio/gio.h>
 
 #include <string.h>
diff --git a/gvdb/.gitignore b/gvdb/.gitignore
new file mode 100644
index 0000000..8b5dee6
--- /dev/null
+++ b/gvdb/.gitignore
@@ -0,0 +1,2 @@
+libgvdb.a
+libgvdb-shared.a
diff --git a/gvdb/Makefile.am b/gvdb/Makefile.am
index 0fe3bb0..24aaf1e 100644
--- a/gvdb/Makefile.am
+++ b/gvdb/Makefile.am
@@ -1,8 +1,14 @@
 include $(top_srcdir)/Makefile.gtester
 
-EXTRA_DIST = \
+noinst_LIBRARIES = libgvdb.a libgvdb-shared.a
+
+libgvdb_a_CFLAGS = $(glib_CFLAGS)
+libgvdb_a_SOURCES = \
 	gvdb-format.h	\
-	gvdb-reader.h	\
-	gvdb-reader.c	\
 	gvdb-builder.h	\
-	gvdb-builder.c
+	gvdb-builder.c	\
+	gvdb-reader.h	\
+	gvdb-reader.c
+
+libgvdb_shared_a_CFLAGS = $(libgvdb_a_CFLAGS) -fPIC -DPIC
+libgvdb_shared_a_SOURCES = $(libgvdb_a_SOURCES)
diff --git a/service/Makefile.am b/service/Makefile.am
index 96ad94e..fe3afaa 100644
--- a/service/Makefile.am
+++ b/service/Makefile.am
@@ -1,15 +1,17 @@
 include $(top_srcdir)/Makefile.gtester
 
-AM_CFLAGS = $(gio_CFLAGS) -I$(top_srcdir)/gvdb -I$(top_srcdir)/common -I$(top_srcdir)/shm -Wall -Wmissing-prototypes -Wwrite-strings
-
 libexec_PROGRAMS = dconf-service
 
 dbusservice_DATA = ca.desrt.dconf.service
 
-dconf_service_LDADD = $(gio_LIBS) ../common/libdconf-common.a ../shm/libdconf-shm.a
+dconf_service_CFLAGS = $(gio_CFLAGS)
+dconf_service_LDADD = \
+	../common/libdconf-common.a	\
+	../gvdb/libgvdb.a		\
+	../shm/libdconf-shm.a		\
+	$(gio_LIBS)
+
 dconf_service_SOURCES = \
-	../gvdb/gvdb-builder.c		\
-	../gvdb/gvdb-reader.c		\
 	dconf-interfaces.h		\
 	dconf-interfaces.c		\
 	dconf-rebuilder.h		\
diff --git a/service/dconf-rebuilder.c b/service/dconf-rebuilder.c
index 65271cd..9cac1a7 100644
--- a/service/dconf-rebuilder.c
+++ b/service/dconf-rebuilder.c
@@ -23,8 +23,8 @@
 
 #include <string.h>
 
-#include "gvdb-reader.h"
-#include "gvdb-builder.h"
+#include "../gvdb/gvdb-reader.h"
+#include "../gvdb/gvdb-builder.h"
 
 typedef struct
 {
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index 6c44c40..c6cda13 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -23,7 +23,7 @@
 
 #include "dconf-rebuilder.h"
 #include "dconf-state.h"
-#include "dconf-shm.h"
+#include "../shm/dconf-shm.h"
 
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/service/dconf-writer.h b/service/dconf-writer.h
index cbabadb..8f391fe 100644
--- a/service/dconf-writer.h
+++ b/service/dconf-writer.h
@@ -22,7 +22,7 @@
 #ifndef __dconf_writer_h__
 #define __dconf_writer_h__
 
-#include "dconf-changeset.h"
+#include "../common/dconf-changeset.h"
 #include "dconf-state.h"
 
 typedef struct OPAQUE_TYPE__DConfWriter DConfWriter;
diff --git a/service/service.c b/service/service.c
index 19eadb2..4c87477 100644
--- a/service/service.c
+++ b/service/service.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 
 #include "dconf-interfaces.h"
-#include "dconf-changeset.h"
+#include "../common/dconf-changeset.h"
 #include "dconf-writer.h"
 #include "dconf-state.h"
 
diff --git a/shm/Makefile.am b/shm/Makefile.am
index b3068cb..ffa2fd3 100644
--- a/shm/Makefile.am
+++ b/shm/Makefile.am
@@ -1,12 +1,11 @@
 include $(top_srcdir)/Makefile.gtester
 
 noinst_LIBRARIES = libdconf-shm.a libdconf-shm-shared.a
-libdconf_shm_a_CFLAGS = -Wall
-INCLUDES = $(glib_CFLAGS)
 
+libdconf_shm_a_CFLAGS = $(glib_CFLAGS)
 libdconf_shm_a_SOURCES = \
 	dconf-shm.h		\
 	dconf-shm.c
 
-libdconf_shm_shared_a_CFLAGS = -fPIC -DPIC $(libdconf_shm_a_CFLAGS)
+libdconf_shm_shared_a_CFLAGS = $(libdconf_shm_a_CFLAGS) -fPIC -DPIC
 libdconf_shm_shared_a_SOURCES = $(libdconf_shm_a_SOURCES)
diff --git a/tests/.gitignore b/tests/.gitignore
index cb7d423..bada923 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,4 @@
-libdconf-dbus-stub.a
+libdconf-mock.a
 
 changeset
 client
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 53142f7..a4be908 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,88 +1,98 @@
 include $(top_srcdir)/Makefile.gtester
 
-AM_CFLAGS = -Wall -Wmissing-prototypes -Wwrite-strings -DSRCDIR=\"$(abs_srcdir)\"
-INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client $(gio_CFLAGS) -I$(top_srcdir)/dbus-1 $(dbus_CFLAGS) -I$(top_srcdir)/gvdb -I$(top_srcdir)/shm
-
-noinst_LIBRARIES = libdconf-dbus-stub.a
+noinst_LIBRARIES = libdconf-mock.a
 noinst_PROGRAMS = $(TEST_PROGS) gsettings dbus1
 
+libdconf_mock_a_CFLAGS = $(glib_CFLAGS)
+libdconf_mock_a_SOURCES = \
+	dconf-mock-dbus.c	\
+	dconf-mock-gvdb.c	\
+	dconf-mock-shm.c
+
+gsettings_CFLAGS = $(gio_CFLAGS)
 gsettings_LDADD = $(gio_LIBS)
+dbus1_CFLAGS = $(glib_CFLAGS) $(dbus_CFLAGS)
 dbus1_LDADD = -L../dbus-1 -ldconf-dbus-1 $(glib_LIBS)
 
 TEST_PROGS += paths
-paths_LDADD = ../common/libdconf-common.a $(gio_LIBS)
+paths_CFLAGS = $(glib_CFLAGS)
+paths_LDADD = \
+	../common/libdconf-common.a	\
+	$(gio_LIBS)
 paths_SOURCES = paths.c
 
 TEST_PROGS += changeset
-changeset_LDADD = ../common/libdconf-common.a $(glib_LIBS)
+changeset_CFLAGS = $(glib_CFLAGS)
+changeset_LDADD = \
+	../common/libdconf-common.a	\
+	$(glib_LIBS)
 changeset_SOURCES = changeset.c
 
 TEST_PROGS += shm
-shm_LDADD = ../shm/libdconf-shm.a $(glib_LIBS) -ldl
-shm_SOURCES = shm.c tmpdir.h tmpdir.c
-
-engine_LIBS = \
-	../engine/libdconf-engine.a	\
-	../shm/libdconf-shm.a		\
-	../common/libdconf-common.a
-
-engine_with_stub_LIBS = \
-	$(engine_LIBS)			\
-	libdconf-dbus-stub.a
-
-client_LIBS = \
-	../client/libdconf-client.a	\
-	$(engine_LIBS)			\
-	../gdbus/libdconf-gdbus.a
-
-stub_client_LIBS = \
-	../client/libdconf-client.a	\
-	$(engine_with_stub_LIBS)
-
-libdconf_dbus_stub_a_SOURCES = \
-	dconf-dbus-stub.c
+shm_CFLAGS = $(glib_CFLAGS)
+shm_LDADD = \
+	../shm/libdconf-shm.a			\
+	$(glib_LIBS)				\
+	-ldl
+shm_SOURCES = \
+	shm.c					\
+	tmpdir.h				\
+	tmpdir.c
 
 TEST_PROGS += gvdb
-gvdb_LDADD = $(glib_LIBS)
-gvdb_SOURCES = \
-	../gvdb/gvdb-reader.c		\
-	gvdb.c
+gvdb_CFLAGS = $(glib_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+gvdb_LDADD = \
+	../gvdb/libgvdb.a			\
+	$(glib_LIBS)
+gvdb_SOURCES = gvdb.c
 EXTRA_DIST = \
-	gvdbs/empty_gvdb		\
-	gvdbs/example_gvdb		\
-	gvdbs/example_gvdb.big-endian	\
-	gvdbs/file_empty		\
-	gvdbs/file_too_small		\
-	gvdbs/invalid_header		\
+	gvdbs/empty_gvdb			\
+	gvdbs/example_gvdb			\
+	gvdbs/example_gvdb.big-endian		\
+	gvdbs/file_empty			\
+	gvdbs/file_too_small			\
+	gvdbs/invalid_header			\
 	gvdbs/nested_gvdb
 
 TEST_PROGS += gdbus-thread
-gdbus_thread_CFLAGS = $(AM_CFLAGS) -DDBUS_BACKEND=\"/gdbus/thread\"
-gdbus_thread_LDADD = $(gio_LIBS)
-gdbus_thread_SOURCES = \
-	../gdbus/dconf-gdbus-thread.c	\
-	dbus.c
+gdbus_thread_CFLAGS = $(gio_CFLAGS) -DDBUS_BACKEND=\"/gdbus/thread\"
+gdbus_thread_LDADD = \
+	../gdbus/libdconf-gdbus-thread.a	\
+	$(gio_LIBS)
+gdbus_thread_SOURCES = dbus.c
 
 TEST_PROGS += gdbus-filter
-gdbus_filter_CFLAGS = $(AM_CFLAGS) -DDBUS_BACKEND=\"/gdbus/filter\"
-gdbus_filter_LDADD = $(gio_LIBS)
-gdbus_filter_SOURCES = \
-	../gdbus/dconf-gdbus-filter.c	\
-	dbus.c
+gdbus_filter_CFLAGS = $(gio_CFLAGS) -DDBUS_BACKEND=\"/gdbus/filter\"
+gdbus_filter_LDADD = \
+	../gdbus/libdconf-gdbus-filter.a	\
+	$(gio_LIBS)
+gdbus_filter_SOURCES = dbus.c
 
 TEST_PROGS += engine
-engine_LDADD = $(engine_with_stub_LIBS) $(glib_LIBS) -ldl
+engine_CFLAGS = $(glib_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+engine_LDADD = \
+	../engine/libdconf-engine.a		\
+	../common/libdconf-common.a		\
+	libdconf-mock.a				\
+	$(glib_LIBS)				\
+	-ldl
 engine_SOURCES = engine.c
+EXTRA_DIST += \
+	profile/broken-profile			\
+	profile/colourful			\
+	profile/dos				\
+	profile/empty-profile			\
+	profile/many-sources			\
+	profile/no-newline-longline		\
+	profile/test-profile			\
+	profile/will-never-exist
 
 TEST_PROGS += client
-client_LDADD = $(stub_client_LIBS) $(gio_LIBS)
+client_CFLAGS = $(gio_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+client_LDADD = \
+	../client/libdconf-client.a		\
+	../engine/libdconf-engine.a		\
+	../common/libdconf-common.a		\
+	libdconf-mock.a				\
+	$(gio_LIBS)
 client_SOURCES = client.c
-EXTRA_DIST += \
-	profile/broken-profile		\
-	profile/colourful		\
-	profile/dos			\
-	profile/empty-profile		\
-	profile/many-sources		\
-	profile/no-newline-longline	\
-	profile/test-profile		\
-	profile/will-never-exist
diff --git a/tests/changeset.c b/tests/changeset.c
index 744a8e2..17d77fa 100644
--- a/tests/changeset.c
+++ b/tests/changeset.c
@@ -1,4 +1,4 @@
-#include <dconf-changeset.h>
+#include "../common/dconf-changeset.h"
 
 static gboolean
 should_not_run (const gchar *key,
diff --git a/tests/client.c b/tests/client.c
index 1891db4..ad0115d 100644
--- a/tests/client.c
+++ b/tests/client.c
@@ -1,6 +1,6 @@
 #define _BSD_SOURCE
-#include <dconf-client.h>
-#include <dconf-engine.h>
+#include "../client/dconf-client.h"
+#include "../engine/dconf-engine.h"
 #include <string.h>
 #include <stdlib.h>
 
diff --git a/tests/dbus.c b/tests/dbus.c
index e227266..8f813a8 100644
--- a/tests/dbus.c
+++ b/tests/dbus.c
@@ -5,7 +5,7 @@
 /* Test the DBus communicaton code.
  */
 
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
 
 static gboolean okay_in_main;
 static GThread *main_thread;
diff --git a/tests/dbus1.c b/tests/dbus1.c
index 1220160..9bb2d7a 100644
--- a/tests/dbus1.c
+++ b/tests/dbus1.c
@@ -17,7 +17,7 @@
  * Author: Ryan Lortie <desrt desrt ca>
  **/
 
-#include <dconf-dbus-1.h>
+#include "../dbus-1/dconf-dbus-1.h"
 
 #include <stdbool.h>
 #include <unistd.h>
diff --git a/tests/dconf-dbus-stub.c b/tests/dconf-mock-dbus.c
similarity index 98%
rename from tests/dconf-dbus-stub.c
rename to tests/dconf-mock-dbus.c
index 7e34f98..772e9ed 100644
--- a/tests/dconf-dbus-stub.c
+++ b/tests/dconf-mock-dbus.c
@@ -19,7 +19,7 @@
  * Author: Ryan Lortie <desrt desrt ca>
  */
 
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
 
 GQueue outstanding_call_handles;
 
diff --git a/tests/dconf-mock-gvdb.c b/tests/dconf-mock-gvdb.c
new file mode 100644
index 0000000..96695ad
--- /dev/null
+++ b/tests/dconf-mock-gvdb.c
@@ -0,0 +1,49 @@
+#include "../gvdb/gvdb-reader.h"
+
+void
+gvdb_table_unref (GvdbTable *table)
+{
+}
+
+GvdbTable *
+gvdb_table_get_table (GvdbTable   *table,
+                      const gchar *key)
+{
+  return NULL;
+}
+
+gboolean
+gvdb_table_has_value (GvdbTable   *table,
+                      const gchar *key)
+{
+  return FALSE;
+}
+
+GVariant *
+gvdb_table_get_value (GvdbTable   *table,
+                      const gchar *key)
+{
+  return NULL;
+}
+
+gchar **
+gvdb_table_list (GvdbTable *table,
+                 const gchar *key)
+{
+  return NULL;
+}
+
+GvdbTable *
+gvdb_table_new (const gchar  *filename,
+                gboolean      trusted,
+                GError      **error)
+{
+  g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "not implemented");
+  return NULL;
+}
+
+gboolean
+gvdb_table_is_valid (GvdbTable *table)
+{
+  return TRUE;
+}
diff --git a/tests/dconf-mock-shm.c b/tests/dconf-mock-shm.c
new file mode 100644
index 0000000..e9edb1c
--- /dev/null
+++ b/tests/dconf-mock-shm.c
@@ -0,0 +1,13 @@
+#include "../shm/dconf-shm.h"
+
+guint8 *
+dconf_shm_open (const gchar *name)
+{
+  return g_malloc0 (1);
+}
+
+void
+dconf_shm_close (guint8 *shm)
+{
+  g_free (shm);
+}
diff --git a/tests/engine.c b/tests/engine.c
index cb01cda..50d8362 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -1,7 +1,7 @@
 #define _GNU_SOURCE
 
-#include <dconf-engine.h>
-#include <dconf-engine-profile.h>
+#include "../engine/dconf-engine.h"
+#include "../engine/dconf-engine-profile.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <dlfcn.h>
diff --git a/tests/gvdb.c b/tests/gvdb.c
index 35a16a2..47b2b51 100644
--- a/tests/gvdb.c
+++ b/tests/gvdb.c
@@ -1,5 +1,5 @@
 #include <glib.h>
-#include "gvdb-reader.h"
+#include "../gvdb/gvdb-reader.h"
 
 static void
 test_reader_open_error (void)
diff --git a/tests/paths.c b/tests/paths.c
index 7395515..57eede2 100644
--- a/tests/paths.c
+++ b/tests/paths.c
@@ -1,4 +1,4 @@
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
 
 static void
 test_paths (void)
diff --git a/tests/shm.c b/tests/shm.c
index cb60560..3d8b385 100644
--- a/tests/shm.c
+++ b/tests/shm.c
@@ -1,5 +1,5 @@
 #define _GNU_SOURCE
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
 #include <glib/gstdio.h>
 #include <sys/stat.h>
 #include <stdlib.h>
@@ -8,7 +8,7 @@
 #include <errno.h>
 #include <dlfcn.h>
 
-#include "dconf-shm.h"
+#include "../shm/dconf-shm.h"
 #include "tmpdir.h"
 
 static void
diff --git a/tests/tmpdir.c b/tests/tmpdir.c
index 405d37b..b72d646 100644
--- a/tests/tmpdir.c
+++ b/tests/tmpdir.c
@@ -1,7 +1,7 @@
 #include "tmpdir.h"
 
 #include <glib/gstdio.h>
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
 #include <string.h>
 
 gchar *



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