1use 5.008; 2use ExtUtils::MakeMaker; 3use ExtUtils::Constant 0.11 'WriteConstants'; 4use Config; 5 6my $dtrace_o = $Config{dtraceobject} ? ' dtrace$(OBJ_EXT)' : ''; 7 8WriteMakefile( 9 'NAME' => 'XS::APItest', 10 'VERSION_FROM' => 'APItest.pm', # finds $VERSION 11 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 12 ABSTRACT_FROM => 'APItest.pm', # retrieve abstract from module 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>', 14 'C' => ['exception.c', 'core.c', 'notcore.c'], 15 'OBJECT' => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)'. $dtrace_o, 16 realclean => {FILES => 'const-c.inc const-xs.inc'}, 17 ($Config{gccversion} && $Config{d_attribute_deprecated} ? 18 (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()), 19 depend => { 'core.o' => 'core_or_not.inc', 20 'notcore.o' => 'core_or_not.inc' }, 21); 22 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 G_RETHROW 27 GV_NOADD_NOINIT 28 IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX 29 IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY 30 IS_NUMBER_NAN IS_NUMBER_TRAILING PERL_SCAN_TRAILING 31 PERL_LOADMOD_DENY PERL_LOADMOD_NOIMPORT PERL_LOADMOD_IMPORT_OPS 32 ), 33 {name=>"G_WANT", default=>["IV", "G_ARRAY|G_VOID"]}); 34 35open my $fh, '<', '../../overload.h' or die "Can't open ../../overload.h: $!"; 36while (<$fh>) { 37 push @names, {name => $1, macro => 1} if /^\s+([A-Za-z_0-9]+_amg),/; 38} 39 40WriteConstants( 41 PROXYSUBS => 1, 42 NAME => 'XS::APItest', 43 NAMES => \@names, 44 ); 45 46sub MY::install { "install ::\n" }; 47 48 49sub MY::postamble 50{ 51 package MY; 52 my $post = shift->SUPER::postamble(@_); 53 use Config; 54 return $post unless $Config{dtraceobject}; 55 56 # core.o is build using PERL_CORE, so picks up any dtrace probes 57 58 $post .= <<POSTAMBLE; 59 60DTRACE_D = ../../perldtrace.d 61 62dtrace\$(OBJ_EXT): \$(DTRACE_D) core\$(OBJ_EXT) 63 $Config{dtrace} -G -s \$(DTRACE_D) -o dtrace\$(OBJ_EXT) core\$(OBJ_EXT) || \\ 64 ( \$(ECHO) >dtrace.c && \$(CCCMD) \$(CCCDLFLAGS) dtrace.c && rm -f dtrace.c ) 65POSTAMBLE 66 67 return $post; 68} 69