summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile.SH48
-rw-r--r--ext/XS-APItest/Makefile.PL25
2 files changed, 54 insertions, 19 deletions
diff --git a/Makefile.SH b/Makefile.SH
index 94cb85309a..8282452255 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -230,15 +230,20 @@ for f in $nonxs_ext; do
done
dtrace_h=''
-dtrace_o=''
-minidtrace_o=''
+
+# three object files generated by 'dtrace -G' when dtrace is enabled
+dtrace_perllib_o=''
+dtrace_mini_o=''
+dtrace_main_o=''
+
case "$usedtrace" in
define|true)
dtrace_h='perldtrace.h'
case "$dtraceobject" in
define)
- dtrace_o='perldtrace$(OBJ_EXT)'
- minidtrace_o='miniperldtrace$(OBJ_EXT)'
+ dtrace_perllib_o='dtrace_perllib$(OBJ_EXT)'
+ dtrace_mini_o='dtrace_mini$(OBJ_EXT)'
+ dtrace_main_o='dtrace_main$(OBJ_EXT)'
;;
esac
;;
@@ -388,8 +393,10 @@ esac
$spitshell >>$Makefile <<!GROK!THIS!
DTRACE = $dtrace
DTRACE_H = $dtrace_h
-DTRACE_O = $dtrace_o
-MINIDTRACE_O = $minidtrace_o
+
+DTRACE_PERLLIB_O = $dtrace_perllib_o # "dtrace -G" output for perllib_objs
+DTRACE_MINI_O = $dtrace_mini_o # "dtrace -G" output for common and mini
+DTRACE_MAIN_O = $dtrace_main_o # "dtrace -G" output for perlmain.o
FIRSTMAKEFILE = $firstmakefile
@@ -509,9 +516,11 @@ mini_only_objs = opmini$(OBJ_EXT) perlmini$(OBJ_EXT)
main_only_objs = op$(OBJ_EXT) perl$(OBJ_EXT)
miniperl_objs_nodt = $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
+perllib_objs_nodt = $(main_only_objs) $(common_objs)
-miniperl_objs = $(miniperl_objs_nodt) $(MINIDTRACE_O)
-perllib_objs = $(main_only_objs) $(common_objs) $(DTRACE_O)
+miniperl_objs = $(miniperl_objs_nodt) $(DTRACE_MINI_O)
+perllib_objs = $(perllib_objs_nodt) $(DTRACE_PERLLIB_O)
+perlmain_objs = perlmain$(OBJ_EXT) $(DTRACE_MAIN_O)
perltoc_pod_prereqs = extra.pods pod/perl5239delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod pod/perluniprops.pod
generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs)
@@ -847,14 +856,17 @@ mydtrace.h: $(DTRACE_H)
!NO!SUBS!
;;
esac
- case "$dtrace_o" in
- ?*)
+ case "$dtraceobject" in
+ define)
$spitshell >>$Makefile <<'!NO!SUBS!'
-$(DTRACE_O): perldtrace.d $(main_only_objs) $(common_objs)
- $(DTRACE) -G -s perldtrace.d -o $(DTRACE_O) $(main_only_objs) $(common_objs)
+$(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
+ $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MINI_O) $(miniperl_objs_nodt)
+
+$(DTRACE_PERLLIB_O): perldtrace.d $(perllib_objs_nodt)
+ $(DTRACE) -G -s perldtrace.d -o $(DTRACE_PERLLIB_O) $(perllib_objs_nodt)
-$(MINIDTRACE_O): perldtrace.d $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
- $(DTRACE) -G -s perldtrace.d -o $(MINIDTRACE_O) $(mini_only_objs) $(common_objs) miniperlmain$(OBJ_EXT)
+$(DTRACE_MAIN_O): perldtrace.d perlmain$(OBJ_EXT)
+ $(DTRACE) -G -s perldtrace.d -o $(DTRACE_MAIN_O) perlmain$(OBJ_EXT)
!NO!SUBS!
;;
@@ -983,7 +995,7 @@ lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
$spitshell >>$Makefile <<'!NO!SUBS!'
-$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
+$(PERL_EXE): $& $(perlmain_objs) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
-@rm -f miniperl.xok
!NO!SUBS!
@@ -991,15 +1003,15 @@ $(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPOR
# In AmigaOS the Perl executable needs to be linked with -ldl,
# but none of the other executables should be.
amigaos) $spitshell >>$Makefile <<'!NO!SUBS!'
- $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) -ldl
+ $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs) -ldl
!NO!SUBS!
;;
os390) $spitshell >>$Makefile <<'!NO!SUBS!'
- $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
+ $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
!NO!SUBS!
;;
*) $spitshell >>$Makefile <<'!NO!SUBS!'
- $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
+ $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs)
!NO!SUBS!
;;
esac
diff --git a/ext/XS-APItest/Makefile.PL b/ext/XS-APItest/Makefile.PL
index 173e5c97c5..5b4d100659 100644
--- a/ext/XS-APItest/Makefile.PL
+++ b/ext/XS-APItest/Makefile.PL
@@ -3,6 +3,8 @@ use ExtUtils::MakeMaker;
use ExtUtils::Constant 0.11 'WriteConstants';
use Config;
+my $dtrace_o = $Config{dtraceobject} ? ' dtrace$(OBJ_EXT)' : '';
+
WriteMakefile(
'NAME' => 'XS::APItest',
'VERSION_FROM' => 'APItest.pm', # finds $VERSION
@@ -10,7 +12,7 @@ WriteMakefile(
ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module
AUTHOR => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
'C' => ['exception.c', 'core.c', 'notcore.c'],
- 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
+ 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)'. $dtrace_o,
realclean => {FILES => 'const-c.inc const-xs.inc'},
($Config{gccversion} && $Config{d_attribute_deprecated} ?
(CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
@@ -40,3 +42,24 @@ WriteConstants(
);
sub MY::install { "install ::\n" };
+
+
+sub MY::postamble
+{
+ package MY;
+ my $post = shift->SUPER::postamble(@_);
+ use Config;
+ return $post unless $Config{dtraceobject};
+
+ # core.o is build using PERL_CORE, so picks up any dtrace probes
+
+ $post .= <<POSTAMBLE;
+
+DTRACE_D = ../../perldtrace.d
+
+dtrace\$(OBJ_EXT): \$(DTRACE_D) core\$(OBJ_EXT)
+ $Config{dtrace} -G -s \$(DTRACE_D) -o dtrace\$(OBJ_EXT) core\$(OBJ_EXT)
+POSTAMBLE
+
+ return $post;
+}