Add directory for driver plugins
authorMarcel Holtmann <marcel.holtmann@intel.com>
Mon, 11 May 2009 05:44:37 +0000 (22:44 -0700)
committerMarcel Holtmann <marcel.holtmann@intel.com>
Mon, 11 May 2009 05:44:37 +0000 (22:44 -0700)
.gitignore
Makefile.am
configure.ac
drivers/Makefile.am [new file with mode: 0644]
plugins/Makefile.am
src/Makefile.am
src/plugin.c

index 7e04fdf..eb8edd0 100644 (file)
@@ -27,3 +27,4 @@ src/ofonod
 src/ofono.exp
 src/ofono.ver
 plugins/builtin.h
+drivers/builtin.h
index e125f4b..07cf816 100644 (file)
@@ -1,5 +1,5 @@
 
-SUBDIRS = gdbus gatchat include plugins src doc
+SUBDIRS = gdbus gatchat include plugins drivers src doc
 
 DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles
 
index adc5b57..9387c30 100644 (file)
@@ -86,5 +86,5 @@ AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
 
 AC_OUTPUT(Makefile gdbus/Makefile gatchat/Makefile
-                               include/Makefile include/version.h
-                               src/Makefile plugins/Makefile doc/Makefile)
+                       include/Makefile include/version.h src/Makefile
+                       plugins/Makefile drivers/Makefile doc/Makefile)
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
new file mode 100644 (file)
index 0000000..0791a1a
--- /dev/null
@@ -0,0 +1,28 @@
+
+builtin_modules =
+builtin_sources =
+builtin_cflags =
+
+noinst_LTLIBRARIES = libbuiltin.la
+libbuiltin_la_SOURCES = $(builtin_sources)
+libbuiltin_la_LDFLAGS =
+libbuiltin_la_CFLAGS = $(AM_CFLAGS) $(builtin_cflags) -DOFONO_PLUGIN_BUILTIN
+
+BUILT_SOURCES = builtin.h
+
+nodist_libbuiltin_la_SOURCES = $(BUILT_SOURCES)
+
+CLEANFILES = $(BUILT_SOURCES)
+
+MAINTAINERCLEANFILES = Makefile.in
+
+builtin.h:
+       echo "" > $@
+       list='$(builtin_modules)'; for i in $$list; \
+         do echo "extern struct ofono_plugin_desc __ofono_builtin_$$i;" >> $@; done
+       echo "" >> $@
+       echo "static struct ofono_plugin_desc *__ofono_drivers[] = {" >> $@
+       list='$(builtin_modules)'; for i in $$list; \
+         do echo "&__ofono_builtin_$$i," >> $@; done
+       echo "NULL };" >> $@
index e2ad41f..b65bc73 100644 (file)
@@ -22,7 +22,7 @@ builtin.h:
        list='$(builtin_modules)'; for i in $$list; \
          do echo "extern struct ofono_plugin_desc __ofono_builtin_$$i;" >> $@; done
        echo "" >> $@
-       echo "static struct ofono_plugin_desc *__ofono_builtin[] = {" >> $@
+       echo "static struct ofono_plugin_desc *__ofono_plugins[] = {" >> $@
        list='$(builtin_modules)'; for i in $$list; \
          do echo "&__ofono_builtin_$$i," >> $@; done
        echo "NULL };" >> $@
index 9144959..15285c5 100644 (file)
@@ -14,6 +14,7 @@ ofonod_SOURCES = main.c ofono.h log.c plugin.c \
                call-settings.c call-waiting.c call-forwarding.c call-meter.c
 
 ofonod_LDADD = $(top_builddir)/plugins/libbuiltin.la \
+               $(top_builddir)/drivers/libbuiltin.la \
                                @GDBUS_LIBS@ @GLIB_LIBS@ @GTHREAD_LIBS@ -ldl
 
 ofonod_LDFLAGS = -Wl,--export-dynamic -Wl,--version-script=ofono.ver
index 27c2a92..017ebad 100644 (file)
@@ -89,6 +89,7 @@ static gboolean check_plugin(struct ofono_plugin_desc *desc,
 }
 
 #include "plugins/builtin.h"
+#include "drivers/builtin.h"
 
 int __ofono_plugin_init(const char *pattern, const char *exclude)
 {
@@ -100,12 +101,20 @@ int __ofono_plugin_init(const char *pattern, const char *exclude)
 
        DBG("");
 
-       for (i = 0; __ofono_builtin[i]; i++) {
-               if (check_plugin(__ofono_builtin[i],
-                                               pattern, exclude) == FALSE)
+       for (i = 0; __ofono_plugins[i]; i++) {
+               if (check_plugin(__ofono_plugins[i],
+                                       pattern, exclude) == FALSE)
                        continue;
 
-               add_plugin(NULL, __ofono_builtin[i]);
+               add_plugin(NULL, __ofono_plugins[i]);
+       }
+
+       for (i = 0; __ofono_drivers[i]; i++) {
+               if (check_plugin(__ofono_drivers[i],
+                                       pattern, exclude) == FALSE)
+                       continue;
+
+               add_plugin(NULL, __ofono_drivers[i]);
        }
 
        dir = g_dir_open(PLUGINDIR, 0, NULL);