1 # 2 # Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. 3 # 4 5 # 6 # Makefile.PL for ::Exacct::Catalog 7 # 8 9 # See ../Makefile.PL for an explanation of the linker flag manipulations. 10 11 require 5.8.4; 12 use strict; 13 use warnings; 14 use ExtUtils::MakeMaker; 15 16 # 17 # Some later versions of ExtUtils::MakeMaker are broken, 18 # and complain about function redefinitions in the child Makefile.PLs. 19 # Stop the warnings. 20 # 21 no warnings qw(redefine); 22 23 our (@defines, @man3pods); 24 25 # 26 # MakeMaker overrides. 27 # 28 package MY; 29 no warnings qw(once); 30 31 # 32 # Overrides that are common to both the ON and non-ON build environments. 33 # 34 35 # 36 # Suppress the setting of LD_RUN_PATH, as it isn't necessary. 37 # 38 39 sub const_loadlibs 40 { 41 my $self = shift(@_); 42 delete($self->{LD_RUN_PATH}); 43 return($self->SUPER::const_loadlibs(@_)); 44 } 45 46 sub dynamic_lib 47 { 48 my $self = shift(@_); 49 my $txt = $self->SUPER::dynamic_lib(@_); 50 $txt =~ s/LD_RUN_PATH=\S*\s*//; 51 return($txt); 52 } 53 54 # 55 # ON-specific overrides. 56 # 57 if (exists($ENV{CODEMGR_WS}) && exists($ENV{ENVCPPFLAGS1})) { 58 # 59 # Override postamble and replace it with one that explicitly records 60 # the dependency between Catalog.c (generated from Catalog.xs by xsubpp) 61 # and the ObjectDefs.xi file (generated from sys/exacct_catalog.h by 62 # extract_defines). Note we have to mimic the -I processing done by cc 63 # to find the correct version of the file, as we want the copy from the 64 # proto area rather than /usr/include. This ensures that the constant 65 # values exported by the perl module stay up-to date with the 66 # corresponding #defines. 67 # 68 *postamble = sub { 69 return <<'EOF'; 70 EXACCT_H:sh= \ 71 for dir in $ENVCPPFLAGS1 $ENVCPPFLAGS2 $ENVCPPFLAGS3 $ENVCPPFLAGS4 \ 72 /usr/include; do \ 73 dir=`expr $dir : '^-I\(.*\)$' \| $dir`; \ 74 file="$dir/sys/exacct_catalog.h"; \ 75 test -f $file && echo $file && break; \ 76 done; 77 78 Catalog.c: CatalogDefs.xi 79 80 CatalogDefs.xi: ../extract_defines $(EXACCT_H) 81 $(PERL) ../extract_defines Catalog $@ $(EXACCT_H) 82 EOF 83 }; 84 85 # Enable/disable debugging as required. 86 @main::defines = ( DEFINE => '-DEXACCT_DEBUG' ) 87 if (! exists($ENV{RELEASE_BUILD})); 88 89 # Don't install POD pages for ON. 90 @main::man3pods = ( MAN3PODS => {} ); 91 92 # 93 # Non-ON overrides. 94 # 95 } else { 96 # 97 # Override postamble and replace it with one that explicitly records 98 # the dependency between Catalog.c (generated from Catalog.xs by xsubpp) 99 # and the ObjectDefs.xi file (generated from 100 # /usr/include/sys/exacct_catalog.h by extract_defines). This ensures 101 # that the constant values exported by the perl module stay up-to date 102 # with the corresponding #defines. 103 # 104 *postamble = sub { 105 return <<'EOF'; 106 EXACCT_H = /usr/include/sys/exacct_catalog.h 107 108 Catalog.c: CatalogDefs.xi 109 110 CatalogDefs.xi: ../extract_defines $(EXACCT_H) 111 $(PERL) ../extract_defines Catalog $@ $(EXACCT_H) 112 EOF 113 }; 114 115 # Install the POD documentation for non-ON builds. 116 my $man3pfx = '$(INST_MAN3DIR)/Sun::Solaris::Exacct'; 117 @main::man3pods = ( 118 MAN3PODS => { '../pod/Catalog.pod' => 119 $man3pfx . '::Catalog.$(MAN3EXT)' } 120 ); 121 } 122 123 # 124 # Having set everything up, write the Makefile. 125 # 126 package main; 127 128 WriteMakefile( 129 NAME => 'Sun::Solaris::Exacct::Catalog', 130 VERSION_FROM => 'Catalog.pm', 131 H => [ '../exacct_common.xh' ], 132 TYPEMAPS => [ '../typemap' ], 133 @defines, 134 @man3pods, 135 dynamic_lib => { OTHERLDFLAGS => 136 '-h $(DLBASE).$(DLEXT) ' . 137 '-R\$$ORIGIN/.. $(INST_ARCHAUTODIR)/../Exacct.so' 138 }, 139 realclean => { FILES => 'CatalogDefs.xi' }, 140 );