summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/Makefile.am12
-rw-r--r--plugins/Makefile.am12
-rw-r--r--src/Makefile.am2
-rwxr-xr-xsrc/genbuiltin17
4 files changed, 24 insertions, 19 deletions
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 "};"