[glib] docs: Update glib-genmarshal man page



commit bf4f825e84e7385029ff3f65de61e20b46e5453d
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Oct 13 16:03:52 2017 +0100

    docs: Update glib-genmarshal man page
    
    We should show how to properly use glib-genmarshal with Autotools, in
    the hope that fewer people will be caught cargo-culting rules written
    in the late '90s.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788948

 docs/reference/gobject/glib-genmarshal.xml |   44 ++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gobject/glib-genmarshal.xml b/docs/reference/gobject/glib-genmarshal.xml
index 61cfe77..bf72ba7 100644
--- a/docs/reference/gobject/glib-genmarshal.xml
+++ b/docs/reference/gobject/glib-genmarshal.xml
@@ -411,6 +411,50 @@ debugging information. This option is mutually exclusive with the
 </variablelist>
 </refsect1>
 
+<refsect1><title>Using glib-genmarshal with Autotools</title>
+<para>
+In order to use <command>glib-genmarshal</command> in your project when using
+Autotools as the build system, you will first need to modify your
+<filename>configure.ac</filename> file to ensure you find the appropriate
+command using <command>pkg-config</command>, similarly as to how you discover
+the compiler and linker flags for GLib.
+</para>
+<informalexample><programlisting>
+PKG_PROG_PKG_CONFIG([0.28])
+
+PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal])
+</programlisting></informalexample>
+<para>
+In your <filename>Makefile.am</filename> file you will typically need very
+simple rules to generate the C files needed for the build.
+</para>
+<informalexample><programlisting>
+marshal.h: marshal.list
+        $(AM_V_GEN)$(GLIB_GENMARSHAL) \
+                --header \
+                --output=$@ \
+                $&lt;
+
+marshal.c: marshal.list marshal.h
+        $(AM_V_GEN)$(GLIB_GENMARSHAL) \
+                --include-header=marshal.h \
+                --body \
+                --output=$@ \
+                $&lt;
+
+BUILT_SOURCES += marshal.h marshal.c
+CLEANFILES += marshal.h marshal.c
+EXTRA_DIST += marshal.list
+</programlisting></informalexample>
+<para>
+In the example above, the first rule generates the header file and depends on
+a <filename>marshal.list</filename> file in order to regenerate the result in
+case the marshallers list is updated. The second rule generates the source file
+for the same <filename>marshal.list</filename>, and includes the file generated
+by the header rule.
+</para>
+</refsect1>
+
 <refsect1><title>Example</title>
 <para>
 To generate marshallers for the following callback functions:


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