[Spice-devel] [PATCH 04/10] Generate GTypes for spice-server enums
Jonathon Jongsma
jjongsma at redhat.com
Thu Sep 1 22:17:21 UTC 2016
On Thu, 2016-09-01 at 10:47 +0200, Victor Toso wrote:
> Hi,
>
> On Wed, Aug 31, 2016 at 11:54:40AM -0500, Jonathon Jongsma wrote:
> >
> > ---
> > server/Makefile.am | 31 +++++++++++++++++++++++++++++++
> > 1 file changed, 31 insertions(+)
> >
> > diff --git a/server/Makefile.am b/server/Makefile.am
> > index 968829a..771b33f 100644
> > --- a/server/Makefile.am
> > +++ b/server/Makefile.am
> > @@ -68,6 +68,8 @@ libspice_serverinclude_HEADERS = \
> > spice.h \
> > $(NULL)
> >
> > +spice_built_sources = spice-server-enums.h spice-server-enums.c
> > +
> > libserver_la_SOURCES = \
> > $(libspice_serverinclude_HEADERS) \
> > agent-msg-filter.c \
> > @@ -155,6 +157,7 @@ libserver_la_SOURCES =
> > \
> > dcc-private.h \
> > image-encoders.c \
> > image-encoders.h \
> > + $(spice_built_sources) \
> > $(NULL)
> >
> > if HAVE_LZ4
> > @@ -186,6 +189,34 @@ endif
> > libspice_server_la_LIBADD = libserver.la
> > libspice_server_la_SOURCES =
> >
> > +spice-server-enums.c: spice-server.h
> > + $(AM_V_GEN)glib-mkenums --fhead "#include
> > \"config.h\"\n\n" \
> > + --fhead "#include <glib-object.h>\n" \
> > + --fhead "#include \"spice-server-
> > enums.h\"\n\n" \
> > + --fprod "\n#include \"spice-server.h\"\n"
> > \
> > + --vhead "static const G at Type@Value _ at enum_
> > name at _values[] = {" \
> > + --vprod " { @VALUENAME@, \"@VALUENAME@\",
> > \"@valuenick@\" }," \
> > + --vtail " { 0, NULL, NULL }\n};\n\n" \
> > + --vtail "GType\n at enum_name@_get_type
> > (void)\n{\n" \
> > + --vtail " static GType type = 0;\n" \
> > + --vtail " static volatile gsize
> > type_volatile = 0;\n\n" \
> > + --vtail " if
> > (g_once_init_enter(&type_volatile)) {\n" \
> > + --vtail " type = g_ at type@_register_stat
> > ic (\"@EnumName@\", _ at enum_name@_values);\n" \
> > + --vtail
> > " g_once_init_leave(&type_volatile, type);\n" \
> > + --vtail " }\n\n" \
> > + --vtail " return type;\n}\n\n" \
> > + $^ > $@
> > +
> > +spice-server-enums.h: spice-server.h
> > + $(AM_V_GEN)glib-mkenums --fhead "#ifndef
> > SPICE_SERVER_ENUMS_H\n" \
> > + --fhead "#define SPICE_SERVER_ENUMS_H\n\n"
> > \
> > + --fhead "G_BEGIN_DECLS\n\n" \
> > + --ftail "G_END_DECLS\n\n" \
> > + --ftail "#endif /* SPICE_SERVER_ENUMS_H
> > */\n" \
> > + --eprod "#define SPICE_TYPE_ at ENUMSHORT@
> > @enum_name at _get_type()\n" \
> > + --eprod "GType @enum_name at _get_type
> > (void);\n" \
> > + $^ > $@
> > +
>
> I think make clean should clean $(spice_built_sources) and we should
> add
> them in .gitignore too.
Since these files are assigned to BUILT_SOURCES (see my reply to
Christophe), I believe that autotools cleans them in maintainer-clean.
I think we should probably keep that behavior.
I can add them to .gitignore though. I didn't notice that because I
almost always do out-of-tree builts so git status doesn't show the
generated files for me.
>
> Reviewed-by: Victor Toso <victortoso at redhat.com>
>
> >
> > EXTRA_DIST = \
> > spice-bitmap-utils.tmpl.c \
> > cache-item.tmpl.c \
> > --
> > 2.7.4
> >
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list