Skip to content

Commit

Permalink
r4136@windhund: schwern | 2004-12-25 09:25:28 -0500
Browse files Browse the repository at this point in the history
     - .exists files are back.  Directories cannot be used directly as 
       targets as their mod time changes too frequently.


git-svn-id: http://svn.schwern.org/repos/CPAN/ExtUtils-MakeMaker/trunk@2256 8151f2b9-fde8-0310-94fd-f048d12aab9e
  • Loading branch information
schwern committed Dec 25, 2004
1 parent f0a9a2a commit 0f2e87e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 50 deletions.
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
6.25_06
- Forgot to define BOOTDEP macro.
- .exists files are back. Directories cannot be used directly as
targets as their mod time changes too frequently.

6.25_05 Wed Dec 22 07:59:02 EST 2004
- One of the 6.25 alphas broke BSD make. It doesn't like "- @ command".
Expand Down
20 changes: 16 additions & 4 deletions lib/ExtUtils/MM_Any.pm
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,29 @@ CODE
Generates targets to create the specified directories and set its
permission to 0755.
Because depending on a directory to just ensure it exists doesn't work
too well (the modified time changes too often) dir_target() creates a
.exists file in the created directory. It is this you should depend on.
For portability purposes you should use the $(DIRFILESEP) macro rather
than a '/' to seperate the directory from the file.
yourdirectory$(DIRFILESEP).exists
=cut

