code generator in makefiles

Havoc Pennington hp at redhat.com
Sat Feb 19 14:06:50 PST 2005


On Sat, 2005-02-19 at 16:13 -0500, Colin Walters wrote:
> 
> I had a quicky try at this, but I don't think it's really worth it in
> the end.  The problem is that you still need to use the BUILT_SOURCES
> variable to tell Automake what files you're generating, and worse you
> still need individual targets specified in the Makefile.am in general I
> think.  So you just don't save much.  Unless I did something wrong here.

I can understand BUILT_SOURCES and targets, the stampfile and
intermediate file fiasco is what I can't figure out:
        
        #
        # gdk-pixbuf-marshal.h
        #
        gdk-pixbuf-marshal.h: @REBUILD@ stamp-gdk-pixbuf-marshal.h
        	@true
        
        stamp-gdk-pixbuf-marshal.h: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list
        	$(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --header >> xgen-gmh \
        	&& (cmp -s xgen-gmh gdk-pixbuf-marshal.h || cp xgen-gmh gdk-pixbuf-marshal.h) \
        	&& rm -f xgen-gmh xgen-gmh~ \
        	&& echo timestamp > $(@F)
        
        CLEANFILES += xgen-gmh
        MAINTAINERCLEANFILES += stamp-gdk-pixbuf-marshal.h
        
        #
        # gdk-pixbuf-marshal.c
        #
        $(srcdir)/gdk-pixbuf-marshal.c: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list
        	(echo -e "#include \"gdk-pixbuf-alias.h\"" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \
        	&& cp xgen-gmc gdk-pixbuf-marshal.c \
        	&& rm -f xgen-gmc xgen-gmc~
        
        CLEANFILES += xgen-gmc
        
        # if srcdir!=builddir, clean out maintainer-clean files from builddir
        # this allows dist to pass.
        distclean-local:
        	if test $(srcdir) != .; then \
        	  rm -f $(MAINTAINERCLEANFILES); \
        	fi
        

Personally I don't understand all that...

> Personally I never had a problem really copying and pasting the automake
> goo.

Are you really getting the working automake goo like above or are you
doing something simpler but broken?

> >Related topic, we need a way to get at dbus-binding-tool as a pkgconfig
> >variable as for glib-genmarshal
> 
> Ok, I tried this, I have a feeling I must be missing something though:
> 
> walters at nexus> PKG_CONFIG_PATH=/scratch/build/dbus/lib/pkgconfig pkg-config --variable=dbus_binding_tool dbus-1
> dbus-binding-tool
> walters at nexus> dbus-binding-tool 
> zsh: command not found: dbus-binding-tool
> walters at nexus> 
> 
> But it looks like glib does the same thing in their .pc.in with
> glib-genmarshal, so maybe it's required for you to set $PATH as well (in
> which case I wonder what the value is in this whole variable thing?)

That is surprising you're right; I guess we did it for cross compilation
or something. I thought it was to get the path.

Havoc




More information about the dbus mailing list