[glib] build: simplify dtrace configuration



commit 7563ab473468fecefc388ae2ed06afab8ead6211
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Mar 7 09:35:16 2014 -0500

    build: simplify dtrace configuration
    
    The ability to pass libtool via $(CC) to dtrace and have it respect this
    appears to be a feature that is only present in the systemtap version of
    the tool.  In particular, FreeBSD (which seems to be using a copy of the
    tool from Solaris) doesn't support this.
    
    The result is that, with $(CC) ignored, and a .lo file specified in -o,
    we get an ELF written to the .lo.
    
    Instead of trying to have dtrace run libtool we can have libtool run
    dtrace.  dtrace is really just a compiler that produces an object file
    here, and it even understands -o, so libtool can make the appropriate
    adjustments.
    
    There appears to be some prior art for this approach.  A quick search
    shows that at least QEMU is using this approach.  It also appears to
    work on Linux with systemtap's dtrace and on FreeBSD.
    
    This may regress cross-compilation because the dtrace command will have
    no way of knowing which compiler we intend for it to use to produce the
    object file.  I say "may" because I don't know if dtrace ever worked in
    the first place under cross-compilation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725902

 glib/Makefile.am    |    5 +----
 gobject/Makefile.am |    4 +---
 2 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 766f373..953ea08 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -362,15 +362,12 @@ libglib_2_0_la_LDFLAGS = $(GLIB_LINK_FLAGS) \
 INSTALL_PROGS=
 
 if ENABLE_DTRACE
-DTCOMPILE = $(patsubst -W%,,$(LTCOMPILE))
-DTCFLAGS = $(patsubst -W%,,$(CFLAGS))
-
 glib_probes.h: glib_probes.d
        $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $  tmp
        @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $  tmp > $@ && rm -f $  tmp
 
 glib_probes.lo: glib_probes.d
-       $(AM_V_GEN) env CC="$(DTCOMPILE)" CFLAGS="$(DTCFLAGS)" $(DTRACE) -G -s $< -o $@
+       $(AM_V_GEN) $(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC $(DTRACE) -G -s $< -o $@
 
 BUILT_SOURCES += glib_probes.h glib_probes.lo
 CLEANFILES += glib_probes.h glib_probes.h.tmp
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index a72e39c..ba9dcc8 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -110,15 +110,13 @@ gobject_c_sources = \
        gvaluetypes.c
 
 if ENABLE_DTRACE
-DTCOMPILE = $(patsubst -W%,,$(LTCOMPILE))
-DTCFLAGS = $(patsubst -W%,,$(CFLAGS))
 
 gobject_probes.h: gobject_probes.d
        $(AM_V_GEN) $(DTRACE) -C -h -s $< -o $  tmp
        @$(SED) -e "s,define STAP_HAS_SEMAPHORES 1,undef STAP_HAS_SEMAPHORES," < $  tmp > $@ && rm -f $  tmp
 
 gobject_probes.lo: gobject_probes.d
-       $(AM_V_GEN) env CC="$(DTCOMPILE)" CFLAGS="$(DTCFLAGS)" $(DTRACE) -G -s $< -o $@
+       $(AM_V_GEN) $(LIBTOOL) --mode=compile $(AM_V_lt) --tag=CC $(DTRACE) -G -s $< -o $@
 
 BUILT_SOURCES += gobject_probes.h gobject_probes.lo
 CLEANFILES += gobject_probes.h


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