10Sstevel@tonic-gate# 2*12388SJohn.Sonnenschein@Sun.COM# Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 30Sstevel@tonic-gate# 4*12388SJohn.Sonnenschein@Sun.COM 50Sstevel@tonic-gate# 60Sstevel@tonic-gate# Makefile.PL for ::Exacct::Object 70Sstevel@tonic-gate# 80Sstevel@tonic-gate 90Sstevel@tonic-gate# See ../Makefile.PL for an explanation of the linker flag manipulations. 100Sstevel@tonic-gate 118287SJohn.Sonnenschein@Sun.COMrequire 5.8.4; 120Sstevel@tonic-gateuse strict; 130Sstevel@tonic-gateuse warnings; 140Sstevel@tonic-gateuse ExtUtils::MakeMaker; 150Sstevel@tonic-gate 160Sstevel@tonic-gate# 170Sstevel@tonic-gate# Some later versions of ExtUtils::MakeMaker are broken, 180Sstevel@tonic-gate# and complain about function redefinitions in the child Makefile.PLs. 190Sstevel@tonic-gate# Stop the warnings. 200Sstevel@tonic-gate# 210Sstevel@tonic-gateno warnings qw(redefine); 220Sstevel@tonic-gate 230Sstevel@tonic-gateour (@defines, @man3pods); 240Sstevel@tonic-gate 250Sstevel@tonic-gate# 260Sstevel@tonic-gate# MakeMaker overrides. 270Sstevel@tonic-gate# 280Sstevel@tonic-gatepackage MY; 290Sstevel@tonic-gateno warnings qw(once); 300Sstevel@tonic-gate 310Sstevel@tonic-gate# 320Sstevel@tonic-gate# Overrides that are common to both the ON and non-ON build environments. 330Sstevel@tonic-gate# 340Sstevel@tonic-gate 350Sstevel@tonic-gate# 360Sstevel@tonic-gate# Suppress the setting of LD_RUN_PATH, as it isn't necessary. 370Sstevel@tonic-gate# 380Sstevel@tonic-gate 390Sstevel@tonic-gatesub const_loadlibs 400Sstevel@tonic-gate{ 410Sstevel@tonic-gate my $self = shift(@_); 420Sstevel@tonic-gate delete($self->{LD_RUN_PATH}); 430Sstevel@tonic-gate return($self->SUPER::const_loadlibs(@_)); 440Sstevel@tonic-gate} 450Sstevel@tonic-gate 460Sstevel@tonic-gatesub dynamic_lib 470Sstevel@tonic-gate{ 480Sstevel@tonic-gate my $self = shift(@_); 490Sstevel@tonic-gate my $txt = $self->SUPER::dynamic_lib(@_); 500Sstevel@tonic-gate $txt =~ s/LD_RUN_PATH=\S*\s*//; 510Sstevel@tonic-gate return($txt); 520Sstevel@tonic-gate} 530Sstevel@tonic-gate 540Sstevel@tonic-gate# 550Sstevel@tonic-gate# ON-specific overrides. 560Sstevel@tonic-gate# 570Sstevel@tonic-gateif (exists($ENV{CODEMGR_WS}) && exists($ENV{ENVCPPFLAGS1})) { 580Sstevel@tonic-gate # 590Sstevel@tonic-gate # Override postamble and replace it with one that explicitly records 600Sstevel@tonic-gate # the dependency between Object.c (generated from Object.xs by xsubpp) 610Sstevel@tonic-gate # and the ObjectDefs.xi file (generated from sys/exacct.h by 620Sstevel@tonic-gate # extract_defines). Note we have to mimic the -I processing done by cc 630Sstevel@tonic-gate # to find the correct version of the file, as we want the copy from the 640Sstevel@tonic-gate # proto area rather than /usr/include. This ensures that the constant 650Sstevel@tonic-gate # values exported by the perl module stay up-to date with the 660Sstevel@tonic-gate # corresponding #defines. 670Sstevel@tonic-gate # 680Sstevel@tonic-gate *postamble = sub { 690Sstevel@tonic-gate return <<'EOF'; 700Sstevel@tonic-gateEXACCT_H:sh= \ 710Sstevel@tonic-gate for dir in $ENVCPPFLAGS1 $ENVCPPFLAGS2 $ENVCPPFLAGS3 $ENVCPPFLAGS4 \ 720Sstevel@tonic-gate /usr/include; do \ 730Sstevel@tonic-gate dir=`expr $dir : '^-I\(.*\)$' \| $dir`; \ 740Sstevel@tonic-gate file="$dir/sys/exacct.h"; \ 750Sstevel@tonic-gate test -f $file && echo $file && break; \ 760Sstevel@tonic-gate done; 770Sstevel@tonic-gate 780Sstevel@tonic-gateObject.c: ObjectDefs.xi 790Sstevel@tonic-gate 800Sstevel@tonic-gateObjectDefs.xi: ../extract_defines $(EXACCT_H) 810Sstevel@tonic-gate $(PERL) ../extract_defines Object $@ $(EXACCT_H) 820Sstevel@tonic-gateEOF 830Sstevel@tonic-gate }; 840Sstevel@tonic-gate 850Sstevel@tonic-gate # Enable/disable debugging as required. 860Sstevel@tonic-gate @main::defines = ( DEFINE => '-DEXACCT_DEBUG' ) 870Sstevel@tonic-gate if (! exists($ENV{RELEASE_BUILD})); 880Sstevel@tonic-gate 890Sstevel@tonic-gate # Don't install POD pages for ON. 900Sstevel@tonic-gate @main::man3pods = ( MAN3PODS => {} ); 910Sstevel@tonic-gate 920Sstevel@tonic-gate# 930Sstevel@tonic-gate# Non-ON overrides. 940Sstevel@tonic-gate# 950Sstevel@tonic-gate} else { 960Sstevel@tonic-gate # 970Sstevel@tonic-gate # Override postamble and replace it with one that explicitly records 980Sstevel@tonic-gate # the dependency between Object.c (generated from Object.xs by xsubpp) 990Sstevel@tonic-gate # and the ObjectDefs.xi file (generated from /usr/include/sys/exacct.h 1000Sstevel@tonic-gate # by # extract_defines). This ensures # that the constant values 1010Sstevel@tonic-gate # exported by the perl module stay up-to date with the corresponding 1020Sstevel@tonic-gate # #defines. 1030Sstevel@tonic-gate # 1040Sstevel@tonic-gate *postamble = sub { 1050Sstevel@tonic-gate return <<'EOF'; 1060Sstevel@tonic-gateEXACCT_H = /usr/include/sys/exacct.h 1070Sstevel@tonic-gate 1080Sstevel@tonic-gateObject.c: ObjectDefs.xi 1090Sstevel@tonic-gate 1100Sstevel@tonic-gateObjectDefs.xi: ../extract_defines $(EXACCT_H) 1110Sstevel@tonic-gate $(PERL) ../extract_defines Object $@ $(EXACCT_H) 1120Sstevel@tonic-gateEOF 1130Sstevel@tonic-gate }; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate # Install the POD documentation for non-ON builds. 1160Sstevel@tonic-gate my $man3pfx = '$(INST_MAN3DIR)/Sun::Solaris::Exacct'; 1170Sstevel@tonic-gate @main::man3pods = ( MAN3PODS => { 1180Sstevel@tonic-gate '../pod/Object.pod' => $man3pfx . '::Object.$(MAN3EXT)', 1190Sstevel@tonic-gate '../pod/Item.pod' => $man3pfx . '::Object::Item.$(MAN3EXT)', 1200Sstevel@tonic-gate '../pod/Group.pod' => $man3pfx . '::Object::Group.$(MAN3EXT)' 1210Sstevel@tonic-gate }); 1220Sstevel@tonic-gate} 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate# 1250Sstevel@tonic-gate# Having set everything up, write the Makefile. 1260Sstevel@tonic-gate# 1270Sstevel@tonic-gatepackage main; 1280Sstevel@tonic-gate 1290Sstevel@tonic-gateWriteMakefile( 1300Sstevel@tonic-gate NAME => 'Sun::Solaris::Exacct::Object', 1310Sstevel@tonic-gate VERSION_FROM => 'Object.pm', 1320Sstevel@tonic-gate H => [ '../exacct_common.xh' ], 1330Sstevel@tonic-gate TYPEMAPS => [ '../typemap' ], 1340Sstevel@tonic-gate @defines, 1350Sstevel@tonic-gate @man3pods, 1360Sstevel@tonic-gate dynamic_lib => { OTHERLDFLAGS => 1370Sstevel@tonic-gate '-h $(DLBASE).$(DLEXT) ' . 1380Sstevel@tonic-gate '-R\$$ORIGIN/.. $(INST_ARCHAUTODIR)/../Exacct.so' 1390Sstevel@tonic-gate }, 1400Sstevel@tonic-gate realclean => { FILES => 'ObjectDefs.xi' }, 1410Sstevel@tonic-gate); 142