[gnumeric] Conf: automate update of gnumec-conf.{c,h}



commit 4aa4b6be875058db0b1cb4ff478b5cdd597fa8d2
Author: Morten Welinder <terra gnome org>
Date:   Fri Nov 11 16:14:24 2011 -0500

    Conf: automate update of gnumec-conf.{c,h}

 src/Makefile.am           |   21 +++++++++++++++++++++
 src/gnumeric-conf.c       |    7 +------
 tools/handle-conf-options |    3 +++
 3 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a2e7755..bc93c45 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -436,6 +436,27 @@ gnumeric-paths.h: Makefile
 	echo '#endif /* GNUMERIC_PATHS_H */'; \
 	) >$@
 
+update-gnumeric-conf:
+	make -C ${top_srcdir}/schemas
+	rm -f gnumeric-conf.c.tmp
+	@PERL@ -pe 'if (/AUTOMATICALLY GENERATED CODE BELOW/) { print; print "\n"; last; }' <gnumeric-conf.c >gnumeric-conf.c.tmp
+	@PERL@ ${top_srcdir}/tools/handle-conf-options --cfile ${top_srcdir}/schemas/org.gnome.gnumeric*.gschema.xml.in >>gnumeric-conf.c.tmp
+	if cmp gnumeric-conf.c gnumeric-conf.c.tmp; then \
+	  rm gnumeric-conf.c.tmp; \
+	else \
+	  mv gnumeric-conf.c.tmp gnumeric-conf.c; \
+	fi
+	rm -f gnumeric-conf.h.tmp
+	@PERL@ -pe 'if (/AUTOMATICALLY GENERATED CODE BELOW/) { print; print "\n"; last; }' <gnumeric-conf.h >gnumeric-conf.h.tmp
+	@PERL@ ${top_srcdir}/tools/handle-conf-options --hfile ${top_srcdir}/schemas/org.gnome.gnumeric*.gschema.xml.in >>gnumeric-conf.h.tmp
+	echo '' >>gnumeric-conf.h.tmp
+	@PERL@ -ne '$$p=1 if (/AUTOMATICALLY GENERATED CODE ABOVE/); print if $$p;' <gnumeric-conf.h >>gnumeric-conf.h.tmp
+	if cmp gnumeric-conf.h gnumeric-conf.h.tmp; then \
+	  rm gnumeric-conf.h.tmp; \
+	else \
+	  mv gnumeric-conf.h.tmp gnumeric-conf.h; \
+	fi
+
 if WITH_NATIVE_WIN32
 gnumeric_rc.o: gnumeric.rc ../gnumeric-config.h
 	$(WINDRES) -DVERSION=$(VERSION) -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` --include-dir $(srcdir) -i $< -o $@
diff --git a/src/gnumeric-conf.c b/src/gnumeric-conf.c
index b31c887..a8c5c80 100644
--- a/src/gnumeric-conf.c
+++ b/src/gnumeric-conf.c
@@ -675,14 +675,9 @@ gnm_conf_get_detachable_toolbars (void)
 /*
  * The following code was generated by running
  *
- *     cd src
- *     perl ../tools/handle-conf-options --cfile \
- *             ../schemas/org.gnome.gnumeric*.gschema.xml.in >~/xxx
- *
- * The corresponding headers were generated using "--hfile".
+ *     make update-gnumeric-conf
  */
 
-
 /* ----------- AUTOMATICALLY GENERATED CODE BELOW -- DO NOT EDIT ----------- */
 
 
diff --git a/tools/handle-conf-options b/tools/handle-conf-options
index 7b1d9dd..ad3b143 100644
--- a/tools/handle-conf-options
+++ b/tools/handle-conf-options
@@ -614,6 +614,9 @@ sub create_hcfile {
 	$cfile .= "}\n\n";
     }
 
+    $cfile =~ s/\n\n+$/\n/;
+    $hfile =~ s/\n\n+$/\n/;
+
     print $hfile if $do_hfile;
     print $cfile if $do_cfile;
 }



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