[monkey-bubble: 529/753] Add a REBUILD rule as in libgnome.



commit 3d377f22d46d518c0de8348d3345ed4c6571ba29
Author: Peter Williams <peterw ximian com>
Date:   Sun Jul 15 00:08:08 2001 +0000

    Add a REBUILD rule as in libgnome.
    
    2001-07-08  Peter Williams  <peterw ximian com>
    
    	* configure.in (REBUILD): Add a REBUILD rule as in libgnome.
    
    In libgnomeui:
    
    2001-07-08  Peter Williams  <peterw ximian com>
    
    	* Makefile.am ($(srcdir)/gnome.defs): Add $(srcdir)/
    	to these targets for when srcdir != builddir.
    	(gnometypebuiltins.c,h): Change from gnome-maketypes.awk
    	to the glib-mkenums script.
    	(gnometype_inits.c): But also provide hooks for one function
    	that will init all the types.
    
    	* gnometypes.c (gnome_type_init): #include gnometype_inits.c
    	to initialize all of the types.

 ChangeLog               |    4 ++
 configure.in            |   16 ++++++++
 libgnomeui/ChangeLog    |   12 ++++++
 libgnomeui/Makefile.am  |   95 +++++++++++++++++++++++++++++-----------------
 libgnomeui/gnometypes.c |   45 +++-------------------
 5 files changed, 99 insertions(+), 73 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b508b9b..e46d567 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-07-08  Peter Williams  <peterw ximian com>
+
+	* configure.in (REBUILD): Add a REBUILD rule as in libgnome.
+
 2001-07-13  Darin Adler  <darin bentspoon com>
 
 	* configure.in: Remove duplicate macros.
diff --git a/configure.in b/configure.in
index b3a917a..41f5b6e 100644
--- a/configure.in
+++ b/configure.in
@@ -79,6 +79,22 @@ test -z "$GDK_PIXBUF_CSOURCE" && AC_MSG_ERROR([
 *** GTK+ 2.0 installation
 ])
 
