1 package ExtUtils::MM_NW5;
5 ExtUtils::MM_NW5 - methods to override UN*X behaviour in ExtUtils::MakeMaker
9 use ExtUtils::MM_NW5; # Done internally by ExtUtils::MakeMaker if needed
13 See ExtUtils::MM_Unix for a documentation of the methods provided
14 there. This package overrides the implementation of these methods, not
26 #use ExtUtils::MakeMaker;
27 #Exporter::import('ExtUtils::MakeMaker',
28 # qw( $Verbose &neatvalue));
30 use vars qw(@ISA $VERSION);
33 require ExtUtils::MM_Win32;
34 @ISA = qw(ExtUtils::MM_Win32);
36 use ExtUtils::MakeMaker qw( &neatvalue );
38 $ENV{EMXSHELL} = 'sh'; # to run `commands`
39 #unshift @MM::ISA, 'ExtUtils::MM_NW5';
41 $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
42 $GCC = 1 if $Config{'cc'} =~ /^gcc/i;
43 $DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
44 $NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
45 $PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
52 $self->SUPER::init_others(@_);
54 # incpath is copied to makefile var INCLUDE in constants sub, here just make it empty
55 my $libpth = $Config{'libpth'};
57 $self->{'LIBPTH'} = $libpth;
58 $self->{'BASE_IMPORT'} = $Config{'base_import'};
60 # Additional import file specified from Makefile.pl
61 if($self->{'base_import'}) {
62 $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'};
65 $self->{'NLM_VERSION'} = $Config{'nlm_version'};
66 $self->{'MPKTOOL'} = $Config{'mpktool'};
67 $self->{'TOOLPATH'} = $Config{'toolpath'};
73 Initializes lots of constants and .SUFFIXES and .PHONY
78 my($self,$libperl)=@_;
79 return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
80 return '' unless $self->needs_linking();
81 return $self->{CONST_CCCMD} =
82 q{CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \\
83 $(PERLTYPE) $(MPOLLUTE) -o $@ \\
84 -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\"};
91 # Added LIBPTH, BASE_IMPORT, ABSTRACT, NLM_VERSION BOOT_SYMBOL, NLM_SHORT_NAME
96 AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
97 VERSION_SYM XS_VERSION INST_BIN INST_LIB
98 INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
99 INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
100 INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
101 PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
102 FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
103 PERL_INC PERL FULLPERL LIBPTH BASE_IMPORT PERLRUN
104 FULLPERLRUN PERLRUNINST FULL_AR PERL_CORE FULLPERLRUNINST
105 NLM_VERSION MPKTOOL TOOLPATH
108 next unless defined $self->{$tmp};
109 push @m, "$tmp = $self->{$tmp}\n";
112 (my $boot = $self->{'NAME'}) =~ s/:/_/g;
113 $self->{'BOOT_SYMBOL'}=$boot;
114 push @m, "BOOT_SYMBOL = $self->{'BOOT_SYMBOL'}\n";
116 # If the final binary name is greater than 8 chars,
117 # truncate it here and rename it after creation
118 # otherwise, Watcom Linker fails
120 if(length($self->{'BASEEXT'}) > 8) {
121 $self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8);
122 push @m, "NLM_SHORT_NAME = $self->{'NLM_SHORT_NAME'}\n";
126 VERSION_MACRO = VERSION
127 DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
128 XS_VERSION_MACRO = XS_VERSION
129 XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
132 # Get the include path and replace the spaces with ;
133 # Copy this to makefile as INCLUDE = d:\...;d:\;
134 (my $inc = $Config{'incpath'}) =~ s/([ ]*)-I/;/g;
137 # Commented by Ananth since the below code was not adding the DBI path
138 # and compilation was failing due to non-availability of the correct path. 3 Jan 2002
140 # Get the additional include path and append to INCLUDE, keep it in
141 # INC will give problems during compilation, hence reset it after getting
143 ## (my $add_inc = $self->{'INC'}) =~ s/ -I/;/g;
146 INCLUDE = $inc;$add_inc;
153 # Set the path to CodeWarrior binaries which might not have been set in
156 PATH = \$(PATH);\$(TOOLPATH)
160 MAKEMAKER = $INC{'ExtUtils/MakeMaker.pm'}
161 MM_VERSION = $ExtUtils::MakeMaker::VERSION
165 # FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
166 # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
167 # PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
168 # DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
172 FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
175 next unless defined $self->{$tmp};
176 push @m, "$tmp = $self->{$tmp}\n";
180 # Handy lists of source code files:
181 XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
182 C_FILES = ".join(" \\\n\t", @{$self->{C}})."
183 O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
184 H_FILES = ".join(" \\\n\t", @{$self->{H}})."
185 MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
186 MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
190 INST_MAN1DIR INSTALLMAN1DIR MAN1EXT
191 INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
193 next unless defined $self->{$tmp};
194 push @m, "$tmp = $self->{$tmp}\n";
202 .NO_CONFIG_REC: Makefile
203 } if $ENV{CLEARCASE_ROOT};
205 # why not q{} ? -- emacs
207 # work around a famous dec-osf make(1) feature(?):
210 .SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
212 # Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
213 # some make implementations will delete the Makefile when we rebuild it. Because
214 # we call false(1) when we rebuild it. So make(1) is not completely wrong when it
215 # does so. Our milage may vary.
216 # .PRECIOUS: Makefile # seems to be not necessary anymore
218 .PHONY: all config static dynamic test linkext manifest
220 # Where is the Config information that we are using/depend on
221 CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h
224 my @parentdir = split(/::/, $self->{PARENT_NAME});
226 # Where to put things:
227 INST_LIBDIR = }. File::Spec->catdir('$(INST_LIB)',@parentdir) .q{
228 INST_ARCHLIBDIR = }. File::Spec->catdir('$(INST_ARCHLIB)',@parentdir) .q{
230 INST_AUTODIR = }. File::Spec->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
231 INST_ARCHAUTODIR = }. File::Spec->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
234 if ($self->has_link_code()) {
236 INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT)
237 INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT)
238 INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs
248 $tmp = $self->export_list;
252 $tmp = $self->perl_archive;
258 #INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
260 #PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
264 TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
266 PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
272 =item dynamic_lib (o)
274 Defines how to produce the *.so (or equivalent) files.
279 my($self, %attribs) = @_;
280 return '' unless $self->needs_linking(); #might be because of a subdir
282 return '' unless $self->has_link_code;
284 my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
285 my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
286 my($ldfrom) = '$(LDFROM)';
288 (my $boot = $self->{NAME}) =~ s/:/_/g;
291 # This section creates the dynamically loadable $(INST_DYNAMIC)
292 # from $(OBJECT) and possibly $(MYEXTLIB).
293 OTHERLDFLAGS = '.$otherldflags.'
294 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
296 $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP)
299 # q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
300 # .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
302 # Create xdc data for an MT safe NLM in case of mpk build
303 # if ( scalar(keys %XS) == 0 ) { return; }
305 q{ @echo Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def
308 q{ @echo $(BASE_IMPORT) >> $(BASEEXT).def
311 q{ @echo Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def
314 if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
316 push @m, ' $(MPKTOOL) $(XDCFLAGS) $(BASEEXT).xdc
318 push @m, ' @echo xdcdata $(BASEEXT).xdc >> $(BASEEXT).def
325 q{ $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) }
329 q{ -desc "Perl 5.7.3 Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION) }
332 # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
333 if($self->{NLM_SHORT_NAME}) {
334 # In case of nlms with names exceeding 8 chars, build nlm in the
335 # current dir, rename and move to auto\lib. If we create in auto\lib
336 # in the first place, we can't rename afterwards.
338 q{ -o $(NLM_SHORT_NAME).$(DLEXT)}
342 q{ -o $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
349 # q{ Option XDCDATA=$(BASEEXT).xdc }
353 # Add additional lib files if any (SDBM_File)
354 if($self->{MYEXTLIB}) {
360 #For now lets comment all the Watcom lib calls
361 #q{ LibPath $(LIBPTH) Library plib3s.lib Library math3s.lib Library clib3s.lib Library emu387.lib Library $(PERL_ARCHIVE) Library $(PERL_INC)\Main.lib}
365 q{ $(PERL_INC)\Main.lib}
366 .q{ -commandfile $(BASEEXT).def }
369 # If it is having a short name, rename it
370 if($self->{NLM_SHORT_NAME}) {
372 if exist $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT) del $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)';
374 rename $(NLM_SHORT_NAME).$(DLEXT) $(BASEEXT).$(DLEXT)';
376 move $(BASEEXT).$(DLEXT) $(INST_AUTODIR)';
383 push @m, $self->dir_target('$(INST_ARCHAUTODIR)');