From 7d3d52009dd110f3b2f94adad98348f6171f4c3d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 24 Aug 2009 19:05:41 -0700 Subject: [PATCH] Use script to generate list of builtin plugin symbols --- drivers/Makefile.am | 12 +++--------- plugins/Makefile.am | 12 +++--------- src/Makefile.am | 2 +- src/genbuiltin | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 19 deletions(-) create mode 100755 src/genbuiltin diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 87a26644..9c40fd17 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -43,12 +43,6 @@ 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 };" >> $@ +builtin.h: $(top_srcdir)/src/genbuiltin $(builtin_sources) + $(AM_V_GEN)$(top_srcdir)/src/genbuiltin $(builtin_modules) | \ + $(SED) -e "s/builtin\[\]/drivers\[\]/" > $@ diff --git a/plugins/Makefile.am b/plugins/Makefile.am index d9b612e1..d1728e82 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -30,12 +30,6 @@ 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_plugins[] = {" >> $@ - list='$(builtin_modules)'; for i in $$list; \ - do echo "&__ofono_builtin_$$i," >> $@; done - echo "NULL };" >> $@ +builtin.h: $(top_srcdir)/src/genbuiltin $(builtin_sources) + $(AM_V_GEN)$(top_srcdir)/src/genbuiltin $(builtin_modules) | \ + $(SED) -e "s/builtin\[\]/plugins\[\]/" > $@ diff --git a/src/Makefile.am b/src/Makefile.am index 8fe055c0..11dac64b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,7 +40,7 @@ AM_CFLAGS = @GTHREAD_CFLAGS@ @GLIB_CFLAGS@ @GDBUS_CFLAGS@ @GATCHAT_CFLAGS@ \ INCLUDES = -I$(top_builddir)/include -I$(top_builddir) -EXTRA_DIST = ofono.conf +EXTRA_DIST = genbuiltin ofono.conf MAINTAINERCLEANFILES = Makefile.in diff --git a/src/genbuiltin b/src/genbuiltin new file mode 100755 index 00000000..d64bc725 --- /dev/null +++ b/src/genbuiltin @@ -0,0 +1,17 @@ +#!/bin/sh + +for i in $* +do + echo "extern struct ofono_plugin_desc __ofono_builtin_$i;" +done + +echo +echo "static struct ofono_plugin_desc *__ofono_builtin[] = {" + +for i in $* +do + echo " &__ofono_builtin_$i," +done + +echo " NULL" +echo "};"