+dnl Don't use AC_PROG_AWK since we need the full pathname.
+AC_PATH_PROGS(AWK, mawk gawk nawk awk, )
+AC_PATH_PROGS(PERL, perl5 perl)
+
+# define a MAINT-like variable REBUILD which is set if Perl
+# and awk are found, so autogenerated sources can be rebuilt
+AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
+REBUILD=\#
+if test "x$enable_rebuilds" = "xyes" && \
+     test -n "$PERL" && \
+     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
+     test -n "$AWK" ; then
+  REBUILD=
+fi
+AC_SUBST(REBUILD)
+
 AC_OUTPUT([
 Makefile
 po/Makefile.in
diff --git a/libgnomeui/ChangeLog b/libgnomeui/ChangeLog
index 72f7daf..f1788a3 100644
--- a/libgnomeui/ChangeLog
+++ b/libgnomeui/ChangeLog
@@ -1,3 +1,15 @@
+2001-07-08  Peter Williams  <peterw ximian com>
+
+	* Makefile.am ($(srcdir)/gnome.defs): Add $(srcdir)/
+	to these targets for when srcdir != builddir.
+	(gnometypebuiltins.c,h): Change from gnome-maketypes.awk
+	to the glib-mkenums script.
+	(gnometype_inits.c): But also provide hooks for one function
+	that will init all the types.
+	
+	* gnometypes.c (gnome_type_init): #include gnometype_inits.c
+	to initialize all of the types.
+
 2001-07-08  Martin Baulig  <baulig suse de>
 
 	* gnome-canvas-init.c (gtk_module_info): Added gtk_options.
diff --git a/libgnomeui/Makefile.am b/libgnomeui/Makefile.am
index 33107db..29a2e53 100644
--- a/libgnomeui/Makefile.am
+++ b/libgnomeui/Makefile.am
@@ -60,6 +60,8 @@ unused_SOURCES = \
 	gnome-ditem-edit.c
 
 libgnomeui_2_la_SOURCES = \
+	gnometypebuiltins.h		\
+	gnometypebuiltins.c		\
 	gnome-stock-icons.c		\
 	gnome-about.c			\
 	gnome-canvas-init.c		\
@@ -138,42 +140,68 @@ libgnomeuiinclude_HEADERS =		\
 
 gnome_remote_bootstrap_SOURCES=gnome-remote-bootstrap.c
 
-BUILT_SOURCES = \
-	gnometypebuiltins.h		\
-	gnometypebuiltins_evals.c	\
-	gnometypebuiltins_ids.c		\
-	gnometypebuiltins_vars.c
-
-# generate gnome.defs file from gnome-boxed.defs and *.h
-gnome.defs: $(GNOME_MAKEENUMS) gnome-boxed.defs $(gnome_headers)
-	cd $(srcdir) \
-	&& $(GNOME_MAKEENUMS) defs $(gnome_headers) > gd.tmp \
-	&& cat gnome-boxed.defs >> gd.tmp \
-	&& mv gd.tmp gnome.defs
-
-# generate type identifier header (GTK_TYPE_WIDGET_FLAGS)
-gnometypebuiltins.h: gnome.defs $(GNOME_MAKETYPES)
+# all autogenerated files need to be generated in the srcdir,
+# so old versions get remade and are not confused with newer
+# versions in the build dir. thus a development setup requires
+# srcdir to be writable, passing --disable-rebuilds to
+# ../configure will supress all autogeneration rules.
+$(srcdir)/stamp-libgnomeui.defs: @REBUILD@ Makefile.am libgnomeui.defs libgnomeui-boxed.defs $(gnome_headers)
 	cd $(srcdir) \
-	&& LC_COLLATE=C $(GNOME_MAKETYPES) gnome.defs macros > gtb.tmp \
-	&& mv gtb.tmp gnometypebuiltins.h
-
-# generate type identifier variables (GTK_TYPE_WIDGET_FLAGS)
-gnometypebuiltins_vars.c: gnome.defs $(GNOME_MAKETYPES)
+	&& glib-mkenums \
+			--comments ";; @comment@" \
+			--fprod "; enumerations from \"@filename \"\n " \
+			--vhead "(define- type@ @EnumName@" \
+			--vprod "   (@valuenick@ @VALUENAME@)" \
+			--vtail ")" \
+		$(gnome_headers) > xgen-gdef \
+	&& cat libgnomeui-boxed.defs >> xgen-gdef \
+	&& (cmp -s xgen-gdef libgnomeui.defs || cp xgen-gdef libgnomeui.defs) \
+	&& rm -f xgen-gdef \
+	&& echo timestamp > $(@F)
+
+$(srcdir)/gnometypebuiltins.c: @REBUILD@ Makefile.am $(gnome_headers)
 	cd $(srcdir) \
-	&& LC_COLLATE=C $(GNOME_MAKETYPES) gnome.defs variables > gtbv.tmp \
-	&& mv gtbv.tmp gnometypebuiltins_vars.c
-
-# generate type entries for type-id registration
-gnometypebuiltins_ids.c: gnome.defs $(GNOME_MAKETYPES)
+	&& glib-mkenums \
+			--fhead "#include <gobject/genums.h>\n" \
+			--fhead "#include \"libgnomeui.h\"\n\n" \
+			--fhead "#include \"gnometypebuiltins.h\"\n\n" \
+			--fprod "\n/* enumerations from \"@filename \" */" \
+			--vhead "static const G Type@Value _ enum_name@_values[] = {" \
+			--vprod "  { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+			--vtail "  { 0, NULL, NULL }\n};\n\n" \
+			--vtail "GType\n enum_name@_get_type (void)\n{\n" \
+			--vtail "  static GType type = 0;\n\n" \
+			--vtail "  if (!type)\n" \
+			--vtail "    type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
+			--vtail "  return type;\n}\n\n" \
+		$(gnome_headers) > xgen-gtbec \
+	&& cp xgen-gtbec $(@F) \
+	&& rm -f xgen-gtbec
+
+$(srcdir)/gnometypebuiltins.h: @REBUILD@ Makefile.am $(gnome_headers)
 	cd $(srcdir) \
-	&& LC_COLLATE=C $(GNOME_MAKETYPES) gnome.defs entries > gtbi.tmp \
-	&& mv gtbi.tmp gnometypebuiltins_ids.c
-
-# generate enum value arrays
-gnometypebuiltins_evals.c: $(GNOME_MAKEENUMS) gnome.defs
+	&& glib-mkenums \
+			--fhead "#ifndef __GNOMETYPEBUILTINS_H__\n" \
+			--fhead "#define __GNOMETYPEBUILTINS_H__ 1\n\n" \
+			--fhead "#include <gobject/genums.h>\n\n" \
+			--fhead "G_BEGIN_DECLS\n\n" \
+			--ftail "G_END_DECLS\n\n" \
+			--ftail "#endif /* __GNOMETYPEBUILTINS_H__ */\n" \
+			--fprod "\n/* --- @filename@ --- */" \
+			--eprod "#define GNOME_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
+			--eprod "GType @enum_name _get_type (void);\n" \
+		$(gnome_headers) > xgen-gth \
+	&& cp xgen-gth $(@F) \
+	&& rm -f xgen-gth
+
+$(srcdir)/gnometype_inits.c: @REBUILD@ Makefile.am $(gnome_headers)
 	cd $(srcdir) \
-	&& $(GNOME_MAKEENUMS) arrays $(gnome_headers) > gtbe.tmp \
-	&& mv gtbe.tmp gnometypebuiltins_evals.c
+	&& glib-mkenums \
+			--fprod "\n/* enumerations from \"@filename \" */" \
+			--vtail "    (void) @enum_name _get_type ();\n" \
+		$(gnome_headers) > xgen-gtic \
+	&& cp xgen-gtic $(@F) \
+	&& rm -f xgen-gtic
 
 #######################
 
@@ -191,9 +219,6 @@ EXTRA_DIST =					\
 	AUTHORS					\
 	gnome.defs 				\
 	gnome-boxed.defs			\
-	gnometypebuiltins_vars.c		\
-	gnometypebuiltins_ids.c			\
-	gnometypebuiltins_evals.c		\
 	portrait.xpm				\
 	landscape.xpm				\
 	libgnomeui-2.0.pc.in
diff --git a/libgnomeui/gnometypes.c b/libgnomeui/gnometypes.c
index 5e06820..2cceff3 100644
--- a/libgnomeui/gnometypes.c
+++ b/libgnomeui/gnometypes.c
@@ -2,46 +2,15 @@
 #include <gtk/gtktypeutils.h>
 #include <libgnomeui.h>
 
-#include "gnometypebuiltins_vars.c"
-#include "gnometypebuiltins_evals.c"
-void gnome_type_init(void);
+void gnome_type_init (void);
 
-void
-gnome_type_init(void) {
-  static gboolean initialized = FALSE;
+void gnome_type_init (void) {
+	static gboolean initialized = FALSE;
 
-  if (!initialized) {
-    int i;
+	if (initialized)
+		return;
 
-    static struct {
-      gchar           *type_name;
-      GtkType         *type_id;
-      GtkType          parent;
-      gconstpointer    pointer1;
-      gconstpointer    pointer2;
-      gconstpointer    pointer3;
-      gboolean         boolean1;
-    } builtin_info[GNOME_TYPE_NUM_BUILTINS + 1] = {
-#include "gnometypebuiltins_ids.c"
-      { NULL }
-    };
+#include "gnometype_inits.c"
 
-    initialized = TRUE;
-
-    for (i = 0; i < GNOME_TYPE_NUM_BUILTINS; i++)
-      {
-	GtkType type_id = GTK_TYPE_INVALID;
-	g_assert (builtin_info[i].type_name != NULL);
-	if ( builtin_info[i].parent == GTK_TYPE_ENUM )
-	  type_id = g_enum_register_static (builtin_info[i].type_name, (GtkEnumValue *)builtin_info[i].pointer1);
-	else if ( builtin_info[i].parent == GTK_TYPE_FLAGS )
-	  type_id = g_flags_register_static (builtin_info[i].type_name, (GtkFlagValue *)builtin_info[i].pointer1);
-	else if ( builtin_info[i].parent == GTK_TYPE_BOXED )
-	  type_id = g_boxed_type_register_static (builtin_info[i].type_name, (GBoxedInitFunc)builtin_info[i].pointer1, (GBoxedCopyFunc)builtin_info[i].pointer2, (GBoxedFreeFunc)builtin_info[i].pointer3, builtin_info[1].boolean1);
-
-	g_assert (type_id != GTK_TYPE_INVALID);
-	(*builtin_info[i].type_id) = type_id;
-      }
-  }
+	initialized = TRUE;
 }
-



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