After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653199 - Fix various srcdir!=builddir issues
Fix various srcdir!=builddir issues
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-06-23 00:12 UTC by Colin Walters
Modified: 2011-06-23 16:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix various srcdir!=builddir issues (4.36 KB, patch)
2011-06-23 00:12 UTC, Colin Walters
needs-work Details | Review
Fix various srcdir!=builddir issues (3.80 KB, patch)
2011-06-23 14:16 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2011-06-23 00:12:15 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)).
Comment 1 Colin Walters 2011-06-23 00:12:19 UTC
Created attachment 190481 [details] [review]
Fix various srcdir!=builddir issues
Comment 2 Dan Winship 2011-06-23 13:27:44 UTC
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".
Comment 3 Colin Walters 2011-06-23 14:16:06 UTC
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.
Comment 4 Colin Walters 2011-06-23 14:44:12 UTC
(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.
Comment 5 Dan Winship 2011-06-23 15:27:16 UTC
(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 6 Dan Winship 2011-06-23 15:27:50 UTC
Comment on attachment 190511 [details] [review]
Fix various srcdir!=builddir issues

i'm assuming you already tested this with and without srcdir!=builddir
Comment 7 Colin Walters 2011-06-23 16:46:49 UTC
Attachment 190511 [details] pushed as 1fc1282 - Fix various srcdir!=builddir issues