sub dir_target {
my($self, @dirs) = @_;

my $make = '';
foreach my $dir (@dirs) {
$make .= sprintf <<'MAKE', $dir, $dir, $dir;
%s :
$make .= sprintf <<'MAKE', ($dir) x 7;
%s : %s$(DFSEP).exists
$(NOECHO) $(NOOP)
%s$(DFSEP).exists :
$(NOECHO) $(MKPATH) %s
$(NOECHO) $(CHMOD) 755 %s
$(NOECHO) touch %s$(DFSEP).exists
MAKE

Expand Down Expand Up @@ -897,9 +909,9 @@ meaning to make. For example, .SUFFIXES and .PHONY.

sub special_targets {
my $make_frag = <<'MAKE_FRAG';
.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
.PHONY: all config static dynamic test linkext manifest
.PHONY :: all config static dynamic test linkext manifest
MAKE_FRAG

Expand Down
4 changes: 2 additions & 2 deletions lib/ExtUtils/MM_NW5.pm
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ sub static_lib {
return '' unless $self->has_link_code;

my $m = <<'END';
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END

Expand Down Expand Up @@ -212,7 +212,7 @@ OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
# Create xdc data for an MT safe NLM in case of mpk build
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP)
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def
$(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def
$(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def
Expand Down
47 changes: 12 additions & 35 deletions lib/ExtUtils/MM_Unix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,11 @@ sub constants {
my($self) = @_;
my @m = ();

$self->{DFSEP} = '$(DIRFILESEP)'; # alias for internal use

for my $macro (qw(
AR_STATIC_ARGS DIRFILESEP
AR_STATIC_ARGS DIRFILESEP DFSEP
NAME NAME_SYM
VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION
XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION
Expand Down Expand Up @@ -415,7 +417,7 @@ MM_REVISION = $self->{MM_REVISION}
for my $macro (qw/
MAKE
FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
LDFROM LINKTYPE BOOTDEP
LDFROM LINKTYPE
/ )
{
next unless defined $self->{$macro};
Expand All @@ -435,7 +437,7 @@ MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."

push @m, q{
# Where is the Config information that we are using/depend on
CONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h
CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
};


Expand Down Expand Up @@ -859,15 +861,15 @@ BOOTSTRAP = $(BASEEXT).bs
# As Mkbootstrap might not write a file (if none is required)
# we use touch to prevent make continually trying to remake it.
# The DynaLoader only reads a non-empty file.
$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)
$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
$(NOECHO) $(PERLRUN) \
"-MExtUtils::Mkbootstrap" \
-e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
$(NOECHO) $(TOUCH) %s
$(CHMOD) $(PERM_RW) %s
$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)
$(INST_BOOT) : $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(NOECHO) $(RM_RF) %s
$(IGNORE)$(CP) $(BOOTSTRAP) %s
$(CHMOD) $(PERM_RW) %s
Expand Down Expand Up @@ -902,7 +904,7 @@ OTHERLDFLAGS = '.$ld_opt.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
INST_DYNAMIC_FIX = '.$ld_fix.'
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR) $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
');
if ($armaybe ne ':'){
$ldfrom = 'tmp$(LIB_EXT)';
Expand Down Expand Up @@ -2180,10 +2182,9 @@ realclean ::
# A target for each exe file.
while (my($from,$to) = each %fromto) {
last unless defined $from;
my $todir = $self->_todir($to);

push @m, "
$to : $from \$(FIRST_MAKEFILE) \$(INST_SCRIPT) \$(INST_BIN)
$to : $from \$(FIRST_MAKEFILE) \$(INST_SCRIPT)\$(DFSEP).exists \$(INST_BIN)\$(DFSEP).exists
\$(NOECHO) \$(RM_F) $to
\$(CP) $from $to
\$(FIXIN) $to
Expand All @@ -2194,28 +2195,6 @@ $to : $from \$(FIRST_MAKEFILE) \$(INST_SCRIPT) \$(INST_BIN)
}


sub _todir {
my($self, $to) = @_;
my $todir;

if( $Is_VMS ) {
# XXX I'm not quite sure what this is all about
if ($to =~ m#[/>:\]]#) {
$todir = dirname($to);
}
else {
($todir = $to) =~ s/[^\)]+$//;
}
$todir = $self->fixpath($todir,1);
}
else {
$todir = dirname($to);
}

return $todir;
}


=item linkext (o)
Defines the linkext target which in turn defines the LINKTYPE.
Expand Down Expand Up @@ -2456,8 +2435,8 @@ MAP_LIBPERL = $libperl
LLIBPERL = $llibperl
";

push @m, "
\$(INST_ARCHAUTODIR)/extralibs.all: $(INST_ARCHAUTODIR) ".join(" \\\n\t", @$extra).'
push @m, '
$(INST_ARCHAUTODIR)/extralibs.all : $(INST_ARCHAUTODIR)$(DFSEP).exists '.join(" \\\n\t", @$extra).'
$(NOECHO) $(RM_F) $@
$(NOECHO) $(TOUCH) $@
';
Expand Down Expand Up @@ -2532,8 +2511,6 @@ sub makefile {
# happen very rarely it is not a significant problem.
$m = '
$(OBJECT) : $(FIRST_MAKEFILE)
$(NOECHO) $(NOOP)
' if $self->{OBJECT};

my $newer_than_target = $Is_VMS ? '$(MMS$SOURCE_LIST)' : '$?';
Expand Down Expand Up @@ -3224,7 +3201,7 @@ sub static_lib {
my(@m);
push(@m, <<'END');
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END

Expand Down
7 changes: 3 additions & 4 deletions lib/ExtUtils/MM_VMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BEGIN {
use File::Basename;
use vars qw($Revision @ISA $VERSION);
($VERSION) = '5.71_03';
($Revision) = q$Revision: 4068 $ =~ /Revision:\s+(\S+)/;
($Revision) = q$Revision$ =~ /Revision:\s+(\S+)/;

require ExtUtils::MM_Any;
require ExtUtils::MM_Unix;
Expand Down Expand Up @@ -1016,8 +1016,7 @@ INST_DYNAMIC_DEP = $inst_dynamic_dep
";
push @m, '
$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt $(INST_ARCHAUTODIR) $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
$(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
$(INST_DYNAMIC) : $(INST_STATIC) $(PERL_INC)perlshr_attr.opt $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
If F$TrnLNm("',$shr,'").eqs."" Then Define/NoLog/User ',"$shr Sys\$Share:$shr.$Config{'dlext'}",'
Link $(LDFLAGS) /Shareable=$(MMS$TARGET)$(OTHERLDFLAGS) $(BASEEXT).opt/Option,$(PERL_INC)perlshr_attr.opt/Option
';
Expand Down Expand Up @@ -1046,7 +1045,7 @@ $(INST_STATIC) :
# Rely on suffix rule for update action
$(OBJECT) : $(FIRST_MAKEFILE)
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)
$(INST_STATIC) : $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
';
# If this extension has its own library (eg SDBM_File)
# then copy that to $(INST_STATIC) and add $(OBJECT) into it.
Expand Down
4 changes: 2 additions & 2 deletions lib/ExtUtils/MM_Win32.pm
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ sub static_lib {

my(@m);
push(@m, <<'END');
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
$(RM_RF) $@
END

Expand Down Expand Up @@ -316,7 +316,7 @@ sub dynamic_lib {
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR) $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
');
if ($GCC) {
push(@m,
Expand Down
4 changes: 2 additions & 2 deletions t/dir_target.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ chdir 't';
use Test::More tests => 1;
use ExtUtils::MakeMaker;

# For backwards compat with some Tk modules, dir_target() has to be there.
can_ok('MM', 'dir_target');
# dir_target() was typo'd as dir_targets()
can_ok('MM', 'dir_target');

0 comments on commit 0f2e87e

Please sign in to comment.