mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
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
This commit is contained in:
parent
0d69462f14
commit
bf4f825e84
@ -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=$@ \
|
||||
$<
|
||||
|
||||
marshal.c: marshal.list marshal.h
|
||||
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
|
||||
--include-header=marshal.h \
|
||||
--body \
|
||||
--output=$@ \
|
||||
$<
|
||||
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user