This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #130108) generate a dummy dtrace_main.o if perlmain.o doesn't contain probes
[perl5.git] / ext / XS-APItest / Makefile.PL
CommitLineData
3e61d65a
JH
1use 5.008;
2use ExtUtils::MakeMaker;
55289a74 3use ExtUtils::Constant 0.11 'WriteConstants';
95ddc675 4use Config;
42ef68d0 5
efc4bddf
DM
6my $dtrace_o = $Config{dtraceobject} ? ' dtrace$(OBJ_EXT)' : '';
7
3e61d65a
JH
8WriteMakefile(
9 'NAME' => 'XS::APItest',
10 'VERSION_FROM' => 'APItest.pm', # finds $VERSION
11 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
8c5ae9a3 12 ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module
83f8bb56 13 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>',
34482cd6 14 'C' => ['exception.c', 'core.c', 'notcore.c'],
efc4bddf 15 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)'. $dtrace_o,
55289a74 16 realclean => {FILES => 'const-c.inc const-xs.inc'},
95ddc675 17 ($Config{gccversion} && $Config{d_attribute_deprecated} ?
42ef68d0 18 (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
048a2f47
FC
19 depend => { 'core.o' => 'core_or_not.inc',
20 'notcore.o' => 'core_or_not.inc' },
55289a74
NC
21);
22
7d255dc8
NC
23my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
24 HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
25 G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
26 G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
27 IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
28 IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
e222d7e2 29 IS_NUMBER_NAN IS_NUMBER_TRAILING PERL_SCAN_TRAILING
a52f2cce 30 PERL_LOADMOD_DENY PERL_LOADMOD_NOIMPORT PERL_LOADMOD_IMPORT_OPS
7d255dc8
NC
31 ),
32 {name=>"G_WANT", default=>["IV", "G_ARRAY|G_VOID"]});
33
1ae6ead9 34open my $fh, '<', '../../overload.h' or die "Can't open ../../overload.h: $!";
7d255dc8
NC
35while (<$fh>) {
36 push @names, {name => $1, macro => 1} if /^\s+([A-Za-z_0-9]+_amg),/;
37}
38
55289a74
NC
39WriteConstants(
40 PROXYSUBS => 1,
41 NAME => 'XS::APItest',
7d255dc8 42 NAMES => \@names,
b8d2d791 43 );
3e61d65a
JH
44
45sub MY::install { "install ::\n" };
efc4bddf
DM
46
47
48sub MY::postamble
49{
50 package MY;
51 my $post = shift->SUPER::postamble(@_);
52 use Config;
53 return $post unless $Config{dtraceobject};
54
55 # core.o is build using PERL_CORE, so picks up any dtrace probes
56
57 $post .= <<POSTAMBLE;
58
59DTRACE_D = ../../perldtrace.d
60
61dtrace\$(OBJ_EXT): \$(DTRACE_D) core\$(OBJ_EXT)
47a83dc6
TC
62 $Config{dtrace} -G -s \$(DTRACE_D) -o dtrace\$(OBJ_EXT) core\$(OBJ_EXT) || \\
63 ( \$(ECHO) >dtrace.c && \$(CCCMD) \$(CCCDLFLAGS) dtrace.c && rm -f dtrace.c )
efc4bddf
DM
64POSTAMBLE
65
66 return $post;
67}