GNOME Bugzilla – Bug 653199
Fix various srcdir!=builddir issues
Last modified: 2011-06-23 16:46:54 UTC
jhbuild will default to srcdir != builddir in the future for various reasons. The main tricky part is explicitly separating sources in the builddir from those in the srcdir when calling g-ir-scanner. The enum generation rules were just broken and both did cd $(srcdir) and $(addprefix $(srcdir)).
Created attachment 190481 [details] [review] Fix various srcdir!=builddir issues
Comment on attachment 190481 [details] [review] Fix various srcdir!=builddir issues >+stamp-st-enum-types.h: $(source_h) $(srcdir)/st/st-enum-types.h.in $(st_source_h) you don't need to say $(srcdir) in dependencies. make automatically looks in both $(srcdir) and $(builddir) >+st-enum-types.c: stamp-st-enum-types.h $(srcdir)/st/st-enum-types.c.in (likewise) >-libgnome_shell_la_gir_sources = \ >- $(filter-out %-private.h $(shell_recorder_non_gir_sources), $(shell_public_headers_h) $(libgnome_shell_la_SOURCES)) >+libgnome_shell_la_srcdir_gir_sources = \ >+ $(addprefix $(srcdir)/,$(filter-out $(shell_built_sources) %-private.h $(shell_recorder_non_gir_sources), $(shell_public_headers_h) $(libgnome_shell_la_SOURCES))) >+libgnome_shell_la_builddir_gir_sources = $(addprefix $(builddir)/, shell-enum-types.c shell-enum-types.h) >+libgnome_shell_la_gir_sources = $(libgnome_shell_la_srcdir_gir_sources) $(libgnome_shell_la_builddir_gir_sources) You don't need this... >-Shell_0_1_gir_FILES = $(addprefix $(srcdir)/,$(libgnome_shell_la_gir_sources)) >+Shell_0_1_gir_FILES = $(libgnome_shell_la_gir_sources) You only need this. The Makefile.introspection rule puts $(Shell_0_1_gir_FILES) as the dependency of the rule, and then uses $^ inside the rule, which expands to "all of the dependencies, prefixed with $(srcdir) if necessary".
Created attachment 190511 [details] [review] Fix various srcdir!=builddir issues jhbuild will default to srcdir != builddir in the future for various reasons. The enum generation rules were just broken and both did cd $(srcdir) and $(addprefix $(srcdir)). Also, remove an unnecessary $(addprefix) from the GIR sources; thanks to Dan Winship for pointing out that make will look in both srcdir and builddir, so it's not necessary to add a prefix explicitly. Doing so breaks obviously when adding the sourcedir to a builddir file.
(In reply to comment #2) > (From update of attachment 190481 [details] [review]) > >+stamp-st-enum-types.h: $(source_h) $(srcdir)/st/st-enum-types.h.in $(st_source_h) > > you don't need to say $(srcdir) in dependencies. make automatically looks in > both $(srcdir) and $(builddir) Don't have to, I guess, but why not be explicit? > >-Shell_0_1_gir_FILES = $(addprefix $(srcdir)/,$(libgnome_shell_la_gir_sources)) > >+Shell_0_1_gir_FILES = $(libgnome_shell_la_gir_sources) > > You only need this. The Makefile.introspection rule puts $(Shell_0_1_gir_FILES) > as the dependency of the rule, and then uses $^ inside the rule, which expands > to "all of the dependencies, prefixed with $(srcdir) if necessary". It doesn't use $^, it uses $$^ ; these are different things apparently. Could it use $^? Um...okay, nevermind indeed, your suggestion works. Thanks, I learned something about make. Though it feels pretty magical to me; I like being explicit.
(In reply to comment #4) > It doesn't use $^, it uses $$^ The "introspection-scanner" proto-rule in the Makefile gets run through one level of variable substitution to get turned into a real rule, but we want the "$^" to be expanded when the rule is being applied, not when the proto-rule is being expanded, so it needs an extra "$" before it. (You can use "make -qp" to see what the Makefile looks like after all the real rules are generated.)
Comment on attachment 190511 [details] [review] Fix various srcdir!=builddir issues i'm assuming you already tested this with and without srcdir!=builddir
Attachment 190511 [details] pushed as 1fc1282 - Fix various srcdir!=builddir issues